BookmarkSubscribeRSS Feed
Afdoone
Calcite | Level 5

Hi.  I have a binary variable and a nonlinear constraint in my model. Since I dont want to use MINLP I would like to change my non-linear constraint to a linear one and use MILP.(If it is possible). I could not convert the constraint yet so I thought maybe you have an idea.

 

I have two variables as "D" and "Ad" and the condition is:

 

if D<0 then Ad=D

if D>=0 then 0<=Ad<=D

 

I model the constraint as 

 

(D-|D|)/2<= Ad <=D

 

so the left side takes "D" if "D" is negative and "Ad" will be equal to "D" and it takes 0 if "D" is positive. I could not change this problem to linear. I know we can use binary variable to change absolute value to the linear form but since I already have a binary variable, by adding a new one the size will be huge and it is not solvable with the memory we have. I appreciate any idea you have.

2 REPLIES 2
RobPratt
SAS Super FREQ

Assuming D is bounded both above and below, you can linearize this as follows:

 

 

   var X binary;

   con C1:
      Ad <= D;

   /* if X = 1 then D <= 0 else redundant */
   con C2:
      D <= D.ub * (1 - X);

   /* if X = 1 then D <= Ad else redundant */
   con C3:
      D - Ad <= (D.ub - D.lb) * (1 - X);

   /* if X = 0 then D >= 0 else redundant */
   con C4:
      D >= D.lb * X;

   /* if X = 0 then Ad >= 0 else redundant */
   con C5:
      Ad >= D.lb * X;

 

 

 

 

Afdoone
Calcite | Level 5

Thank you so much! Binary variables make my problem huge and I am trying to avoide them. But I think it is a good idea and I will give it another try. Thank you

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 898 views
  • 0 likes
  • 2 in conversation