lazy01.gms : Test lazy constraints

Description

This model tests the explicit lazy constraint feature of Gurobi.

At the beginning of the MIP solution process, any constraint whose Lazy
attribute is set to 1, 2, or 3 (the default value is 0) is removed from the
model and placed in the lazy constraint pool. Lazy constraints remain inactive
until a feasible solution is found, at which point the solution is checked
against the lazy constraint pool. If the solution violates any lazy constraints,
the solution is discarded and one of more of the violated lazy constraints are
pulled into the active model.

Larger values for this attribute cause the constraint to be pulled into the
model more aggressively. With a value of 1, the constraint can be used to cut
off a feasible solution, but it won't necessarily be pulled in if another lazy
constraint also cuts off the solution. With a value of 2, all lazy constraints
that are violated by a feasible solution will be pulled into the model. With a
value of 3, lazy constraints that cut off the relaxation solution are also
pulled in.

Contributor: Michael Bussieck, December 2014


Small Model of Type : GAMS


Category : GAMS Test library


Main file : lazy01.gms

$Title Test lazy constraints (LAZY01,SEQ=671)

$Ontext
This model tests the explicit lazy constraint feature of Gurobi.

At the beginning of the MIP solution process, any constraint whose Lazy
attribute is set to 1, 2, or 3 (the default value is 0) is removed from the
model and placed in the lazy constraint pool. Lazy constraints remain inactive
until a feasible solution is found, at which point the solution is checked
against the lazy constraint pool. If the solution violates any lazy constraints,
the solution is discarded and one of more of the violated lazy constraints are
pulled into the active model.

Larger values for this attribute cause the constraint to be pulled into the
model more aggressively. With a value of 1, the constraint can be used to cut
off a feasible solution, but it won't necessarily be pulled in if another lazy
constraint also cuts off the solution. With a value of 2, all lazy constraints
that are violated by a feasible solution will be pulled into the model. With a
value of 3, lazy constraints that cut off the relaxation solution are also
pulled in.

Contributor: Michael Bussieck, December 2014
$Offtext


* There is no Gurobi on the Solaris platforms
$if %system.buildcode% == SIG $exit
$if %system.buildcode% == SOX $exit

$call gamslib -q cube
$onecho >> cube.gms
abort$(cube.solvestat<>1 or (cube.modelstat<>1 and cube.modelstat<>8)) 'Bad model/solvestatus', cube.modelstat, cube.solvestat;
abort$(abs(num.l-4)>1e-4) 'Bad num.l', num.l;
$offecho
$onecho > gurobi.opt
lazyconstraints yes
ldef.lazy 3
$offecho

$call gams cube lo=2 mip=gurobi optfile=1
$if errorlevel 1 $abort 'problems with cube. Inspect cube.lst'

* Check that we used some Lazy Constraints
$call grep "Extracted .* lazy constraints" cube.log > %system.nullfile%
$if errorlevel 1 $abort 'Gurobi did not extract lazy constraints'