Once ALL constraints have been processed, call this to fix variables or
reduce their domain if possible.
Note that this also tighten some constraint that are the only one blocking
in one direction. Currently we only do that for implication, so that if we
have two Booleans such that a + b <= 1 we transform that to = 1 and we
remove one variable since we have now an equivalence relation.
[[["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\u003eDualBoundStrengthening\u003c/code\u003e class identifies and processes variables with free movement in one direction or within specific bounds.\u003c/p\u003e\n"],["\u003cp\u003eIt utilizes constraint analysis to detect these variables and potentially reduce large bounds, which is beneficial before scaling.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides methods to specify constraints on variable movement and to strengthen the model by fixing variables or tightening bounds based on these constraints.\u003c/p\u003e\n"],["\u003cp\u003eIt's crucial to call the \u003ccode\u003eReset\u003c/code\u003e method before processing constraints and the \u003ccode\u003eStrengthen\u003c/code\u003e method after processing to apply the detected improvements.\u003c/p\u003e\n"]]],["The `DualBoundStrengthening` class detects variables with directional freedom or bound-limited movement. Key actions include: identifying how far a variable can decrease freely (`CanFreelyDecreaseUntil`), marking variables that cannot decrease/increase/move (`CannotDecrease`, `CannotIncrease`, `CannotMove`), and recording the number of deleted constraints (`NumDeletedConstraints`). It processes linear constraints (`ProcessLinearConstraint`), resets its state (`Reset`), and tightens variable domains and constraints once all constraints are processed (`Strengthen`). This process is important to reduce large bounds before scaling.\n"],null,["C++ Reference: class DualBoundStrengthening\n\n\nNote: This documentation is automatically generated.\nThis detects variables that can move freely in one direction, or that can move freely as long as their value do not cross a bound. \n\nTODO(user): This is actually an important step to do before scaling as it can usually reduce really large bounds!\n\n| Method ||\n|-------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`CanFreelyDecreaseUntil`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L252) | Return type: `int64_t ` Arguments: `int ref` The given ref can always freely decrease until the returned value. Note that this does not take into account the domain of the variable. |\n| [`CannotDecrease`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L230) | Return type: `void ` Arguments: `absl::Span\u003cconst int\u003e refs, int ct_index = -1` All constraints should be mapped to one of more call to these functions. |\n| [`CannotIncrease`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L231) | Return type: `void ` Arguments: `absl::Span\u003cconst int\u003e refs, int ct_index = -1` \u003cbr /\u003e |\n| [`CannotMove`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L232) | Return type: `void ` Arguments: `absl::Span\u003cconst int\u003e refs, int ct_index = -1` \u003cbr /\u003e |\n| [`NumDeletedConstraints`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L257) | Return type: `int ` Reset on each Strengthen() call. |\n| [`ProcessLinearConstraint`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L236) | Return type: `void ` Arguments: `bool is_objective, const PresolveContext& context, const LinearProto& linear, int64_t min_activity, int64_t max_activity, int ct_index = -1` \u003cbr /\u003e |\n| [`Reset`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L223) | Return type: `void ` Arguments: `int num_variables` Reset the class to a clean state. This must be called before processing the constraints. |\n| [`Strengthen`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/var_domination.h#L248) | Return type: `bool ` Arguments: `PresolveContext* context` Once ALL constraints have been processed, call this to fix variables or reduce their domain if possible. Note that this also tighten some constraint that are the only one blocking in one direction. Currently we only do that for implication, so that if we have two Booleans such that a + b \\\u003c= 1 we transform that to = 1 and we remove one variable since we have now an equivalence relation. |"]]