ILOG CPLEX .NET Reference Manual

Cplex.AddLazyConstraints Method (IConstraint[], Int32, Int32)

This is an advanced method.

public virtual IConstraint[] AddLazyConstraints(
   IConstraint[] cut,
   int start,
   int num
);

Parameters

cut
An array of constraints to be added as lazy constraints. All constraints must be linear.
start
The index of the first element in cut to be added as a lazy constraint.
num
The number of consecutive constraints in cut to be added as lazy constraints.

Return Value

An array containing the constraints added as lazy constraints. This is the same array as cut.

Remarks

Important:

Advanced methods typically demand a profound understanding of the algorithms used by ILOG CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, ILOG encourages you to consider carefully whether you can accomplish the same task by means of other methods instead.

This method copies constraints into the lazy constraints pool. num constraints listed in array cut are copied into the lazy constraint pool, starting with element start. The constraints themselves do not become part of the pool, so changes to them after they have been copied into the lazy constraint pool will not affect the lazy constraint pool.

Lazy constraints added with addLazyConstraints are typically constraints of the model that are not expected to be violated when left out. The idea is that the LPs that are solved when the MIP is being solved can be kept smaller when these constraints are not included. Cplex will, however, include a lazy constraint in the LP as soon as the constraint is violated. In other words, the solution computed by Cplex makes sure that all the lazy constraints that have been added are satisfied.

By contrast, if the constraint does not change the feasible region of the active model but only strengthens the formulation, it is referred to as a user cut. User cuts can be added to Cplex by addLazyConstraint, but it is generally preferable to do so with addUserCuts. It is an error, however, to add lazy constraints by means of addUserCuts.

When columns are deleted from the active model, all lazy constraints are deleted as well and need to be recopied into the lazy constraint pool. Otherwise, use clearLazyConstraints to clear the list of lazy constraints.

See Also

Cplex Class | ILOG.CPLEX Namespace | Cplex.AddLazyConstraints Overload List