Using addGenConstrIndicator() is causing infeasibility/numerical issues

127 views
Skip to first unread message

FeBa

unread,
Nov 14, 2016, 7:18:17 AM11/14/16
to Gurobi Optimization
Hello,

I am using addGenConstrIndicator(), a new feature of Version 7.0. Since I am adding these indicator constraints to my model, the model is infeasible.
I assume that numerical issues are causing the infeasibility. Does anybody else have the same problem?

Cheers
FeBa

Tobias Achterberg

unread,
Nov 14, 2016, 8:51:57 AM11/14/16
to gur...@googlegroups.com
Did you model those constraints yourself before, resulting in a feasible model?
Are you saying that now with using the indicator constraints instead of your
manual formulation you are getting infeasibility?

You could calculate the IIS of your infeasible model to see a reason for the
infeasibility.

Alternatively, you could send us your model so that we can take a look.


Regards,

Tobias

FeBa

unread,
Nov 15, 2016, 9:31:20 AM11/15/16
to Gurobi Optimization
Yes, you got it.
I already calculated the IIS, but it almost contains all constraints.
The model is feasible if I set the IntFeasTol to 1e-3.

Tobias Achterberg

unread,
Nov 15, 2016, 1:35:01 PM11/15/16
to gur...@googlegroups.com
Then it looks like your model is on the boundary of infeasibility, and small
changes in the model can push it to the other side.

Another test you could try is to take the solution of your formulation and fix
all variables in the new formulation (with indicator constraints) to the values
of the solution to your old model. Then run it (it should be infeasible) and
calculate an IIS to see where the infeasibility is.


Tobias
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Gurobi Optimization" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to gurobi+un...@googlegroups.com <mailto:gurobi+un...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

FeBa

unread,
Nov 16, 2016, 10:46:30 AM11/16/16
to Gurobi Optimization
Thanks for your suggestion. I did the test and the new formulation (with indicator constraints) is feasible after I set the values of the old model as the ub and lb for each variable.
Here is the code:

from gurobipy import *
model = read("model_sos.mps")
model.setParam(GRB.Param.TimeLimit, 5)
model.optimize()

vars = model.getVars()
model2 = read("model_indicator.mps")
for var in vars:
v = model2.getVarByName(var.VarName)
v.lb = var.X
v.ub = var.X

model2.optimize()
if model2.status == GRB.Status.INFEASIBLE:
model2.computeIIS()
model2.write("testIIS.ilp")
for c in model.getConstrs():
if c.IISConstr:
print('%s' % c.constrName)

Tobias Achterberg

unread,
Nov 23, 2016, 7:49:51 AM11/23/16
to Gurobi Optimization
Dear FeBa,

thanks for reporting this issue. We have identified a long standing bug in our way to deal with SOS constraints and symmetry. The result of this bug (which happens very rarely) is that a symmetry related presolve reduction removes the "SOS" marker of a variable even though the variable still participates in an active SOS constraint. The removal of this marker may then lead to subsequent presolve reductions that are invalid due to the variable being member of an SOS constraint.

This will be fixed in the next fixpack release. For the time being, you can work around this bug by disabling symmetry reductions using the "Symmetry=0" parameter.

Note that this is not directly related to the indicator constraints. Your old SOS based formulation may run into the same issue. But since the circumstances that lead to the bug are pretty unlikely, it just did not happen for your particular model.

Best regards,

Tobias

FeBa

unread,
Nov 23, 2016, 10:02:51 AM11/23/16
to Gurobi Optimization
Dear Tobias,

thanks a lot for your detailed response. I implemented your suggestion and it worked :)

Thanks!
Reply all
Reply to author
Forward
0 new messages