GAMS/CPLEX Indicator constraints

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

GAMS/CPLEX Indicator constraints

Post by Archiver »



I am attempting to add a CPLEX indicator constraint to a gams model. When I add it, it rules the problem infeasible, but there is a feasible solution.

In the attached example code, I want to add the following constraint only when the binary variable q(V,W,I,J) is 1:

indic_const(V,W,I,J)$(E(V,I,J) and E(W,I,J)).. time_e(V,I,J) =e= time_e(W,I,J);

So I include the above line, and the appropriate lines to the cplex.opt file.

If I solve the problem without this indicator constraint, I get a solution that has all q(V,W,I,J) = 0 (as you can see from the generated "answer" file). So adding it should not make the problem infeasible.

The attached code does not have the indicator constraint included, so you can try it both ways. If you want to include it, uncomment lines 59, 84, 104, 105.

Thank you for your help.


--
Attachments

[The extension gams has been deactivated and can no longer be displayed.]

Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: GAMS/CPLEX Indicator constraints

Post by Archiver »


Hi,

If you carefully look at the model that gets generated by GAMS *Equation listing) you see that you have 4 indic_const:

---- indic_const =E=
indic_const(v1,v2,1,2).. time_e(v1,1,2) - time_e(v2,1,2) =E= 0 ; (LHS = 0)
indic_const(v1,v2,2,3).. time_e(v1,2,3) - time_e(v2,2,3) =E= 0 ; (LHS = 0)
indic_const(v2,v1,1,2).. - time_e(v1,1,2) + time_e(v2,1,2) =E= 0 ; (LHS = 0)
indic_const(v2,v1,2,3).. - time_e(v1,2,3) + time_e(v2,2,3) =E= 0 ; (LHS = 0)

In your cplex.opt you only tie 2 to some q variables. The other two are unconditionally in the model which makes it infeasible. Since you only have 2 q variables in the model, I guess that you forgot to add the condition "and ord(W) <= ord(V)" to the equation definition of indic_const. If you do that the model solves fine. Attached is the modified code.

Hope this helps,
Michael Bussieck - GAMSWorld coordinator

On Tuesday, January 26, 2016 at 11:22:45 AM UTC-5, jmlarson@gmail.com wrote:


I am attempting to add a CPLEX indicator constraint to a gams model. When I add it, it rules the problem infeasible, but there is a feasible solution.

In the attached example code, I want to add the following constraint only when the binary variable q(V,W,I,J) is 1:

indic_const(V,W,I,J)$(E(V,I,J) and E(W,I,J)).. time_e(V,I,J) =e= time_e(W,I,J);

So I include the above line, and the appropriate lines to the cplex.opt file.

If I solve the problem without this indicator constraint, I get a solution that has all q(V,W,I,J) = 0 (as you can see from the generated "answer" file). So adding it should not make the problem infeasible.

The attached code does not have the indicator constraint included, so you can try it both ways. If you want to include it, uncomment lines 59, 84, 104, 105.

Thank you for your help.


--
Attachments
to_share.gms
(3.69 KiB) Downloaded 277 times
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: GAMS/CPLEX Indicator constraints

Post by Archiver »


You are (of course) correct. Thank you very much for your help.

On Tuesday, January 26, 2016 at 10:22:45 AM UTC-6, jmla...@gmail.com wrote:


I am attempting to add a CPLEX indicator constraint to a gams model. When I add it, it rules the problem infeasible, but there is a feasible solution.

In the attached example code, I want to add the following constraint only when the binary variable q(V,W,I,J) is 1:

indic_const(V,W,I,J)$(E(V,I,J) and E(W,I,J)).. time_e(V,I,J) =e= time_e(W,I,J);

So I include the above line, and the appropriate lines to the cplex.opt file.

If I solve the problem without this indicator constraint, I get a solution that has all q(V,W,I,J) = 0 (as you can see from the generated "answer" file). So adding it should not make the problem infeasible.

The attached code does not have the indicator constraint included, so you can try it both ways. If you want to include it, uncomment lines 59, 84, 104, 105.

Thank you for your help.


--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Post Reply