C++ Reference: class CpModelMapping
This documentation is automatically generated.
Holds the mapping between CpModel proto indices and the sat::model ones.This also holds some information used when loading a CpModel proto.
Method | |
---|---|
ConstraintIsAlreadyLoaded | Return type: Arguments: Depending on the option, we will load constraints in stages. This is used to detect constraints that are already loaded. For instance the interval constraints and the linear constraint of size 1 (encodings) are usually loaded first. |
CreateVariables | Return type: Arguments: Extracts all the used variables in the CpModelProto and creates a sat::Model representation for them. More precisely - All Boolean variables will be mapped. - All Interval variables will be mapped. - All non-Boolean variable will have a corresponding IntegerVariable, and depending on the view_all_booleans_as_integers, some or all of the BooleanVariable will also have an IntegerVariable corresponding to its "integer view". Note(user): We could create IntegerVariable on the fly as they are needed, but that loose the original variable order which might be useful in heuristics later. |
DetectOptionalVariables | Return type: Arguments: Automatically detect optional variables. |
ExtractEncoding | Return type: Arguments: Extract the encodings (IntegerVariable <-> Booleans) present in the model. This effectively load some linear constraints of size 1 that will be marked as already loaded. |
GetProtoVariableFromBooleanVariable | Return type: Arguments: Note that both these functions returns positive reference or -1. |
GetProtoVariableFromIntegerVariable | Return type: Arguments: |
GetVariableMapping | Return type: |
Integer | Return type: Arguments: |
Integers | Return type: Arguments: |
Interval | Return type: Arguments: |
Intervals | Return type: Arguments: |
IsBoolean | Return type: Arguments: Returns true if the given CpModelProto variable reference refers to a Boolean variable. Such variable will always have an associated Literal(), but not always an associated Integer(). |
IsHalfEncodingConstraint | Return type: Arguments: Returns true if the given constraint is a "half-encoding" constraint. That is, if it is of the form (b => size 1 linear) but there is no (<=) side in the model. Such constraint are detected while we extract integer encoding and are cached here so that we can deal properly with them during the linear relaxation. |
IsInteger | Return type: Arguments: |
Literal | Return type: Arguments: |
Literals | Return type: Arguments: |
LoadAffineView | Return type: Arguments: TODO(user): We could "easily" create an intermediate variable for more complex linear expression. We could also identify duplicate expressions to not create two identical integer variable. |
LoadBooleanSymmetries | Return type: Arguments: Experimental. Loads the symmetry form the proto symmetry field, as long as they only involve Booleans. TODO(user): We currently only have the code for Booleans, it is why we currently ignore symmetries involving integer variables. |
NumBooleanVariables | Return type: |
NumIntegerVariables | Return type: For logging only, these are not super efficient. |
NumProtoVariables | Return type: Returns the number of variables in the loaded proto. |
PotentialEncodedValues | Return type: Arguments: Returns a heuristic set of values that could be created for the given variable when the constraints will be loaded. Note that the pointer is not stable across calls. It returns nullptr if the set is empty. |
PropagateEncodingFromEquivalenceRelations | Return type: Arguments: Process all affine relations of the form a*X + b*Y == cte. For each literals associated to (X >= bound) or (X == value) associate it to its corresponding relation on Y. Also do the other side. TODO(user): In an ideal world, all affine relations like this should be removed in the presolve. |