Solving results

Why don’t obvious constraints work in GAMS? For example, the production decision variable must be greater than demand, but this obvious constraint doesn’t work.

Hi @LeilaRostamian, If you want help in this forum you will need to provide an example. Your comment is not sufficient.

Sets
t /1*3/
n /1*5/
alias(n,m)
;
parameters
TiI(n)  /1 1,2 5,3 2,4 3,5 7/
CoI(n)  /1 5,2 10,3 10,4 3,5 12/
ptn(n)  /1 10,2 15,3 12,4 20,5 17/
pti(n)  /1 5,2 10,3 7,4 13,5 12/
AT(t)  /1 100,2 100,3 100/
st0(n)  /1 5,2 3,3 2,4 4,5 1/
sc0(n)  /1 5,2 6,3 7,4 4,5 2/
;
table r(n,t) 
         1       2       3
1        5       1       4
2        3       2       5
3        2       3       4
4        4       5       6
5        7       5       3
;
table rt(n,t) 
         1       2       3
1        5       3       2
2        6       4       3
3        4       2       5
4        7       3       4
5        8       4       3
;

table d(n,t) 
         1       2       3
1        50      60      50
2        30      70      50
3        20      30      40
4        40      40      60
5        10      50      40
;
table st(n,m) 
         1       2       3       4       5
1        5       3       2       4       2
2        6       4       3       4       2
3        4       2       5       1       3
4        7       3       4       6       5
5        8       4       3       3       3
;
table sc(n,m) 
         1       2       3       4       5
1        1       2       8       3       5
2        1       4       3       2       2
3        2       5       7       2       1
4        7       4       4       6       5
5        3       3       5       8       2
;

table fc(n,t) 
         1       2       3
1        6       1       4
2        5       2       5
3        4       3       4
4        3       4       6
5        2       5       3
;
table CS(n,t) 
         1       2       3
1        2       7       4
2        3       7       5
3        5       3       4
4        4       5       6
5        6       5       3
;
Scalar
L  /3/
Toverhaul  /40/
Tpm /15/
Tmr  /5/
Coverhaul  /95/
Cpm  /35/
Cmr  /10/
H  /18/
G  /5/
LN Large_Number /999999999/
Ep Epselond /.00000000001/
Z1_best
Z2_worst
Z2_best
Z1_worst
;
variables Z1,Z2,Zf;
positive variables pt(n),a1,a2;
binary variables p(t),y(n,m,t),y0(n,t),o(t),p(t);
integer variables umin(n),umax(n),q(n,t),BL(t),u(n,t);
umin.up(n)=10000;
umax.up(n)=10000;
q.up(n,t)=100000;
BL.up(t)=1000000;
u.up(n,t)=100000;

equations OBJ1,OBJ2,OBJf,C1,C2,C3,C4,C4_,C5,C5_,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16;

OBJ1 .. Z1=e=sum(t,sum(n,st0(n)*y0(n,t))+sum((n,m)$(ord(n) ne ord(m)),sc(n,m)*y(n,m,t)))+sum((n,t),(fc(n,t)+CS(n,t)*pt(n))*u(n,t))+
           sum((n,t),(CoI(n)*u(n,t)+r(n,t)*q(n,t)))+sum(t,Cpm*p(t)+Coverhaul*o(t));
