Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class VariableWithSameReasonIdentifier
Note: This documentation is automatically generated.
Boolean linear constraints can propagate a lot of literals at the same time.
As a result, all these literals will have exactly the same reason. It is
important to take advantage of that during the conflict
computation/minimization. On some problem, this can have a huge impact.
TODO(user): With the new SAME_REASON_AS mechanism, this is more general so
move out of pb_constraint.
Returns the first variable with exactly the same reason as 'var' on which
this function was called since the last Clear(). Note that if no variable
had the same reason, then var is returned.
[[["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\u003eVariableWithSameReasonIdentifier\u003c/code\u003e class helps optimize Boolean linear constraint propagation by grouping literals with the same reason.\u003c/p\u003e\n"],["\u003cp\u003eThis optimization is crucial as it significantly impacts conflict computation and minimization, leading to performance improvements, especially for complex problems.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides methods like \u003ccode\u003eClear\u003c/code\u003e, \u003ccode\u003eFirstVariableWithSameReason\u003c/code\u003e, and \u003ccode\u003eResize\u003c/code\u003e to manage and utilize the identified literals with the same reason.\u003c/p\u003e\n"],["\u003cp\u003eIt is recommended to call the \u003ccode\u003eClear\u003c/code\u003e method before each conflict analysis for optimal results.\u003c/p\u003e\n"]]],["The `VariableWithSameReasonIdentifier` class in C++ manages literals with identical reasons, crucial for conflict computation in Boolean linear constraints. Key actions include initializing the class with a `Trail`, clearing a cache via `Clear` before each conflict analysis, and resizing with `Resize`. The `FirstVariableWithSameReason` method identifies the first variable with an identical reason to a given variable, optimizing conflict analysis when many literals share the same reason.\n"],null,["# VariableWithSameReasonIdentifier\n\nC++ Reference: class VariableWithSameReasonIdentifier\n=====================================================\n\n\nNote: This documentation is automatically generated.\nBoolean linear constraints can propagate a lot of literals at the same time. As a result, all these literals will have exactly the same reason. It is important to take advantage of that during the conflict computation/minimization. On some problem, this can have a huge impact. \n\nTODO(user): With the new SAME_REASON_AS mechanism, this is more general so move out of pb_constraint.\n\n| Method ||\n|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`Clear`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/pb_constraint.h#L708) | Return type: `void ` Clears the cache. Call this before each conflict analysis. |\n| [`FirstVariableWithSameReason`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/pb_constraint.h#L713) | Return type: `BooleanVariable ` Arguments: `BooleanVariable var` Returns the first variable with exactly the same reason as 'var' on which this function was called since the last Clear(). Note that if no variable had the same reason, then var is returned. |\n| [`Resize`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/pb_constraint.h#L702) | Return type: `void ` Arguments: `int num_variables` \u003cbr /\u003e |\n| [`VariableWithSameReasonIdentifier`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/pb_constraint.h#L699) | Return type: `explicit ` Arguments: `const Trail& trail` \u003cbr /\u003e |"]]