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, bool* added = nullptr

AddAllConstraintsToLp

Return type: void

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

AddCut

Return type: bool

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. Returns true if a new cut was added and false if this cut is not efficacious or if it is a duplicate of an already existing one.

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, glop::BasisState* solution_state

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. The current solution state is used for detecting inactive constraints. It is also updated correctly on constraint deletion/addition so that the simplex can be fully iterative on restart by loading this modified state. Returns true iff LpConstraints() will return a different LP than before.

DebugCheckConstraint

Return type: bool

Arguments: const LinearConstraint& cut

If a debug solution has been loaded, this checks if the given constaint cut it or not. Returns true iff everything is fine and the cut does not violate the loaded solution.

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. If added is given, it will be set to true if this constraint was actually a new one and to false if it was dominated by an already existing one.

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.