C++ Reference: class LinearConstraintManager

Note: 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.

Return type: ConstraintIndex

Arguments: LinearConstraint ct, bool* added = nullptr


Return type: void

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


Return type: bool

Arguments: LinearConstraint ct, std::string type_name, const absl::StrongVector<IntegerVariable, double>& lp_solution, std::string extra_info = ""

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.


Return type: const absl::StrongVector<ConstraintIndex, ConstraintInfo>&

All the constraints managed by this class.


Return type: bool

Arguments: const absl::StrongVector<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.


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.


Arguments: ConstraintIndex

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.


Return type: explicit

Arguments: Model* model


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

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


Return type: int64_t


Return type: int64_t


Return type: int64_t


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. Currently this should only be called once per IntegerVariable (Checked). It is easy to support dynamic modification if it becomes needed.


Return type: std::string

Returns statistics on the cut added.