Error: Endogenous function arguments not allowed in linear models Topic is solved

Solver related questions
Post Reply
savasthy
User
User
Posts: 3
Joined: 5 years ago

Error: Endogenous function arguments not allowed in linear models

Post by savasthy »

Can you help fix error with the code below? I am solving for z1-z7 binary variables but keep getting this error.

Code: Select all

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; 
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Error: Endogenous function arguments not allowed in linear models

Post by Renger »

Hi

You could make it a MINLP instead of a MIP. This solves fine using DICOPT.

Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
savasthy
User
User
Posts: 3
Joined: 5 years ago

Re: Error: Endogenous function arguments not allowed in linear models

Post by savasthy »

Thanks! I found an LP solution.
Post Reply