Indicator Constraints: Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored

602 views
Skip to first unread message

Sebastian Heger

unread,
Jan 13, 2017, 11:38:57 AM1/13/17
to Gurobi Optimization
Hey,

i tried to reformulate some big-M constraints in my model with indicator constraints in version 7.1 with python 3.5 on windows10 x64. Before i had the situation, that if binary variable z = 1 => the linear inequality a*x <= b must hold. If z = 0, don't care about the inequality. So this fact was modelled by a*x <= b + M*(1-z) with M sufficiently large enough.

Now i tried to use the indicator constraints with model.addGenConstrIndicator(z, True, a*x, GRB.LESS_EQUAL, b). But Gurobi doesn't solve the model, instead it states:

Indicator Constraints: Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored.

Is there anything i can check - maybe i have done a mistake or misunderstood something in the concept of indicator constraints, or is there maybe a known bug?

Best regards,
Sebastian

Daniel Espinoza

unread,
Jan 13, 2017, 9:57:33 PM1/13/17
to Gurobi Optimization
Hey Sebastian,

Could you please share a simple small example where this happens? Which version of gurobi are you using?

Best
Daniel E.

Sebastian Heger

unread,
Jan 14, 2017, 11:47:58 AM1/14/17
to Gurobi Optimization
Hey Daniel,

meanwhile i have found the troublesome equations. Because the lineare equations a*x are generate by some automatism, it could happen, that the vector a has some entries with zeros. I was expecting, that gurobi would handle that even in generic constraints, like in linear equations, if you put 0 * variable - which is 0 and can be ignored - but the equations still preserve the 0 * variable in internal representation, which causes the error.

I have fixed it by not adding the zero values. This might be a bug? I am using version 7.0.1

Best regards,
Sebastian

Daniel Espinoza

unread,
Jan 14, 2017, 3:03:49 PM1/14/17
to Gurobi Optimization
Hi Sebastian,

Thanks for the Info. I don't think this is a bug, Gurobi prefers to let users know when some part of the input is being ignored instead of silently deleting it and pretending that everything was OK. Of course that put some extra burden on users, but better safe than sorry.

By the way, when you say that the values where 0, you mean exactly zero or something in the order of 10e-10 or less?

Best
Daniel

Sebastian Heger

unread,
Jan 15, 2017, 1:15:54 PM1/15/17
to Gurobi Optimization
This is the code where equations are added:
 
self.grb_model.addGenConstrIndicator(c_var, True, min_gt_term + dly_i - dly_j, GRB.LESS_EQUAL, dj - ai)

the min_gt_term, which is the troublesome part, might look like:

<gurobi.LinExpr: 0.0 CON_ASS-e4_eBB_acDAC9A>

the method where the 0 comes from looks like:

if ei.event_type == 'GE' or ej.event_type == 'GE':
return 0

So it is definetly a 0.

In the original formulation
m = ai-dj+ei.max_dly
restr = (ai+min_gt_term+dly_i) - (dj+dly_j)
c = self.model.grb_model.addConstr(restr, GRB.LESS_EQUAL, m*(1-c_var), name='timing_of_c'+str(ei_id)+','+str(ej_id))

there is also the min_gt_term used in the same sense with 0 values, which causes no warning.

 

 
Reply all
Reply to author
Forward
0 new messages