Error in my Code

Problems with modeling
Post Reply
Bahar_Mdi
User
User
Posts: 21
Joined: 4 years ago

Error in my Code

Post by Bahar_Mdi »

Hi,

I am coding a problem in GAMS and to check that my code performs correctly, I design a problem that I know its solution. but my code doesn't return the correct solution. so, I 've decided to fix the variables same as the optimal solution to know which part doesn't work correctly. but I get this Error:
MODEL STATUS 19 Infeasible - No Solution

when I checked the Equation part in .lst file, I found that there are errors in some equations that the variable values that I 've fixed them, don't violate the constraints related to mentioned equation. could anyone help me?

this is the variable that I 've fixed;
e30..z('0','1')=e=1;
e31..z('1','3')=e=1;
e32..z('3','5')=e=1;
e33..w('1','2','1')=e=1;
e34..wb('2','3','1')=e=1;

and this is the Errors:
---- e5 =E=

e5(1).. z(0,1) + z(2,1) + z(3,1) + z(4,1) + w(2,1,0) + w(2,1,1) + w(3,1,0)

+ w(3,1,1) + w(4,1,0) + w(4,1,1) + wh(2,1,0) + wh(2,1,1) + wh(3,1,0)

+ wh(3,1,1) =E= 1 ; (LHS = 0, INFES = 1 ****)

e5(2).. z(0,2) + z(1,2) + z(3,2) + z(4,2) + w(1,2,0) + w(1,2,1) + w(3,2,0)

+ w(3,2,1) + w(4,2,0) + w(4,2,1) + wh(1,2,0) + wh(1,2,1) + wh(3,2,0)

+ wh(3,2,1) =E= 1 ; (LHS = 0, INFES = 1 ****)

e5(3).. z(0,3) + z(1,3) + z(2,3) + z(4,3) + w(1,3,0) + w(1,3,1) + w(2,3,0)

+ w(2,3,1) + w(4,3,0) + w(4,3,1) + wh(1,3,0) + wh(1,3,1) + wh(2,3,0)

+ wh(2,3,1) =E= 1 ; (LHS = 0, INFES = 1 ****)
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Error in my Code

Post by Renger »

Hi
In the listing of your equations you see the linearized version of your equations with start values inserted (not the solution). If you haven't set any starting values, Gams assumes 0. This can result in infeasibilities.

For example:

Code: Select all

eq1..
    A + B =E= 1;
will give you in the listing

Code: Select all

 (LHS = 0, INFES = 1 ****)
as A and B are initialized with 0.
However, if you initialize as follows:

Code: Select all

eq1..
    A + B =E= 1;
A.L = 1;
B.L = 0;
will not give an infeasibility. Note, that these are just the starting values. The final solution might be A.L = 0.5 and B.L = 0.5 (or any other combination).

If you have infeasibilities in your solve, they will be reported further down in the listing of the variables and your report summary.

Hope this helps.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply