![]() |
OR-Tools
9.6
|
Wrapper class around the cp_model proto.
This class provides two types of methods:
Definition at line 730 of file cp_model.h.
Public Member Functions | |
| void | SetName (const std::string &name) |
| Sets the name of the model. More... | |
| IntVar | NewIntVar (const Domain &domain) |
| Creates an integer variable with the given domain. More... | |
| BoolVar | NewBoolVar () |
| Creates a Boolean variable. More... | |
| IntVar | NewConstant (int64_t value) |
| Creates a constant variable. More... | |
| BoolVar | TrueVar () |
| Creates an always true Boolean variable. More... | |
| BoolVar | FalseVar () |
| Creates an always false Boolean variable. More... | |
| IntervalVar | NewIntervalVar (const LinearExpr &start, const LinearExpr &size, const LinearExpr &end) |
| Creates an interval variable from 3 affine expressions. More... | |
| IntervalVar | NewFixedSizeIntervalVar (const LinearExpr &start, int64_t size) |
| Creates an interval variable with a fixed size. More... | |
| IntervalVar | 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. More... | |
| IntervalVar | NewOptionalFixedSizeIntervalVar (const LinearExpr &start, int64_t size, BoolVar presence) |
| Creates an optional interval variable with a fixed size. More... | |
| void | 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. More... | |
| 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. More... | |
| Constraint | AddAtLeastOne (absl::Span< const BoolVar > literals) |
| Same as AddBoolOr(). Sum literals >= 1. More... | |
| Constraint | AddAtMostOne (absl::Span< const BoolVar > literals) |
| At most one literal is true. Sum literals <= 1. More... | |
| Constraint | AddExactlyOne (absl::Span< const BoolVar > literals) |
| Exactly one literal is true. Sum literals == 1. More... | |
| Constraint | AddBoolAnd (absl::Span< const BoolVar > literals) |
| Adds the constraint that all literals must be true. More... | |
| Constraint | AddBoolXor (absl::Span< const BoolVar > literals) |
| Adds the constraint that an odd number of literals is true. More... | |
| Constraint | AddImplication (BoolVar a, BoolVar b) |
| Adds a => b. More... | |
| 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. More... | |
| Constraint | AddEquality (const LinearExpr &left, const LinearExpr &right) |
| Adds left == right. More... | |
| Constraint | AddGreaterOrEqual (const LinearExpr &left, const LinearExpr &right) |
| Adds left >= right. More... | |
| Constraint | AddGreaterThan (const LinearExpr &left, const LinearExpr &right) |
| Adds left > right. More... | |
| Constraint | AddLessOrEqual (const LinearExpr &left, const LinearExpr &right) |
| Adds left <= right. More... | |
| Constraint | AddLessThan (const LinearExpr &left, const LinearExpr &right) |
| Adds left < right. More... | |
| Constraint | AddLinearConstraint (const LinearExpr &expr, const Domain &domain) |
| Adds expr in domain. More... | |
| Constraint | AddNotEqual (const LinearExpr &left, const LinearExpr &right) |
| Adds left != right. More... | |
| Constraint | AddAllDifferent (absl::Span< const IntVar > vars) |
| This constraint forces all variables to have different values. More... | |
| Constraint | AddAllDifferent (absl::Span< const LinearExpr > exprs) |
| This constraint forces all expressions to have different values. More... | |
| Constraint | AddAllDifferent (std::initializer_list< LinearExpr > exprs) |
| This constraint forces all expressions to have different values. More... | |
| Constraint | AddVariableElement (IntVar index, absl::Span< const IntVar > variables, IntVar target) |
| Adds the element constraint: variables[index] == target. More... | |
| Constraint | AddElement (IntVar index, absl::Span< const int64_t > values, IntVar target) |
| Adds the element constraint: values[index] == target. More... | |
| CircuitConstraint | AddCircuitConstraint () |
| Adds a circuit constraint. More... | |
| MultipleCircuitConstraint | AddMultipleCircuitConstraint () |
| Adds a multiple circuit constraint, aka the "VRP" (Vehicle Routing Problem) constraint. More... | |
| TableConstraint | AddAllowedAssignments (absl::Span< const IntVar > vars) |
| Adds an allowed assignments constraint. More... | |
| TableConstraint | AddForbiddenAssignments (absl::Span< const IntVar > vars) |
| Adds an forbidden assignments constraint. More... | |
| Constraint | AddInverseConstraint (absl::Span< const IntVar > variables, absl::Span< const IntVar > inverse_variables) |
| An inverse constraint. More... | |
| ReservoirConstraint | AddReservoirConstraint (int64_t min_level, int64_t max_level) |
| Adds a reservoir constraint with optional refill/emptying events. More... | |
| AutomatonConstraint | AddAutomaton (absl::Span< const IntVar > transition_variables, int starting_state, absl::Span< const int > final_states) |
| An automaton constraint. More... | |
| Constraint | AddMinEquality (const LinearExpr &target, absl::Span< const IntVar > vars) |
| Adds target == min(vars). More... | |
| Constraint | AddMinEquality (const LinearExpr &target, absl::Span< const LinearExpr > exprs) |
| Adds target == min(exprs). More... | |
| Constraint | AddMinEquality (const LinearExpr &target, std::initializer_list< LinearExpr > exprs) |
| Adds target == min(exprs). More... | |
| Constraint | AddMaxEquality (const LinearExpr &target, absl::Span< const IntVar > vars) |
| Adds target == max(vars). More... | |
| Constraint | AddMaxEquality (const LinearExpr &target, absl::Span< const LinearExpr > exprs) |
| Adds target == max(exprs). More... | |
| Constraint | AddMaxEquality (const LinearExpr &target, std::initializer_list< LinearExpr > exprs) |
| Adds target == max(exprs). More... | |
| Constraint | AddDivisionEquality (const LinearExpr &target, const LinearExpr &numerator, const LinearExpr &denominator) |
| Adds target = num / denom (integer division rounded towards 0). More... | |
| Constraint | AddAbsEquality (const LinearExpr &target, const LinearExpr &expr) |
| Adds target == abs(expr). More... | |
| Constraint | AddModuloEquality (const LinearExpr &target, const LinearExpr &var, const LinearExpr &mod) |
| Adds target = var % mod. More... | |
| Constraint | AddMultiplicationEquality (const LinearExpr &target, absl::Span< const LinearExpr > exprs) |
| Adds target == prod(exprs). More... | |
| Constraint | AddMultiplicationEquality (const LinearExpr &target, absl::Span< const IntVar > vars) |
| Adds target == prod(vars). More... | |
| Constraint | AddMultiplicationEquality (const LinearExpr &target, std::initializer_list< LinearExpr > exprs) |
| Adds target == prod(vars). More... | |
| Constraint | AddMultiplicationEquality (const LinearExpr &target, const LinearExpr &left, const LinearExpr &right) |
| Adds target == left * right. More... | |
| Constraint | AddNoOverlap (absl::Span< const IntervalVar > vars) |
| Adds a no-overlap constraint that ensures that all present intervals do not overlap in time. More... | |
| NoOverlap2DConstraint | AddNoOverlap2D () |
| The no_overlap_2d constraint prevents a set of boxes from overlapping. More... | |
| CumulativeConstraint | AddCumulative (LinearExpr capacity) |
| The cumulative constraint. More... | |
| void | Minimize (const LinearExpr &expr) |
| Adds a linear minimization objective. More... | |
| void | Minimize (const DoubleLinearExpr &expr) |
| Adds a linear floating point minimization objective. More... | |
| void | Maximize (const LinearExpr &expr) |
| Adds a linear maximization objective. More... | |
| void | Maximize (const DoubleLinearExpr &expr) |
| Adds a linear floating point maximization objective. More... | |
| void | ClearObjective () |
| Removes the objective from the model. More... | |
| bool | HasObjective () const |
| Checks whether the model contains an objective. More... | |
| 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. More... | |
| void | AddDecisionStrategy (absl::Span< const BoolVar > variables, DecisionStrategyProto::VariableSelectionStrategy var_strategy, DecisionStrategyProto::DomainReductionStrategy domain_strategy) |
| Adds a decision strategy on a list of boolean variables. More... | |
| void | AddHint (IntVar var, int64_t value) |
| Adds hinting to a variable. More... | |
| void | AddHint (BoolVar var, bool value) |
| Adds hinting to a Boolean variable. More... | |
| void | ClearHints () |
| Removes all hints. More... | |
| void | AddAssumption (BoolVar lit) |
| Adds a literal to the model as assumptions. More... | |
| void | AddAssumptions (absl::Span< const BoolVar > literals) |
| Adds multiple literals to the model as assumptions. More... | |
| void | ClearAssumptions () |
| Remove all assumptions from the model. More... | |
| const CpModelProto & | Build () const |
| const CpModelProto & | Proto () const |
| CpModelProto * | MutableProto () |
| bool | ExportToFile (const std::string &filename) const |
| Export the model to file. More... | |
| void | CopyFrom (const CpModelProto &model_proto) |
| Replaces the current model with the one from the given proto. More... | |
| BoolVar | GetBoolVarFromProtoIndex (int index) |
| Returns the Boolean variable from its index in the proto. More... | |
| IntVar | GetIntVarFromProtoIndex (int index) |
| Returns the integer variable from its index in the proto. More... | |
| IntervalVar | GetIntervalVarFromProtoIndex (int index) |
| Returns the interval variable from its index in the proto. More... | |
| Constraint AddAbsEquality | ( | const LinearExpr & | target, |
| const LinearExpr & | expr | ||
| ) |
Adds target == abs(expr).
Definition at line 1107 of file cp_model.cc.
| Constraint AddAllDifferent | ( | absl::Span< const IntVar > | vars | ) |
This constraint forces all variables to have different values.
Definition at line 905 of file cp_model.cc.
| Constraint AddAllDifferent | ( | absl::Span< const LinearExpr > | exprs | ) |
This constraint forces all expressions to have different values.
Definition at line 915 of file cp_model.cc.
| Constraint AddAllDifferent | ( | std::initializer_list< LinearExpr > | exprs | ) |
This constraint forces all expressions to have different values.
Definition at line 923 of file cp_model.cc.
| TableConstraint 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 963 of file cp_model.cc.
| void AddAssumption | ( | BoolVar | lit | ) |
Adds a literal to the model as assumptions.
Definition at line 1283 of file cp_model.cc.
| void AddAssumptions | ( | absl::Span< const BoolVar > | literals | ) |
Adds multiple literals to the model as assumptions.
Definition at line 1287 of file cp_model.cc.
| Constraint AddAtLeastOne | ( | absl::Span< const BoolVar > | literals | ) |
Same as AddBoolOr(). Sum literals >= 1.
Definition at line 773 of file cp_model.cc.
| Constraint AddAtMostOne | ( | absl::Span< const BoolVar > | literals | ) |
At most one literal is true. Sum literals <= 1.
Definition at line 777 of file cp_model.cc.
| AutomatonConstraint 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 1003 of file cp_model.cc.
| Constraint AddBoolAnd | ( | absl::Span< const BoolVar > | literals | ) |
Adds the constraint that all literals must be true.
Definition at line 793 of file cp_model.cc.
| Constraint AddBoolOr | ( | absl::Span< const BoolVar > | literals | ) |
Adds the constraint that at least one of the literals must be true.
Definition at line 765 of file cp_model.cc.
| Constraint AddBoolXor | ( | absl::Span< const BoolVar > | literals | ) |
Adds the constraint that an odd number of literals is true.
Definition at line 801 of file cp_model.cc.
| CircuitConstraint 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 955 of file cp_model.cc.
| CumulativeConstraint 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 1179 of file cp_model.cc.
| void AddDecisionStrategy | ( | absl::Span< const BoolVar > | variables, |
| DecisionStrategyProto::VariableSelectionStrategy | var_strategy, | ||
| DecisionStrategyProto::DomainReductionStrategy | domain_strategy | ||
| ) |
Adds a decision strategy on a list of boolean variables.
Definition at line 1252 of file cp_model.cc.
| 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.
Definition at line 1240 of file cp_model.cc.
| Constraint AddDivisionEquality | ( | const LinearExpr & | target, |
| const LinearExpr & | numerator, | ||
| const LinearExpr & | denominator | ||
| ) |
Adds target = num / denom (integer division rounded towards 0).
Definition at line 1097 of file cp_model.cc.
| Constraint AddElement | ( | IntVar | index, |
| absl::Span< const int64_t > | values, | ||
| IntVar | target | ||
| ) |
Adds the element constraint: values[index] == target.
Definition at line 943 of file cp_model.cc.
| Constraint AddEquality | ( | const LinearExpr & | left, |
| const LinearExpr & | right | ||
| ) |
Adds left == right.
Definition at line 826 of file cp_model.cc.
| Constraint AddExactlyOne | ( | absl::Span< const BoolVar > | literals | ) |
Exactly one literal is true. Sum literals == 1.
Definition at line 785 of file cp_model.cc.
| TableConstraint 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 972 of file cp_model.cc.
| Constraint AddGreaterOrEqual | ( | const LinearExpr & | left, |
| const LinearExpr & | right | ||
| ) |
Adds left >= right.
Definition at line 836 of file cp_model.cc.
| Constraint AddGreaterThan | ( | const LinearExpr & | left, |
| const LinearExpr & | right | ||
| ) |
Adds left > right.
Definition at line 856 of file cp_model.cc.
| void AddHint | ( | BoolVar | var, |
| bool | value | ||
| ) |
Adds hinting to a Boolean variable.
Definition at line 1269 of file cp_model.cc.
| void AddHint | ( | IntVar | var, |
| int64_t | value | ||
| ) |
Adds hinting to a variable.
Definition at line 1264 of file cp_model.cc.
|
inline |
Adds implication: if all lhs vars are true then all rhs vars must be true.
Definition at line 809 of file cp_model.h.
|
inline |
Adds a => b.
Definition at line 804 of file cp_model.h.
| Constraint 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 982 of file cp_model.cc.
| Constraint AddLessOrEqual | ( | const LinearExpr & | left, |
| const LinearExpr & | right | ||
| ) |
Adds left <= right.
Definition at line 846 of file cp_model.cc.
| Constraint AddLessThan | ( | const LinearExpr & | left, |
| const LinearExpr & | right | ||
| ) |
Adds left < right.
Definition at line 866 of file cp_model.cc.
| Constraint AddLinearConstraint | ( | const LinearExpr & | expr, |
| const Domain & | domain | ||
| ) |
Adds expr in domain.
Definition at line 876 of file cp_model.cc.
| Constraint AddMaxEquality | ( | const LinearExpr & | target, |
| absl::Span< const IntVar > | vars | ||
| ) |
Adds target == max(vars).
Definition at line 1067 of file cp_model.cc.
| Constraint AddMaxEquality | ( | const LinearExpr & | target, |
| absl::Span< const LinearExpr > | exprs | ||
| ) |
Adds target == max(exprs).
Definition at line 1077 of file cp_model.cc.
| Constraint AddMaxEquality | ( | const LinearExpr & | target, |
| std::initializer_list< LinearExpr > | exprs | ||
| ) |
Adds target == max(exprs).
Definition at line 1087 of file cp_model.cc.
| Constraint AddMinEquality | ( | const LinearExpr & | target, |
| absl::Span< const IntVar > | vars | ||
| ) |
Adds target == min(vars).
Definition at line 1031 of file cp_model.cc.
| Constraint AddMinEquality | ( | const LinearExpr & | target, |
| absl::Span< const LinearExpr > | exprs | ||
| ) |
Adds target == min(exprs).
Definition at line 1043 of file cp_model.cc.
| Constraint AddMinEquality | ( | const LinearExpr & | target, |
| std::initializer_list< LinearExpr > | exprs | ||
| ) |
Adds target == min(exprs).
Definition at line 1055 of file cp_model.cc.
| Constraint AddModuloEquality | ( | const LinearExpr & | target, |
| const LinearExpr & | var, | ||
| const LinearExpr & | mod | ||
| ) |
Adds target = var % mod.
Definition at line 1117 of file cp_model.cc.
| MultipleCircuitConstraint 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 959 of file cp_model.cc.
| Constraint AddMultiplicationEquality | ( | const LinearExpr & | target, |
| absl::Span< const IntVar > | vars | ||
| ) |
Adds target == prod(vars).
Definition at line 1127 of file cp_model.cc.
| Constraint AddMultiplicationEquality | ( | const LinearExpr & | target, |
| absl::Span< const LinearExpr > | exprs | ||
| ) |
Adds target == prod(exprs).
Definition at line 1137 of file cp_model.cc.
| Constraint AddMultiplicationEquality | ( | const LinearExpr & | target, |
| const LinearExpr & | left, | ||
| const LinearExpr & | right | ||
| ) |
Adds target == left * right.
Definition at line 1156 of file cp_model.cc.
| Constraint AddMultiplicationEquality | ( | const LinearExpr & | target, |
| std::initializer_list< LinearExpr > | exprs | ||
| ) |
Adds target == prod(vars).
Definition at line 1147 of file cp_model.cc.
| Constraint 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 1167 of file cp_model.cc.
| NoOverlap2DConstraint AddNoOverlap2D | ( | ) |
The no_overlap_2d constraint prevents a set of boxes from overlapping.
Definition at line 1175 of file cp_model.cc.
| Constraint AddNotEqual | ( | const LinearExpr & | left, |
| const LinearExpr & | right | ||
| ) |
Adds left != right.
Definition at line 893 of file cp_model.cc.
| ReservoirConstraint 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 995 of file cp_model.cc.
| Constraint AddVariableElement | ( | IntVar | index, |
| absl::Span< const IntVar > | variables, | ||
| IntVar | target | ||
| ) |
Adds the element constraint: variables[index] == target.
Definition at line 932 of file cp_model.cc.
|
inline |
Definition at line 1093 of file cp_model.h.
| void ClearAssumptions | ( | ) |
Remove all assumptions from the model.
Definition at line 1293 of file cp_model.cc.
| void ClearHints | ( | ) |
Removes all hints.
Definition at line 1279 of file cp_model.cc.
| void ClearObjective | ( | ) |
Removes the objective from the model.
Definition at line 1231 of file cp_model.cc.
| void CopyFrom | ( | const CpModelProto & | model_proto | ) |
Replaces the current model with the one from the given proto.
Definition at line 1297 of file cp_model.cc.
| bool ExportToFile | ( | const std::string & | filename | ) | const |
Export the model to file.
Definition at line 1343 of file cp_model.cc.
| BoolVar FalseVar | ( | ) |
Creates an always false Boolean variable.
If this is called multiple times, the same variable will always be returned.
Definition at line 707 of file cp_model.cc.
| void FixVariable | ( | BoolVar | var, |
| bool | value | ||
| ) |
Definition at line 755 of file cp_model.cc.
| void 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.
Note that this ignore completely the original variable domain and just fix the given variable to the given value, even if it was outside the given variable domain. You can still use AddEquality() if this is not what you want.
Definition at line 751 of file cp_model.cc.
| BoolVar GetBoolVarFromProtoIndex | ( | int | index | ) |
Returns the Boolean variable from its index in the proto.
Definition at line 1311 of file cp_model.cc.
| IntervalVar GetIntervalVarFromProtoIndex | ( | int | index | ) |
Returns the interval variable from its index in the proto.
Definition at line 1333 of file cp_model.cc.
| IntVar GetIntVarFromProtoIndex | ( | int | index | ) |
Returns the integer variable from its index in the proto.
Definition at line 1327 of file cp_model.cc.
| bool HasObjective | ( | ) | const |
Checks whether the model contains an objective.
Definition at line 1236 of file cp_model.cc.
| void Maximize | ( | const DoubleLinearExpr & | expr | ) |
Adds a linear floating point maximization objective.
Note that the coefficients will be internally scaled to integer.
Definition at line 1220 of file cp_model.cc.
| void Maximize | ( | const LinearExpr & | expr | ) |
Adds a linear maximization objective.
Definition at line 1197 of file cp_model.cc.
| void Minimize | ( | const DoubleLinearExpr & | expr | ) |
Adds a linear floating point minimization objective.
Note that the coefficients will be internally scaled to integer.
Definition at line 1209 of file cp_model.cc.
| void Minimize | ( | const LinearExpr & | expr | ) |
Adds a linear minimization objective.
Definition at line 1186 of file cp_model.cc.
|
inline |
Definition at line 1095 of file cp_model.h.
| BoolVar NewBoolVar | ( | ) |
Creates a Boolean variable.
Definition at line 691 of file cp_model.cc.
| IntVar 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 699 of file cp_model.cc.
| IntervalVar NewFixedSizeIntervalVar | ( | const LinearExpr & | start, |
| int64_t | size | ||
| ) |
Creates an interval variable with a fixed size.
Definition at line 717 of file cp_model.cc.
| IntervalVar NewIntervalVar | ( | const LinearExpr & | start, |
| const LinearExpr & | size, | ||
| const LinearExpr & | end | ||
| ) |
Creates an interval variable from 3 affine expressions.
Definition at line 711 of file cp_model.cc.
Creates an integer variable with the given domain.
Definition at line 681 of file cp_model.cc.
| IntervalVar NewOptionalFixedSizeIntervalVar | ( | const LinearExpr & | start, |
| int64_t | size, | ||
| BoolVar | presence | ||
| ) |
Creates an optional interval variable with a fixed size.
Definition at line 738 of file cp_model.cc.
| IntervalVar 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 722 of file cp_model.cc.
|
inline |
Definition at line 1094 of file cp_model.h.
| void SetName | ( | const std::string & | name | ) |
Sets the name of the model.
Definition at line 645 of file cp_model.cc.
| BoolVar TrueVar | ( | ) |
Creates an always true Boolean variable.
If this is called multiple times, the same variable will always be returned.
Definition at line 703 of file cp_model.cc.