Lazy constraints not added

128 views
Skip to first unread message

Shimrit Shtern

unread,
Oct 7, 2016, 5:39:23 PM10/7/16
to Gurobi Optimization
I'm trying to run a MIO with lazy constraints, which I initialize with a feasible solution.
It adds one set of lazy constraints and then terminates with status optimal. How ever, checking the solution its does not satisfy the entire constraint set (which was supposed to be added in this case)
I'm using Julia v. 0.4.6 JuMP interface.
What is the reason for this?

Thank you

Shimrit



Sonja Mars

unread,
Oct 10, 2016, 7:17:57 AM10/10/16
to gur...@googlegroups.com
Hi Shimrit,

Please take a look at this page:
http://www.gurobi.com/documentation/6.5/refman/py_model_cblazy.html
This is the Python documentation of our lazy constraints and it should give an idea of what needs to be done, when working with lazy constraints.

I guess the important part is this sentence here: "Your callback should be prepared to cut off solutions that violate any of your lazy constraints, including those that have already been added. Node solutions will usually respect previously added lazy constraints, but not always."

Are you adding the lazy constraints every time they are violated? This can sometimes mean that you have to add one lazy constraint more than once.

Best regards,
Sonja


----
Dr. Sonja Mars
Gurobi Optimization - Technical Support

Shimrit Shtern

unread,
Oct 10, 2016, 11:22:04 AM10/10/16
to Gurobi Optimization
Hi Sonja
Each time I call the callback I find the first set of constraints that are violated and add them.
Meaning I add more than one lazy constraint at a time but I can add the same constraints multiple times if they are violated in the current solution.
I used lazy constraints before adding one constraint each time and it worked fine. So I'm trying to figure out if that is the issue.

Sonja Mars

unread,
Oct 11, 2016, 3:58:32 AM10/11/16
to gur...@googlegroups.com
Hi,

Yes, you can add multiple lazy constraints at a time and you can add each constraint more than once. Both should be running fine.

It is strange that it worked before when you were just adding one constraint each time. Maybe this is an issue with JuMP or you have some numerical issues going on?

Best regards,
Sonja

Miles Lubin

unread,
Oct 13, 2016, 11:39:25 AM10/13/16
to Gurobi Optimization
There was no issue with JuMP. The lazy constraints added had relatively small violations, and it appears Gurobi was silently ignoring them and accepting the infeasible solutions as incumbents.

Kostja Siefen

unread,
Oct 14, 2016, 2:25:54 AM10/14/16
to Gurobi Optimization
Please make sure that you always add all lazy constraints that are violated by the current solution in your callback. Otherwise, can you please post a minimal reproducible example that shows the behavior you're describing?

Thanks,
Kostja

Sonja Mars

unread,
Oct 14, 2016, 2:28:16 AM10/14/16
to gur...@googlegroups.com
Hi,

When you say "relatively small violations", how small are those?

Best regards,
Sonja

Dr Michael F

unread,
Oct 25, 2016, 8:45:26 PM10/25/16
to Gurobi Optimization
Kostja,

Just to clear something up here.  My understanding is that it is only necessary to add at least one lazy constraint that is violated.  

For example, if you using lazy constraints to eliminate sub-tours to solve the TSP, it is only necessary to find one sub-tour and add that constraint.  It is OK to add more than one constraint, and indeed may be more efficient, but you will still get the correct solution if you only add one lazy constraint each time.

Regards,

Michael

Tobias Achterberg

unread,
Oct 25, 2016, 8:48:43 PM10/25/16
to gur...@googlegroups.com
Michael: this is correct. Please also note that it is important that you add at
least one *violated* lazy constraint in order to reject the solution. You may
also add non-violated lazy constraints, but if none of the lazy constraints that
are added is violated by the given solution, then Gurobi may or may not accept
the solution as feasible (actually, this currently depends on where the solution
originated from).

Tobias
Reply all
Reply to author
Forward
0 new messages