Skip to main content
Solved

Modelling question - if then constraint

  • 3 June 2019
  • 2 replies
  • 1143 views

Dear Staff,

I would like your tips for an if-then constraint.



In particular, I have the following variables:

R, binary variable

P, continuous variable

Y, continuous variable



I have the following parameters:

A

B



The constraints I would like to write are the following:



1) if R=1 then P = A*Y

2) if R=0 then P = B*Y



I would like to know if it is possible to have a linear formulation without using indicator constraints.



Thank you,

2 replies

Userlevel 5
Badge +5
Hi @Chibo ,

You can use a big M formulation as below to model your constraints. You will have 4 sets of constraints in total. Here, M is a sufficiently large number, you should select this value based on the values of A, B and maximum range of Y.


code:


P >= A*Y + (R-1)*M
P <= A*Y + (1-R)*M
P >= B*Y - R*M
P <= B*Y + R*M



When R = 1, these become

code:


P >= A*Y
P <= A*Y
P >= B*Y - M
P <= B*Y + M



1 and 2 will make P = A*Y. 3 and 4 will always be satisfied if the value of M is large enough.

Similarly, when R = 0 - 3 and 4 will make P = B*Y and 1 and 2 will be rendered redundant.
Userlevel 1
Badge +3
Hello,
thank you very much for your help and for these precious suggestions. It is very kind of you.
I will try to implement them!

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator