SAS Optimization, and SAS Simulation Studio

turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-24-2017 08:39 AM - edited 06-24-2017 08:41 AM

how to linearize the following constraint to be able to solve it with optmodel

con Con1 {i in Item ,j in Cust}: (limit[i,'A1'] -x[i,'A1']) * x[i,'A2']=0;

where x is the decision variable.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-24-2017 09:04 AM - edited 06-24-2017 09:07 AM

What kind of variable is x?

Also, the constraint is declared over i and j but does not depend on j. The effect is that you get multiple copies of the same equation. You can use the EXPAND statement to see this.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to RobPratt

06-24-2017 09:16 AM

X is an integer variable "quantity". the constraint depends on Both i and j. where j is the customer A,B,C. for customer A I have two offers for customer A; A1& A2, where customer can only leverage the discounted price A2 if he takes a minimum of quantity x with price A1.

I used expand and the function is working fine.

The thing is that I need an integer variable, and I receive this error" The NLP solver does not allow integer variables" when x is defined as integer. while, when x is not an integer it works fine but with lots of decimals

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-24-2017 11:25 AM - edited 06-24-2017 12:40 PM

But the equation for your constraint does not contain j anywhere. So for the same i but different j, the constraint declaration will generate the same equation. If you did not see duplicates when you used EXPAND, then I suspect the code you ran is somehow different than what you posted.

In any case, I think I understand what you want to accomplish. So let me describe the model generically and you can modify it as needed to use in your optimization problem. Suppose x and y are variables, with 0 <= x <= u, where u is some constant, and y >= 0. You want to model the logical implication "if x > 0 then y >= c," where c is some constant. Then you can introduce a binary variable z and the following constraints:

x <= u * z

and

y >= c * z.

If x > 0, the first constraint forces z = 1. If z = 1, the second constraint forces y >= c. So together they enforce the desired implication: if x > 0 then y >= c.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to RobPratt

06-26-2017 06:57 AM

Thank you Rob,