Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <cp_model.h>
Public Member Functions | |
void | SetName (absl::string_view name) |
Sets the name of the model. | |
IntVar | NewIntVar (const Domain &domain) |
Creates an integer variable with the given domain. | |
BoolVar | NewBoolVar () |
Creates a Boolean variable. | |
IntVar | NewConstant (int64_t value) |
BoolVar | TrueVar () |
BoolVar | FalseVar () |
IntervalVar | NewIntervalVar (const LinearExpr &start, const LinearExpr &size, const LinearExpr &end) |
Creates an interval variable from 3 affine expressions. | |
IntervalVar | NewFixedSizeIntervalVar (const LinearExpr &start, int64_t size) |
Creates an interval variable with a fixed size. | |
IntervalVar | NewOptionalIntervalVar (const LinearExpr &start, const LinearExpr &size, const LinearExpr &end, BoolVar presence) |
IntervalVar | NewOptionalFixedSizeIntervalVar (const LinearExpr &start, int64_t size, BoolVar presence) |
Creates an optional interval variable with a fixed size. | |
void | FixVariable (IntVar var, int64_t value) |
void | FixVariable (BoolVar var, bool value) |
Constraint | AddBoolOr (absl::Span< const BoolVar > literals) |
Adds the constraint that at least one of the literals must be true. | |
Constraint | AddAtLeastOne (absl::Span< const BoolVar > literals) |
Same as AddBoolOr(). Sum literals >= 1. | |
Constraint | AddAtMostOne (absl::Span< const BoolVar > literals) |
At most one literal is true. Sum literals <= 1. | |
Constraint | AddExactlyOne (absl::Span< const BoolVar > literals) |
Exactly one literal is true. Sum literals == 1. | |
Constraint | AddBoolAnd (absl::Span< const BoolVar > literals) |
Adds the constraint that all literals must be true. | |
Constraint | AddBoolXor (absl::Span< const BoolVar > literals) |
Adds the constraint that an odd number of literals is true. | |
Constraint | AddImplication (BoolVar a, BoolVar b) |
Adds a => b. | |
Constraint | AddImplication (absl::Span< const BoolVar > lhs, absl::Span< const BoolVar > rhs) |
Adds implication: if all lhs vars are true then all rhs vars must be true. | |
Constraint | AddEquality (const LinearExpr &left, const LinearExpr &right) |
Adds left == right. | |
Constraint | AddGreaterOrEqual (const LinearExpr &left, const LinearExpr &right) |
Adds left >= right. | |
Constraint | AddGreaterThan (const LinearExpr &left, const LinearExpr &right) |
Adds left > right. | |
Constraint | AddLessOrEqual (const LinearExpr &left, const LinearExpr &right) |
Adds left <= right. | |
Constraint | AddLessThan (const LinearExpr &left, const LinearExpr &right) |
Adds left < right. | |
Constraint | AddLinearConstraint (const LinearExpr &expr, const Domain &domain) |
Adds expr in domain. | |
Constraint | AddNotEqual (const LinearExpr &left, const LinearExpr &right) |
Adds left != right. | |
Constraint | AddAllDifferent (absl::Span< const IntVar > vars) |
This constraint forces all variables to have different values. | |
Constraint | AddAllDifferent (absl::Span< const LinearExpr > exprs) |
This constraint forces all expressions to have different values. | |
Constraint | AddAllDifferent (std::initializer_list< LinearExpr > exprs) |
This constraint forces all expressions to have different values. | |
Constraint | AddVariableElement (IntVar index, absl::Span< const IntVar > variables, IntVar target) |
Adds the element constraint: variables[index] == target. | |
Constraint | AddElement (IntVar index, absl::Span< const int64_t > values, IntVar target) |
Adds the element constraint: values[index] == target. | |
CircuitConstraint | AddCircuitConstraint () |
MultipleCircuitConstraint | AddMultipleCircuitConstraint () |
TableConstraint | AddAllowedAssignments (absl::Span< const IntVar > vars) |
TableConstraint | AddForbiddenAssignments (absl::Span< const IntVar > vars) |
Constraint | AddInverseConstraint (absl::Span< const IntVar > variables, absl::Span< const IntVar > inverse_variables) |
ReservoirConstraint | AddReservoirConstraint (int64_t min_level, int64_t max_level) |
AutomatonConstraint | AddAutomaton (absl::Span< const IntVar > transition_variables, int starting_state, absl::Span< const int > final_states) |
Constraint | AddMinEquality (const LinearExpr &target, absl::Span< const IntVar > vars) |
Adds target == min(vars). | |
Constraint | AddMinEquality (const LinearExpr &target, absl::Span< const LinearExpr > exprs) |
Adds target == min(exprs). | |
Constraint | AddMinEquality (const LinearExpr &target, std::initializer_list< LinearExpr > exprs) |
Adds target == min(exprs). | |
Constraint | AddMaxEquality (const LinearExpr &target, absl::Span< const IntVar > vars) |
Adds target == max(vars). | |
Constraint | AddMaxEquality (const LinearExpr &target, absl::Span< const LinearExpr > exprs) |
Adds target == max(exprs). | |
Constraint | AddMaxEquality (const LinearExpr &target, std::initializer_list< LinearExpr > exprs) |
Adds target == max(exprs). | |
Constraint | AddDivisionEquality (const LinearExpr &target, const LinearExpr &numerator, const LinearExpr &denominator) |
Adds target = num / denom (integer division rounded towards 0). | |
Constraint | AddAbsEquality (const LinearExpr &target, const LinearExpr &expr) |
Adds target == abs(expr). | |
Constraint | AddModuloEquality (const LinearExpr &target, const LinearExpr &var, const LinearExpr &mod) |
Adds target = var % mod. | |
Constraint | AddMultiplicationEquality (const LinearExpr &target, absl::Span< const LinearExpr > exprs) |
Adds target == prod(exprs). | |
Constraint | AddMultiplicationEquality (const LinearExpr &target, absl::Span< const IntVar > vars) |
Adds target == prod(vars). | |
Constraint | AddMultiplicationEquality (const LinearExpr &target, std::initializer_list< LinearExpr > exprs) |
Adds target == prod(vars). | |
Constraint | AddMultiplicationEquality (const LinearExpr &target, const LinearExpr &left, const LinearExpr &right) |
Adds target == left * right. | |
Constraint | AddNoOverlap (absl::Span< const IntervalVar > vars) |
NoOverlap2DConstraint | AddNoOverlap2D () |
CumulativeConstraint | AddCumulative (LinearExpr capacity) |
void | Minimize (const LinearExpr &expr) |
Adds a linear minimization objective. | |
void | Minimize (const DoubleLinearExpr &expr) |
void | Maximize (const LinearExpr &expr) |
Adds a linear maximization objective. | |
void | Maximize (const DoubleLinearExpr &expr) |
void | ClearObjective () |
Removes the objective from the model. | |
bool | HasObjective () const |
Checks whether the model contains an objective. | |
void | AddDecisionStrategy (absl::Span< const IntVar > variables, DecisionStrategyProto::VariableSelectionStrategy var_strategy, DecisionStrategyProto::DomainReductionStrategy domain_strategy) |
Adds a decision strategy on a list of integer variables. | |
void | AddDecisionStrategy (absl::Span< const BoolVar > variables, DecisionStrategyProto::VariableSelectionStrategy var_strategy, DecisionStrategyProto::DomainReductionStrategy domain_strategy) |
Adds a decision strategy on a list of integer variables. | |
void | AddDecisionStrategy (absl::Span< const LinearExpr > expressions, DecisionStrategyProto::VariableSelectionStrategy var_strategy, DecisionStrategyProto::DomainReductionStrategy domain_strategy) |
Adds a decision strategy on a list of affine expressions. | |
void | AddDecisionStrategy (std::initializer_list< LinearExpr > expressions, DecisionStrategyProto::VariableSelectionStrategy var_strategy, DecisionStrategyProto::DomainReductionStrategy domain_strategy) |
Adds a decision strategy on a list of affine expressions. | |
void | AddHint (IntVar var, int64_t value) |
Adds hinting to a variable. | |
void | AddHint (BoolVar var, bool value) |
Adds hinting to a Boolean variable. | |
void | ClearHints () |
Removes all hints. | |
void | AddAssumption (BoolVar lit) |
Adds a literal to the model as assumptions. | |
void | AddAssumptions (absl::Span< const BoolVar > literals) |
Adds multiple literals to the model as assumptions. | |
void | ClearAssumptions () |
Remove all assumptions from the model. | |
const CpModelProto & | Build () const |
const CpModelProto & | Proto () const |
CpModelProto * | MutableProto () |
bool | ExportToFile (absl::string_view filename) const |
Export the model to file. | |
CpModelBuilder | Clone () const |
Returns a cloned version of the current model. | |
BoolVar | GetBoolVarFromProtoIndex (int index) |
Returns the Boolean variable from its index in the proto. | |
IntVar | GetIntVarFromProtoIndex (int index) |
Returns the integer variable from its index in the proto. | |
IntervalVar | GetIntervalVarFromProtoIndex (int index) |
Returns the interval variable from its index in the proto. | |
Friends | |
class | CumulativeConstraint |
class | ReservoirConstraint |
class | IntervalVar |
class | IntVar |
Wrapper class around the cp_model proto.
This class provides two types of methods:
Definition at line 735 of file cp_model.h.
Constraint operations_research::sat::CpModelBuilder::AddAbsEquality | ( | const LinearExpr & | target, |
const LinearExpr & | expr ) |
Adds target == abs(expr).
Definition at line 1106 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddAllDifferent | ( | absl::Span< const IntVar > | vars | ) |
This constraint forces all variables to have different values.
Definition at line 904 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddAllDifferent | ( | absl::Span< const LinearExpr > | exprs | ) |
This constraint forces all expressions to have different values.
Definition at line 914 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddAllDifferent | ( | std::initializer_list< LinearExpr > | exprs | ) |
This constraint forces all expressions to have different values.
Definition at line 922 of file cp_model.cc.
TableConstraint operations_research::sat::CpModelBuilder::AddAllowedAssignments | ( | absl::Span< const IntVar > | vars | ) |
Adds an allowed assignments constraint.
An AllowedAssignments constraint is a constraint on an array of variables that forces, when all variables are fixed to a single value, that the corresponding list of values is equal to one of the tuples added to the constraint.
It returns a table constraint that allows adding tuples incrementally after construction.
Definition at line 962 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddAssumption | ( | BoolVar | lit | ) |
Adds a literal to the model as assumptions.
Definition at line 1322 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddAssumptions | ( | absl::Span< const BoolVar > | literals | ) |
Adds multiple literals to the model as assumptions.
Definition at line 1326 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddAtLeastOne | ( | absl::Span< const BoolVar > | literals | ) |
Same as AddBoolOr(). Sum literals >= 1.
Definition at line 772 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddAtMostOne | ( | absl::Span< const BoolVar > | literals | ) |
At most one literal is true. Sum literals <= 1.
Definition at line 776 of file cp_model.cc.
AutomatonConstraint operations_research::sat::CpModelBuilder::AddAutomaton | ( | absl::Span< const IntVar > | transition_variables, |
int | starting_state, | ||
absl::Span< const int > | final_states ) |
An automaton constraint.
An automaton constraint takes a list of variables (of size n), an initial state, a set of final states, and a set of transitions. A transition is a triplet ('tail', 'head', 'label'), where 'tail' and 'head' are states, and 'label' is the label of an arc from 'head' to 'tail', corresponding to the value of one variable in the list of variables.
This automaton will be unrolled into a flow with n + 1 phases. Each phase contains the possible states of the automaton. The first state contains the initial state. The last phase contains the final states.
Between two consecutive phases i and i + 1, the automaton creates a set of arcs. For each transition (tail, head, label), it will add an arc from the state 'tail' of phase i and the state 'head' of phase i + 1. This arc labeled by the value 'label' of the variables 'variables[i]'. That is, this arc can only be selected if 'variables[i]' is assigned the value 'label'. A feasible solution of this constraint is an assignment of variables such that, starting from the initial state in phase 0, there is a path labeled by the values of the variables that ends in one of the final states in the final phase.
It returns an AutomatonConstraint that allows adding transition incrementally after construction.
Definition at line 1002 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddBoolAnd | ( | absl::Span< const BoolVar > | literals | ) |
Adds the constraint that all literals must be true.
Definition at line 792 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddBoolOr | ( | absl::Span< const BoolVar > | literals | ) |
Adds the constraint that at least one of the literals must be true.
Definition at line 764 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddBoolXor | ( | absl::Span< const BoolVar > | literals | ) |
Adds the constraint that an odd number of literals is true.
Definition at line 800 of file cp_model.cc.
CircuitConstraint operations_research::sat::CpModelBuilder::AddCircuitConstraint | ( | ) |
Adds a circuit constraint.
The circuit constraint is defined on a graph where the arc presence is controlled by literals. That is the arc is part of the circuit of its corresponding literal is assigned to true.
For now, we ignore node indices with no incident arc. All the other nodes must have exactly one incoming and one outgoing selected arc (i.e. literal at true). All the selected arcs that are not self-loops must form a single circuit.
It returns a circuit constraint that allows adding arcs incrementally after construction.
Definition at line 954 of file cp_model.cc.
CumulativeConstraint operations_research::sat::CpModelBuilder::AddCumulative | ( | LinearExpr | capacity | ) |
The cumulative constraint
It ensures that for any integer point, the sum of the demands of the intervals containing that point does not exceed the capacity.
Definition at line 1178 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddDecisionStrategy | ( | absl::Span< const BoolVar > | variables, |
DecisionStrategyProto::VariableSelectionStrategy | var_strategy, | ||
DecisionStrategyProto::DomainReductionStrategy | domain_strategy ) |
Adds a decision strategy on a list of integer variables.
Definition at line 1259 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddDecisionStrategy | ( | absl::Span< const IntVar > | variables, |
DecisionStrategyProto::VariableSelectionStrategy | var_strategy, | ||
DecisionStrategyProto::DomainReductionStrategy | domain_strategy ) |
Adds a decision strategy on a list of integer variables.
Definition at line 1239 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddDecisionStrategy | ( | absl::Span< const LinearExpr > | expressions, |
DecisionStrategyProto::VariableSelectionStrategy | var_strategy, | ||
DecisionStrategyProto::DomainReductionStrategy | domain_strategy ) |
Adds a decision strategy on a list of affine expressions.
Definition at line 1279 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddDecisionStrategy | ( | std::initializer_list< LinearExpr > | expressions, |
DecisionStrategyProto::VariableSelectionStrategy | var_strategy, | ||
DecisionStrategyProto::DomainReductionStrategy | domain_strategy ) |
Adds a decision strategy on a list of affine expressions.
Definition at line 1291 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddDivisionEquality | ( | const LinearExpr & | target, |
const LinearExpr & | numerator, | ||
const LinearExpr & | denominator ) |
Adds target = num / denom (integer division rounded towards 0).
Definition at line 1096 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddElement | ( | IntVar | index, |
absl::Span< const int64_t > | values, | ||
IntVar | target ) |
Adds the element constraint: values[index] == target.
Definition at line 942 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddEquality | ( | const LinearExpr & | left, |
const LinearExpr & | right ) |
Adds left == right.
Definition at line 825 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddExactlyOne | ( | absl::Span< const BoolVar > | literals | ) |
Exactly one literal is true. Sum literals == 1.
Definition at line 784 of file cp_model.cc.
TableConstraint operations_research::sat::CpModelBuilder::AddForbiddenAssignments | ( | absl::Span< const IntVar > | vars | ) |
Adds an forbidden assignments constraint.
A ForbiddenAssignments constraint is a constraint on an array of variables where the list of impossible combinations is provided in the tuples added to the constraint.
It returns a table constraint that allows adding tuples incrementally after construction.
Definition at line 971 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddGreaterOrEqual | ( | const LinearExpr & | left, |
const LinearExpr & | right ) |
Adds left >= right.
Definition at line 835 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddGreaterThan | ( | const LinearExpr & | left, |
const LinearExpr & | right ) |
Adds left > right.
Definition at line 855 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddHint | ( | BoolVar | var, |
bool | value ) |
Adds hinting to a Boolean variable.
Definition at line 1308 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::AddHint | ( | IntVar | var, |
int64_t | value ) |
Adds hinting to a variable.
Definition at line 1303 of file cp_model.cc.
|
inline |
Adds implication: if all lhs vars are true then all rhs vars must be true.
Definition at line 815 of file cp_model.h.
|
inline |
Adds a => b.
Definition at line 810 of file cp_model.h.
Constraint operations_research::sat::CpModelBuilder::AddInverseConstraint | ( | absl::Span< const IntVar > | variables, |
absl::Span< const IntVar > | inverse_variables ) |
An inverse constraint.
It enforces that if 'variables[i]' is assigned a value 'j', then inverse_variables[j] is assigned a value 'i'. And vice versa.
Definition at line 981 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddLessOrEqual | ( | const LinearExpr & | left, |
const LinearExpr & | right ) |
Adds left <= right.
Definition at line 845 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddLessThan | ( | const LinearExpr & | left, |
const LinearExpr & | right ) |
Adds left < right.
Definition at line 865 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddLinearConstraint | ( | const LinearExpr & | expr, |
const Domain & | domain ) |
Adds expr in domain.
Definition at line 875 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMaxEquality | ( | const LinearExpr & | target, |
absl::Span< const IntVar > | vars ) |
Adds target == max(vars).
Definition at line 1066 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMaxEquality | ( | const LinearExpr & | target, |
absl::Span< const LinearExpr > | exprs ) |
Adds target == max(exprs).
Definition at line 1076 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMaxEquality | ( | const LinearExpr & | target, |
std::initializer_list< LinearExpr > | exprs ) |
Adds target == max(exprs).
Definition at line 1086 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMinEquality | ( | const LinearExpr & | target, |
absl::Span< const IntVar > | vars ) |
Adds target == min(vars).
Definition at line 1030 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMinEquality | ( | const LinearExpr & | target, |
absl::Span< const LinearExpr > | exprs ) |
Adds target == min(exprs).
Definition at line 1042 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMinEquality | ( | const LinearExpr & | target, |
std::initializer_list< LinearExpr > | exprs ) |
Adds target == min(exprs).
Definition at line 1054 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddModuloEquality | ( | const LinearExpr & | target, |
const LinearExpr & | var, | ||
const LinearExpr & | mod ) |
Adds target = var % mod.
Definition at line 1116 of file cp_model.cc.
MultipleCircuitConstraint operations_research::sat::CpModelBuilder::AddMultipleCircuitConstraint | ( | ) |
Adds a multiple circuit constraint, aka the "VRP" (Vehicle Routing Problem) constraint.
The direct graph where arc i (from tails[i] to head[i]) is present iff literals[i] is true must satisfy this set of properties:
Definition at line 958 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMultiplicationEquality | ( | const LinearExpr & | target, |
absl::Span< const IntVar > | vars ) |
Adds target == prod(vars).
Definition at line 1126 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMultiplicationEquality | ( | const LinearExpr & | target, |
absl::Span< const LinearExpr > | exprs ) |
Adds target == prod(exprs).
Definition at line 1136 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMultiplicationEquality | ( | const LinearExpr & | target, |
const LinearExpr & | left, | ||
const LinearExpr & | right ) |
Adds target == left * right.
Definition at line 1155 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddMultiplicationEquality | ( | const LinearExpr & | target, |
std::initializer_list< LinearExpr > | exprs ) |
Adds target == prod(vars).
Definition at line 1146 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddNoOverlap | ( | absl::Span< const IntervalVar > | vars | ) |
Adds a no-overlap constraint that ensures that all present intervals do not overlap in time.
Definition at line 1166 of file cp_model.cc.
NoOverlap2DConstraint operations_research::sat::CpModelBuilder::AddNoOverlap2D | ( | ) |
The no_overlap_2d constraint prevents a set of boxes from overlapping.
Definition at line 1174 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddNotEqual | ( | const LinearExpr & | left, |
const LinearExpr & | right ) |
Adds left != right.
Definition at line 892 of file cp_model.cc.
ReservoirConstraint operations_research::sat::CpModelBuilder::AddReservoirConstraint | ( | int64_t | min_level, |
int64_t | max_level ) |
Adds a reservoir constraint with optional refill/emptying events.
Maintain a reservoir level within bounds. The water level starts at 0, and at any time, it must be within [min_level, max_level].
Given an event (time, level_change, active), if active is true, and if time is assigned a value t, then the level of the reservoir changes by level_change (which is constant) at time t. Therefore, at any time t:
sum(level_changes[i] * actives[i] if times[i] <= t) in [min_level, max_level]
Note that min level must be <= 0, and the max level must be >= 0. Please use fixed level_changes to simulate an initial state.
It returns a ReservoirConstraint that allows adding optional and non optional events incrementally after construction.
Definition at line 994 of file cp_model.cc.
Constraint operations_research::sat::CpModelBuilder::AddVariableElement | ( | IntVar | index, |
absl::Span< const IntVar > | variables, | ||
IntVar | target ) |
Adds the element constraint: variables[index] == target.
Definition at line 931 of file cp_model.cc.
|
inline |
Definition at line 1111 of file cp_model.h.
void operations_research::sat::CpModelBuilder::ClearAssumptions | ( | ) |
Remove all assumptions from the model.
Definition at line 1332 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::ClearHints | ( | ) |
Removes all hints.
Definition at line 1318 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::ClearObjective | ( | ) |
Removes the objective from the model.
Definition at line 1230 of file cp_model.cc.
CpModelBuilder operations_research::sat::CpModelBuilder::Clone | ( | ) | const |
Returns a cloned version of the current model.
Definition at line 1336 of file cp_model.cc.
bool operations_research::sat::CpModelBuilder::ExportToFile | ( | absl::string_view | filename | ) | const |
Export the model to file.
Definition at line 1388 of file cp_model.cc.
BoolVar operations_research::sat::CpModelBuilder::FalseVar | ( | ) |
Creates an always false Boolean variable. If this is called multiple times, the same variable will always be returned.
Definition at line 708 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::FixVariable | ( | BoolVar | var, |
bool | value ) |
Definition at line 754 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::FixVariable | ( | IntVar | var, |
int64_t | value ) |
It is sometime convenient when building a model to create a bunch of variables that will later be fixed. Instead of doing AddEquality(var, value) which add a constraint, these functions modify directly the underlying variable domain.
Definition at line 750 of file cp_model.cc.
BoolVar operations_research::sat::CpModelBuilder::GetBoolVarFromProtoIndex | ( | int | index | ) |
Returns the Boolean variable from its index in the proto.
Definition at line 1356 of file cp_model.cc.
IntervalVar operations_research::sat::CpModelBuilder::GetIntervalVarFromProtoIndex | ( | int | index | ) |
Returns the interval variable from its index in the proto.
Definition at line 1378 of file cp_model.cc.
IntVar operations_research::sat::CpModelBuilder::GetIntVarFromProtoIndex | ( | int | index | ) |
Returns the integer variable from its index in the proto.
Definition at line 1372 of file cp_model.cc.
bool operations_research::sat::CpModelBuilder::HasObjective | ( | ) | const |
Checks whether the model contains an objective.
Definition at line 1235 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::Maximize | ( | const DoubleLinearExpr & | expr | ) |
Adds a linear floating point maximization objective.
Definition at line 1219 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::Maximize | ( | const LinearExpr & | expr | ) |
Adds a linear maximization objective.
Definition at line 1196 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::Minimize | ( | const DoubleLinearExpr & | expr | ) |
Adds a linear floating point minimization objective.
Definition at line 1208 of file cp_model.cc.
void operations_research::sat::CpModelBuilder::Minimize | ( | const LinearExpr & | expr | ) |
Adds a linear minimization objective.
Definition at line 1185 of file cp_model.cc.
|
inline |
Definition at line 1113 of file cp_model.h.
BoolVar operations_research::sat::CpModelBuilder::NewBoolVar | ( | ) |
Creates a Boolean variable.
Definition at line 692 of file cp_model.cc.
IntVar operations_research::sat::CpModelBuilder::NewConstant | ( | int64_t | value | ) |
Creates a constant variable. This is a shortcut for NewVariable(Domain(value)).but it will return the same variable if used twice with the same constant.
Definition at line 700 of file cp_model.cc.
IntervalVar operations_research::sat::CpModelBuilder::NewFixedSizeIntervalVar | ( | const LinearExpr & | start, |
int64_t | size ) |
Creates an interval variable with a fixed size.
Definition at line 718 of file cp_model.cc.
IntervalVar operations_research::sat::CpModelBuilder::NewIntervalVar | ( | const LinearExpr & | start, |
const LinearExpr & | size, | ||
const LinearExpr & | end ) |
Creates an interval variable from 3 affine expressions.
Definition at line 712 of file cp_model.cc.
Creates an integer variable with the given domain.
Definition at line 682 of file cp_model.cc.
IntervalVar operations_research::sat::CpModelBuilder::NewOptionalFixedSizeIntervalVar | ( | const LinearExpr & | start, |
int64_t | size, | ||
BoolVar | presence ) |
Creates an optional interval variable with a fixed size.
Definition at line 737 of file cp_model.cc.
IntervalVar operations_research::sat::CpModelBuilder::NewOptionalIntervalVar | ( | const LinearExpr & | start, |
const LinearExpr & | size, | ||
const LinearExpr & | end, | ||
BoolVar | presence ) |
Creates an optional interval variable from 3 affine expressions and a Boolean variable.
Definition at line 723 of file cp_model.cc.
|
inline |
Definition at line 1112 of file cp_model.h.
void operations_research::sat::CpModelBuilder::SetName | ( | absl::string_view | name | ) |
Sets the name of the model.
Definition at line 646 of file cp_model.cc.
BoolVar operations_research::sat::CpModelBuilder::TrueVar | ( | ) |
Creates an always true Boolean variable. If this is called multiple times, the same variable will always be returned.
Definition at line 704 of file cp_model.cc.
|
friend |
Definition at line 1131 of file cp_model.h.
|
friend |
Definition at line 1133 of file cp_model.h.
|
friend |
Definition at line 1134 of file cp_model.h.
|
friend |
Definition at line 1132 of file cp_model.h.