C++ Reference: class LinearConstraintManager

This documentation is automatically generated.

This class holds a list of globally valid linear constraints and has some logic to decide which one should be part of the LP relaxation. We want more for a better relaxation, but for efficiency we do not want to have too much constraints while solving the LP.

This class is meant to contain all the initial constraints of the LP relaxation and to get new cuts as they are generated. Thus, it can both manage cuts but also only add the initial constraints lazily if there is too many of them.

TODO(user): Also store the LP objective there as it can be useful to decide which constraint should go into the current LP.
Method
Add

Return type: ConstraintIndex

Arguments: LinearConstraint ct

AddAllConstraintsToLp

Return type: void

This can be called initially to add all the current constraint to the LP returned by GetLp().

AddCut

Return type: void

Arguments: LinearConstraint ct, std::string type_name, const gtl::ITIVector<IntegerVariable, double>& lp_solution

Same as Add(), but logs some information about the newly added constraint. Cuts are also handled slightly differently than normal constraints.

AllConstraints

Return type: const gtl::ITIVector<ConstraintIndex, ConstraintInfo>&

All the constraints managed by this class.

ChangeLp

Return type: bool

Arguments: const gtl::ITIVector<IntegerVariable, double>& lp_solution

Heuristic to decides what LP is best solved next. The given lp_solution should usually be the optimal solution of the LP returned by GetLp() before this call, but is just used as an heuristic. Returns true iff LpConstraints() will return a different LP than before.

DEFINE_INT_TYPE

Arguments: ConstraintIndex, int32

Add a new constraint to the manager. Note that we canonicalize constraints and merge the bounds of constraints with the same terms. We also perform basic preprocessing.

LinearConstraintManager

Return type: explicit

Arguments: Model* model

~LinearConstraintManager

LpConstraints

Return type: const std::vector<ConstraintIndex>&

The set of constraints indices in AllConstraints() that should be part of the next LP to solve.

num_coeff_strenghtening

Return type: int64

num_cuts

Return type: int64

num_shortened_constraints

Return type: int64

SetObjectiveCoefficient

Return type: void

Arguments: IntegerVariable var, IntegerValue coeff

The objective is used as one of the criterion to score cuts. The more a cut is parallel to the objective, the better its score is.