1

I am trying to solve in GAMS for the binary variables using MIP but am constantly getting an error. I am unable to understand the reason. Anyone got a solution?

Set i cities /1*7/;
Binary variables z1,z2,z3,z4,z5,z6,z7     1 if selected and 0 otherwise ;
variable y ;
Equations con1,con2,con3,con4,con5,con6,con7,obj ;
obj..  y =E= z1*10+z2*6+z3*7+z4*8+z5*13+z6*9+z7*8;
con1.. min(z2*6.1,z3*15.2,z4*17,z5*16.8,z6*8.4,z7*16.6) =L= 10 ;
con2.. min(z1*6.1,z3*7.6,z4*16.0,z5*11.3,z6*2.2,z7*11.9) =L= 10 ;
con3.. min(z1*15.2,z2*7.6,z4*22.0,z5*17.3,z6*10.2,z7*16.7) =L= 10 ;
con4.. min(z1*17.0,z2*16.0,z3*22.0,z5*12.1,z6*14.8,z7*7.2) =L= 10 ;
con5.. min(z1*16.8,z2*11.3,z3*17.3,z4*12.1,z6*9.4,z7*2.9) =L= 10 ;
con6.. min(z1*8.4,z2*2.2,z3*10.2,z4*14.8,z5*9.4,z7*9.2) =L= 10 ;
con7.. min(z1*16.6,z2*11.9,z3*16.7,z4*7.2,z5*2.9,z6*9.2) =L= 10 ;

Model planmall /all/ ;

Solve planmall using MIP minimizing y;

display z1.L,z2.L,z3.L,z4.L,z5.L,z6.L,z7.L,y.L;
Shraddha Avasthy
  • 161
  • 3
  • 13

1 Answers1

1

If I run your model, I see this in the lst file:

****  51  Endogenous function argument(s) not allowed in linear models
**** 256  Error(s) in analyzing solve statement. More detail appears
****      Below the solve statement above
**** The following MIP errors were detected in model planmall:
****  51 equation con1.. the function MIN is called with non-constant arguments
...

So the problem is, that you try to solve a (linear) MIP, but you the function MIN with variables, which is not allowed for this model type. So, one way to resolve this is to change your model type to MINLP like this:

Solve planmall using MINLP minimizing y;

Or, you reformulate your model, so that you do not use the MIN function anymore.

Lutz
  • 2,197
  • 1
  • 10
  • 12
  • It does work for MINLP but am I formulating the equations wrong?- I need to use MIP here – Shraddha Avasthy Sep 06 '18 at 16:10
  • 1
    The equation is not wrong, but the min function is not linear. But usually you can formulate such equations differently, so that they are linear. Look for example at this post: https://stackoverflow.com/questions/10792139/using-min-max-within-an-integer-linear-program – Lutz Sep 07 '18 at 06:57