Lazy constraints

Hello everybody,

Is there any way to use (or call) lazy constraint in GAMS modelling? If so, could you tell me how can I run it?

Thanks in advance
Omidi. A

Hi,

a search for “lazy” in the GAMS documentation center seems to be a good idea: https://www.gams.com/latest/docs/search.html
Currently, lazy constraints are only available for GAMS/Gurobi.

Best,
Fred

Dear Fred,

Thanks for your replay.
As per your comment, I try it and it works fine for cube problem while I try to run it on the “ROTDK” in the GAMS lib, it seems that it does not work properly. (it’s solved optimally but did not apply any lazy constraint).
AFAIK, to apply lazy in the GUROBI or CPLEX software, must define lazy (initially) into the model and solver use it when it’s needed.
I have some questions about that:

  1. does GAMS distinguish lazy automatically? If no, how can I define lazy constraints in the model?
  2. What does lazy define in the cube model (cube.gms)?
  3. What does “$call grep “Extracted .* lazy constraints” cube.log > %system.nullfile%” mean?
  4. Is it possible to apply lazy on the “ROTDK” or it’s needed a specific way?

I was wondering if, you could advise me.

Regards
Omidi. A

https://www.gams.com/latest/docs/S_GUROBI.html#GUROBIDOTlazy

I guess you arerefrreing to this example https://www.gams.com/latest/testlib_ml/libhtml/testlib_lazy01.html, which is just a wrapper around the cube model (https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_cube.html?search=cube) to solve it with lazy constraints.
Lazy constraints are defined via the gurobi option file which is activated by the subsequent call with optfile=1

...
$onecho > gurobi.opt
lazyconstraints yes
ldef.lazy 3
$offecho

$call gams cube lo=2 mip=gurobi optfile=1
...



The model is from the test library and this test makes sure that lazy constraints were used by searching for corresponding messages in the log with grep (https://en.wikipedia.org/wiki/Grep)

To use lazy constraints you need to define and activate them as described in the documentation

Dear Fred,

Thanks so much for your help.
I can do it and it works fine.

Regards
Omidi. A