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

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-25-2012 03:47 AM

When I write an equation in the form:

(x1+x2)/(y1+y2)=2 (where x(i), y(i) are decision variables)

SAS-OR considers the equation as a non-linear constraint.

However when I re-write the same equation in the form:

x1+x2=2*(y1+y2), SAS-OR considers it as a linear constraint.

Can somebody please help?

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

Posted in reply to Abhik

05-25-2012 10:15 AM

There is no auto linearization in SAS/OR yet. We do have plans to do some auto linearization in the future.

Are you using OPTMODEL or PROC NLP?

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

Posted in reply to YanXu

05-25-2012 10:22 AM

I am using OPTMODEL. I am not very sure about what you mean by 'auto-linearization'. But (x1+x2)/(y1+y2)=2 is a linear equation, and if SAS considers this as a non-linear one, then it's wrong.

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

Posted in reply to Abhik

05-25-2012 10:40 AM

No, (x1+x2) / (y1+y2) = 2 is not a linear equation and in fact it is not exactly equivalent to the linear equation x1+x2 = 2*(y1+y2) since the latter allows the solution (0,0,0,0). When you linearize constraints of this form (and even more so for inequalities), you have to be careful about the sign of the denominator. For example, (x1+x2) / (y1+y2) >= 2 is equivalent to x1+x2 >= 2*(y1+y2) if and only if y1+y2 > 0.

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

Posted in reply to RobPratt

05-25-2012 10:47 AM

Linearization is technique to transfer nonlinear items to linear items.

Rob is right, (x1+x2) / (y1+y2) = 2 ---> x1+x2 = 2*(y1+y2), only if you know that y1+y2 is never going to be 0. Otherwise, they are not equivalent.

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

Posted in reply to YanXu

05-28-2012 03:32 AM

Thanks for the clarification.

By the way, I have an equation of the form x/y+z=c (where x,y,z are decision variables and >0, c is a constant).Is there a possible way of converting this to a linear form?

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

Posted in reply to Abhik

05-28-2012 10:20 AM

If you multiply both sides by y, you get x + y z = c y. If y and z are binary variables, you can replace the product y z with a new binary variable w and add some constraints. If only one of y and z is binary and the other is bounded, you can linearize the product in a similar manner. If neither of y and z is binary, you can discretize one of them and apply the same techniques.

For details, please see Chapters 10 and 24 in the new book of mathematical programming examples available as part of the SAS/OR documentation:

https://support.sas.com/pubscat/bookdetails.jsp?pc=64980 (click on View This Title Online for a free pdf version).

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

Posted in reply to RobPratt

06-07-2012 02:25 AM

Neither of y and z is binary. Rob, I am not sure how I can discretize them so that the equation becomes linear.

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

Posted in reply to Abhik

06-09-2012 11:29 AM

Here is how to discretize a bounded variable y:

proc optmodel;

var y >= 0 <= 3;

num num_steps = 10;

set STEPS = 0..num_steps-1;

num a {s in STEPS} = (s - y.lb) / (y.ub - y.lb);

var yb {STEPS} binary;

con assign: sum {s in STEPS} yb~~ = 1;~~

con link: sum {s in STEPS} a~~ * yb~~~~ = y;~~

quit;