Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class CpModelView
Note: This documentation is automatically generated.
This class allows to query information about the current bounds of the loaded
cp_model.proto variables during the search. It is a "view" of the current
solver state using the indices of the proto.
TODO(user): For now it uses proto indices of the loaded model. We will need
to add a mapping to use proto indices of the non-presolved model to allow for
a client custom search with presolve. The main API shouldn't change though
and the change will be transparent.
If under a given partial assignment, the value of a variable has no impact,
this might returns true, and there is no point trying to branch on this
variable.
This might for example be the case for the start of an unperformed interval
which will not impact the rest of the problem in any way. Note that it is
still possible to branch on ignored variable, this will just not change
anything.
[[["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\u003eCpModelView\u003c/code\u003e class provides a way to access information about the current bounds of variables during the search of a CP-SAT model.\u003c/p\u003e\n"],["\u003cp\u003eIt allows users to query the current state of variables, such as if a variable is fixed, its minimum and maximum values, and whether it's currently free.\u003c/p\u003e\n"],["\u003cp\u003eThe class utilizes proto indices of the loaded model, with plans to add mapping for non-presolved models in the future for custom search with presolve.\u003c/p\u003e\n"],["\u003cp\u003eHelper functions like \u003ccode\u003eGreaterOrEqual\u003c/code\u003e, \u003ccode\u003eLowerOrEqual\u003c/code\u003e, and \u003ccode\u003eMedianValue\u003c/code\u003e are provided to generate decisions during the search process.\u003c/p\u003e\n"],["\u003cp\u003eIt's important to note that branching on ignored variables, while possible, won't impact the problem's solution.\u003c/p\u003e\n"]]],["The `CpModelView` class allows querying the current bounds of variables in a loaded `cp_model.proto`. Key actions include: checking if a variable `IsFixed` or `IsCurrentlyFree`, getting the `Min` and `Max` values of a variable's domain, and creating decisions with `GreaterOrEqual`, `LowerOrEqual`, and `MedianValue`. The class uses proto indices, with `NumVariables` providing the valid index range. Future plans involve adding a mapping to use non-presolved model indices.\n"],null,["# CpModelView\n\nC++ Reference: class CpModelView\n================================\n\n\nNote: This documentation is automatically generated.\nThis class allows to query information about the current bounds of the loaded cp_model.proto variables during the search. It is a \"view\" of the current solver state using the indices of the proto. \n\nTODO(user): For now it uses proto indices of the loaded model. We will need to add a mapping to use proto indices of the non-presolved model to allow for a client custom search with presolve. The main API shouldn't change though and the change will be transparent.\n\n| Method ||\n|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`CpModelView`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L43) | Return type: `explicit ` Arguments: `Model* model` \u003cbr /\u003e |\n| [`GreaterOrEqual`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L64) | Return type: `BooleanOrIntegerLiteral ` Arguments: `int var, int64_t value` Helpers to generate a decision. |\n| [`IsCurrentlyFree`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L61) | Return type: `bool ` Arguments: `int var` If under a given partial assignment, the value of a variable has no impact, this might returns true, and there is no point trying to branch on this variable. This might for example be the case for the start of an unperformed interval which will not impact the rest of the problem in any way. Note that it is still possible to branch on ignored variable, this will just not change anything. |\n| [`IsFixed`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L49) | Return type: `bool ` Arguments: `int var` Getters about the current domain of the given variable. |\n| [`LowerOrEqual`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L65) | Return type: `BooleanOrIntegerLiteral ` Arguments: `int var, int64_t value` \u003cbr /\u003e |\n| [`Max`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L51) | Return type: `int64_t ` Arguments: `int var` \u003cbr /\u003e |\n| [`MedianValue`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L66) | Return type: `BooleanOrIntegerLiteral ` Arguments: `int var` \u003cbr /\u003e |\n| [`Min`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L50) | Return type: `int64_t ` Arguments: `int var` \u003cbr /\u003e |\n| [`NumVariables`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_search.h#L46) | Return type: `int ` The valid indices for the calls below are in \\[0, num_variables). |"]]