Stay organized with collections
Save and categorize content based on your preferences.
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.
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.
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.
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.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eLinearConstraintManager\u003c/code\u003e class in OR-Tools manages linear constraints for LP relaxations, aiming for a balance between relaxation quality and computational efficiency.\u003c/p\u003e\n"],["\u003cp\u003eIt stores initial constraints and dynamically adds cuts generated during the solving process, using heuristics to select the most effective constraints for the LP.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides methods for adding, managing, and analyzing constraints, including functionalities for scoring and selecting cuts based on their impact on the LP solution.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLinearConstraintManager\u003c/code\u003e also allows for objective function coefficients to be set, influencing the selection of cuts by prioritizing those aligned with the objective.\u003c/p\u003e\n"],["\u003cp\u003eUsers can access statistics and debug functionalities to monitor the constraint management process and ensure the validity of added cuts.\u003c/p\u003e\n"]]],["The `LinearConstraintManager` class manages linear constraints for LP relaxation. It adds and stores constraints and cuts, using `Add` and `AddCut` methods. `AddAllConstraintsToLp` adds all constraints to the LP. `ChangeLp` determines the next best LP to solve, while `LpConstraints` provides constraints to include. It also canonicalizes, preprocesses constraints, manages cuts efficacy, and allows setting objective coefficients via `SetObjectiveCoefficient`. The `AllConstraints` method returns all the constraints. It also provides methods for debug and statictics.\n"],null,[]]