How can I use only less than but not equal in constraint

Problems with modeling
Post Reply
Agustino
User
User
Posts: 7
Joined: 1 year ago

How can I use only less than but not equal in constraint

Post by Agustino »

It is io difficult to do this.

obj.. R =e= sum((i,j,k),a(j,k)* b(j)*c(j,k)*x(i,j,k)) + sum((i,j,k),a(j,k)* b(j)*c(j,k)*z(i,j,k)) + sum((i,j,k), x(i,j,k)*h(i,j)*m(i,j)) + sum((i,j,k), z(i,j,k)*h(i,j)*m(i,j));
con1(i,k).. sum((j),a(j,k)* b(j)*x(i,j,k)) =g= d(i,k);
con2(i,k).. sum((j),a(j,k)* b(j)*z(i,j,k)) =l= d(i,k);

From con2 (The number of crops in tonnes (left) is less than the demand of factory), I found a lot of problems because the objeective is to minimize cost. It seems con 2 will not enable. So, I would like to merge to one constraint or create sum loop, like if con1 works then con2 not work and when con2 works then con1 not work. Could you recommend how to solve this coding? :geek: x(i,j,k) and z(i,j,k) are binary variable that I use for differentiate these 2 constrants. Please let me know if you have any comments or suggestions.

Thanks in advance !
Manassaldi
User
User
Posts: 118
Joined: 7 years ago
Location: Rosario - Argentina

Re: How can I use only less than but not equal in constraint

Post by Manassaldi »

Hello, I think you can try a BigM reformulation:

con(i,k) is a binary varible

con1(i,k).. sum((j),a(j,k)* b(j)*x(i,j,k)) =g= d(i,k) - BigM*(1-con(i,k));
con2(i,k).. sum((j),a(j,k)* b(j)*z(i,j,k)) =l= d(i,k) + BigM*con(i,k);

then, if con(i,k) takes the value of one, equation con1 is satisfied and equation con2 is always satisfied
sum((j),a(j,k)* b(j)*x(i,j,k)) =g= d(i,k);
sum((j),a(j,k)* b(j)*z(i,j,k)) =l= d(i,k) + BigM;

if con(i,k) takes the value of zero, equation con2 is satisfied and equation con1 is always satisfied
sum((j),a(j,k)* b(j)*x(i,j,k)) =g= d(i,k) - BigM;
sum((j),a(j,k)* b(j)*z(i,j,k)) =l= d(i,k);

Hope this can help you, bye.
Post Reply