OBJ2 .. Z2=e=sum(n,umax(n)-umin(n));
OBJf .. Zf=e=a1+a2;
C1(n,t) .. y0(n,t)+sum(m $(ord(n) ne ord(m)),y(n,m,t))=e=1;
C2(t) .. sum(n,st0(n)*y0(n,t))+sum((n,m)$(ord(n) ne ord(m)),sc(n,m)*y(n,m,t))+sum(n,u(n,t)*pt(n))+Tpm*p(t)+Toverhaul*o(t)+sum(n,TiI(n)*u(n,t)+rt(n,t)*q(n,t))=l=AT(t);
C3(t) .. BL(t)=e=sum(n,q(n,t));
C4(n) .. pt(n)=g=pti(n);
C4_(n) .. pt(n)=l=ptn(n);
C5(n,t) .. umin(n)=l=u(n,t);
C5_(n,t) .. u(n,t)=l=umax(n);
C6(n,t) .. u(n,t)=g=d(n,t);
C7(n,t) .. q(n,t)=l=u(n,t);
C8(t) .. BL(t)=g=o(t)*(H+Ep);
C9(t) ..  BL(t)=l=H+o(t)*LN;
C10(t) ..  BL(t)=g=p(t)*(G+Ep);
C11(t) .. BL(t)=l=G+p(t)*LN;
C12(t) ..  o(t)+p(t)=l=1;
C13 .. a1=l=1;
C14 .. a2=l=1;
model ProductionPlanning1 /OBJ1,OBJ2,C1,C2,C3,C4,C4_,C5_,C5,C6,C7,C8,C9,C10,C11/;
Option optca=0,optcr=0,MINLP=BARON,reslim=3600;
solve ProductionPlanning1 using MINLP min Z1;
*The best value for z1 as it is minimization
Z1_best=Z1.l;
*The worst value for z2 as it is minimization
Z2_worst=Z2.l;
model ProductionPlanning2 /OBJ2,OBJ1,C1,C2,C3,C4,C4_,C5,C5_,C6,C7,C8,C9,C10,C11/;
Option optca=0,optcr=0,MINLP=BARON,reslim=3600;
solve ProductionPlanning2 using MINLP min Z2;
*The best value for z2 as it is minimization
Z2_best=Z2.l;
*The worst value for z1 as it is minimization
Z1_worst=Z1.l;
C16 .. Z1=l=Z1_best+(Z1_worst-Z1_best)*(1-a1);
C15 .. Z2=l=Z2_best+(Z2_worst-Z2_best)*(1-a2);
model ProductionPlanning /OBJf,C1,C2,C3,C4,C4_,C5,C5_,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16/;
Option optca=0,optcr=0,MINLP=BARON,reslim=3600;
solve ProductionPlanning using MINLP max Zf;
display Zf.l,a1.l,a2.l,pt.l,p.l,y.l,y0.l,o.l,q.l,BL.l,u.l,umin.l,umax.l;

@LeilaRostamian
I recommend to always check the model status before interpreting results. Baron clearly states

                       *** Problem is infeasible ***

Baron option compIIS can be helpful in such cases. For your model it reports the following.

Number of equations in the IIS:  1.
Lower: C6(3,1) >= 20

Number of variables in the IIS:  1.
Lower: pt(3) >= 0

I hope this helps!

Fred

Hi, thanks for your reply. Yes, I didn’t pay attention and I thought the solver’s status, which is written normal, must have been completely solved. See, I can see now that it is infeasible, but where can I see the violated constraints? All production quantity variables (u(n,t)) have become Zero!

If my model is a production model, production should be greater than demand or u(n,t)=g=d(n,t). how much I think about it, I don’t know why the production model makes u(n,t)=0?

@LeilaRostamian A solver status “Normal completion” does not imply that a feasible/optimal solution has been found.

Your model is infeasible. So there is no feasible point to all the constraint to have specified. You either made a mistake implementing some constraint, or the combination of model and data really allows for no feasible solution. This state of the optimization model is in general not a bug or problem. It is one of the possible theoretic outcomes of an optimization run: optimal/infeasible/unbounded.

I assume infeasibility may be unexpected in this case? Then the real work is to figure out where the infeasibility comes from. There is no single way of doing this. It very much depends on your knowledge and understanding of the original problem and its implementation as a model. One way to go about analyzing infeasibilities could be to provide a “solution” you assume to be feasible to the problem by manually setting the variable level values (x.l(i,j) = …) and then generating the model with a full equation listing (option limrow=1e9;) This will flag the constraints that are infeasible with your “feasible” solution (INFES =…).

Another alternative could to work with the above mentioned Baron Option compIIS which may help to pinpoint the source of the infeasibility.

I hope this helps!

Thank you very much.