Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
Classes | |
class | CpModelException |
class | MismatchedArrayLengths |
class | WrongLength |
Main modeling class.
Proposes a factory to create all modeling objects understood by the SAT solver.
Definition at line 42 of file CpModel.java.
com.google.ortools.sat.CpModel.CpModel | ( | ) |
Definition at line 64 of file CpModel.java.
com.google.ortools.sat.CpModel.CpModel | ( | ) |
Definition at line 64 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAbsEquality | ( | LinearArgument | target, |
LinearArgument | expr ) |
Adds target == Abs(expr)
.
Definition at line 661 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAbsEquality | ( | LinearArgument | target, |
LinearArgument | expr ) |
Adds target == Abs(expr)
.
Definition at line 661 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAllDifferent | ( | Iterable<? extends LinearArgument > | expressions | ) |
Adds AllDifferent(expressions)
.
Definition at line 358 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAllDifferent | ( | Iterable<? extends LinearArgument > | expressions | ) |
Adds AllDifferent(expressions)
.
Definition at line 358 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAllDifferent | ( | LinearArgument[] | expressions | ) |
Integer constraints.
Adds AllDifferent(expressions)
.
This constraint forces all affine expressions to have different values.
expressions | a list of affine integer expressions |
Definition at line 349 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAllDifferent | ( | LinearArgument[] | expressions | ) |
Integer constraints.
Adds AllDifferent(expressions)
.
This constraint forces all affine expressions to have different values.
expressions | a list of affine integer expressions |
Definition at line 349 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addAllowedAssignments | ( | IntVar[] | variables | ) |
Adds AllowedAssignments(variables)
.
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 of the tupleList.
variables | a list of variables |
Definition at line 441 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addAllowedAssignments | ( | IntVar[] | variables | ) |
Adds AllowedAssignments(variables)
.
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 of the tupleList.
variables | a list of variables |
Definition at line 441 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addAllowedAssignments | ( | Iterable< IntVar > | variables | ) |
Adds AllowedAssignments(variables)
.
Definition at line 450 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addAllowedAssignments | ( | Iterable< IntVar > | variables | ) |
Adds AllowedAssignments(variables)
.
Definition at line 450 of file CpModel.java.
void com.google.ortools.sat.CpModel.addAssumption | ( | Literal | lit | ) |
Adds a literal to the model as assumption
Definition at line 910 of file CpModel.java.
void com.google.ortools.sat.CpModel.addAssumption | ( | Literal | lit | ) |
Adds a literal to the model as assumption
Definition at line 910 of file CpModel.java.
void com.google.ortools.sat.CpModel.addAssumptions | ( | Literal[] | literals | ) |
Adds multiple literals to the model as assumptions
Definition at line 915 of file CpModel.java.
void com.google.ortools.sat.CpModel.addAssumptions | ( | Literal[] | literals | ) |
Adds multiple literals to the model as assumptions
Definition at line 915 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtLeastOne | ( | Iterable< Literal > | literals | ) |
Same as addBoolOr. Sum(literals) >= 1
.
Definition at line 163 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtLeastOne | ( | Iterable< Literal > | literals | ) |
Same as addBoolOr. Sum(literals) >= 1
.
Definition at line 163 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtLeastOne | ( | Literal[] | literals | ) |
Same as addBoolOr. Sum(literals) >= 1
.
Definition at line 158 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtLeastOne | ( | Literal[] | literals | ) |
Same as addBoolOr. Sum(literals) >= 1
.
Definition at line 158 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtMostOne | ( | Iterable< Literal > | literals | ) |
Adds AtMostOne(literals): Sum(literals) <= 1
.
Definition at line 173 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtMostOne | ( | Iterable< Literal > | literals | ) |
Adds AtMostOne(literals): Sum(literals) <= 1
.
Definition at line 173 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtMostOne | ( | Literal[] | literals | ) |
Adds AtMostOne(literals): Sum(literals) <= 1
.
Definition at line 168 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addAtMostOne | ( | Literal[] | literals | ) |
Adds AtMostOne(literals): Sum(literals) <= 1
.
Definition at line 168 of file CpModel.java.
AutomatonConstraint com.google.ortools.sat.CpModel.addAutomaton | ( | IntVar[] | transitionVariables, |
long | startingState, | ||
long[] | finalStates ) |
Adds 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 that will be added incrementally directly on the returned AutomatonConstraint instance. A transition is a triplet ('tail', 'transition', 'head'), where 'tail' and 'head' are states, and 'transition' 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, label, head), 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.
transitionVariables | a non empty list of variables whose values correspond to the labels of the arcs traversed by the automaton |
startingState | the initial state of the automaton |
finalStates | a non empty list of admissible final states |
Definition at line 518 of file CpModel.java.
AutomatonConstraint com.google.ortools.sat.CpModel.addAutomaton | ( | IntVar[] | transitionVariables, |
long | startingState, | ||
long[] | finalStates ) |
Adds 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 that will be added incrementally directly on the returned AutomatonConstraint instance. A transition is a triplet ('tail', 'transition', 'head'), where 'tail' and 'head' are states, and 'transition' 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, label, head), 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.
transitionVariables | a non empty list of variables whose values correspond to the labels of the arcs traversed by the automaton |
startingState | the initial state of the automaton |
finalStates | a non empty list of admissible final states |
Definition at line 518 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolAnd | ( | Iterable< Literal > | literals | ) |
Adds And(literals) == true
.
Definition at line 203 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolAnd | ( | Iterable< Literal > | literals | ) |
Adds And(literals) == true
.
Definition at line 203 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolAnd | ( | Literal[] | literals | ) |
Adds And(literals) == true
.
Definition at line 198 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolAnd | ( | Literal[] | literals | ) |
Adds And(literals) == true
.
Definition at line 198 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolOr | ( | Iterable< Literal > | literals | ) |
Adds Or(literals) == true
.
Definition at line 148 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolOr | ( | Iterable< Literal > | literals | ) |
Adds Or(literals) == true
.
Definition at line 148 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolOr | ( | Literal[] | literals | ) |
Constraint com.google.ortools.sat.CpModel.addBoolOr | ( | Literal[] | literals | ) |
Constraint com.google.ortools.sat.CpModel.addBoolXor | ( | Iterable< Literal > | literals | ) |
Adds XOr(literals) == true
.
Definition at line 218 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolXor | ( | Iterable< Literal > | literals | ) |
Adds XOr(literals) == true
.
Definition at line 218 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolXor | ( | Literal[] | literals | ) |
Adds XOr(literals) == true
.
Definition at line 213 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addBoolXor | ( | Literal[] | literals | ) |
Adds XOr(literals) == true
.
Definition at line 213 of file CpModel.java.
CircuitConstraint com.google.ortools.sat.CpModel.addCircuit | ( | ) |
Adds Circuit()
.
Adds an empty circuit constraint.
A circuit is a unique Hamiltonian path in a subgraph of the total graph. In case a node 'i' is not in the path, then there must be a loop arc 'i -> i'
associated with a true literal. Otherwise this constraint will fail.
Definition at line 412 of file CpModel.java.
CircuitConstraint com.google.ortools.sat.CpModel.addCircuit | ( | ) |
Adds Circuit()
.
Adds an empty circuit constraint.
A circuit is a unique Hamiltonian path in a subgraph of the total graph. In case a node 'i' is not in the path, then there must be a loop arc 'i -> i'
associated with a true literal. Otherwise this constraint will fail.
Definition at line 412 of file CpModel.java.
CumulativeConstraint com.google.ortools.sat.CpModel.addCumulative | ( | LinearArgument | capacity | ) |
Adds Cumulative(capacity)
.
This constraint enforces that:
forall t: sum(demands[i] if (start(intervals[t]) <= t < end(intervals[t])) and (t is
.
present)) <= capacity
capacity | the maximum capacity of the cumulative constraint. It must be a positive affine expression. |
Definition at line 879 of file CpModel.java.
CumulativeConstraint com.google.ortools.sat.CpModel.addCumulative | ( | LinearArgument | capacity | ) |
Adds Cumulative(capacity)
.
This constraint enforces that:
forall t: sum(demands[i] if (start(intervals[t]) <= t < end(intervals[t])) and (t is
.
present)) <= capacity
capacity | the maximum capacity of the cumulative constraint. It must be a positive affine expression. |
Definition at line 879 of file CpModel.java.
CumulativeConstraint com.google.ortools.sat.CpModel.addCumulative | ( | long | capacity | ) |
Adds Cumulative(capacity)
.
Definition at line 891 of file CpModel.java.
CumulativeConstraint com.google.ortools.sat.CpModel.addCumulative | ( | long | capacity | ) |
Adds Cumulative(capacity)
.
Definition at line 891 of file CpModel.java.
void com.google.ortools.sat.CpModel.addDecisionStrategy | ( | Iterable<? extends LinearArgument > | expressions, |
DecisionStrategyProto.VariableSelectionStrategy | varStr, | ||
DecisionStrategyProto.DomainReductionStrategy | domStr ) |
Adds DecisionStrategy(expressions, varStr, domStr)
.
Definition at line 996 of file CpModel.java.
void com.google.ortools.sat.CpModel.addDecisionStrategy | ( | Iterable<? extends LinearArgument > | expressions, |
DecisionStrategyProto.VariableSelectionStrategy | varStr, | ||
DecisionStrategyProto.DomainReductionStrategy | domStr ) |
Adds DecisionStrategy(expressions, varStr, domStr)
.
Definition at line 996 of file CpModel.java.
void com.google.ortools.sat.CpModel.addDecisionStrategy | ( | LinearArgument[] | expressions, |
DecisionStrategyProto.VariableSelectionStrategy | varStr, | ||
DecisionStrategyProto.DomainReductionStrategy | domStr ) |
DecisionStrategy.
Adds DecisionStrategy(expressions, varStr, domStr)
.
Definition at line 985 of file CpModel.java.
void com.google.ortools.sat.CpModel.addDecisionStrategy | ( | LinearArgument[] | expressions, |
DecisionStrategyProto.VariableSelectionStrategy | varStr, | ||
DecisionStrategyProto.DomainReductionStrategy | domStr ) |
DecisionStrategy.
Adds DecisionStrategy(expressions, varStr, domStr)
.
Definition at line 985 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addDifferent | ( | LinearArgument | expr, |
long | value ) |
Adds expr != value
.
Definition at line 324 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addDifferent | ( | LinearArgument | expr, |
long | value ) |
Adds expr != value
.
Definition at line 324 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addDifferent | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left != right
.
Definition at line 331 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addDifferent | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left != right
.
Definition at line 331 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addDivisionEquality | ( | LinearArgument | target, |
LinearArgument | num, | ||
LinearArgument | denom ) |
Adds target == num / denom
, rounded towards 0.
Definition at line 649 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addDivisionEquality | ( | LinearArgument | target, |
LinearArgument | num, | ||
LinearArgument | denom ) |
Adds target == num / denom
, rounded towards 0.
Definition at line 649 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addElement | ( | IntVar | index, |
int[] | values, | ||
IntVar | target ) |
Adds the element constraint: values[index] == target
.
Definition at line 392 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addElement | ( | IntVar | index, |
int[] | values, | ||
IntVar | target ) |
Adds the element constraint: values[index] == target
.
Definition at line 392 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addElement | ( | IntVar | index, |
IntVar[] | variables, | ||
IntVar | target ) |
Adds the element constraint: variables[index] == target
.
Definition at line 368 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addElement | ( | IntVar | index, |
IntVar[] | variables, | ||
IntVar | target ) |
Adds the element constraint: variables[index] == target
.
Definition at line 368 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addElement | ( | IntVar | index, |
long[] | values, | ||
IntVar | target ) |
Adds the element constraint: values[index] == target
.
Definition at line 380 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addElement | ( | IntVar | index, |
long[] | values, | ||
IntVar | target ) |
Adds the element constraint: values[index] == target
.
Definition at line 380 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addEquality | ( | LinearArgument | expr, |
long | value ) |
Adds expr == value
.
Definition at line 259 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addEquality | ( | LinearArgument | expr, |
long | value ) |
Adds expr == value
.
Definition at line 259 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addEquality | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left == right
.
Definition at line 264 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addEquality | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left == right
.
Definition at line 264 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addExactlyOne | ( | Iterable< Literal > | literals | ) |
Adds ExactlyOne(literals): Sum(literals) == 1
.
Definition at line 188 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addExactlyOne | ( | Iterable< Literal > | literals | ) |
Adds ExactlyOne(literals): Sum(literals) == 1
.
Definition at line 188 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addExactlyOne | ( | Literal[] | literals | ) |
Adds ExactlyOne(literals): Sum(literals) == 1
.
Definition at line 183 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addExactlyOne | ( | Literal[] | literals | ) |
Adds ExactlyOne(literals): Sum(literals) == 1
.
Definition at line 183 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addForbiddenAssignments | ( | IntVar[] | variables | ) |
Adds ForbiddenAssignments(variables)
.
A ForbiddenAssignments constraint is a constraint on an array of variables where the list of impossible combinations is provided in the tuples list.
variables | a list of variables |
Definition at line 470 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addForbiddenAssignments | ( | IntVar[] | variables | ) |
Adds ForbiddenAssignments(variables)
.
A ForbiddenAssignments constraint is a constraint on an array of variables where the list of impossible combinations is provided in the tuples list.
variables | a list of variables |
Definition at line 470 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addForbiddenAssignments | ( | Iterable< IntVar > | variables | ) |
Adds ForbiddenAssignments(variables)
.
Definition at line 479 of file CpModel.java.
TableConstraint com.google.ortools.sat.CpModel.addForbiddenAssignments | ( | Iterable< IntVar > | variables | ) |
Adds ForbiddenAssignments(variables)
.
Definition at line 479 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterOrEqual | ( | LinearArgument | expr, |
long | value ) |
Adds expr >= value
.
Definition at line 298 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterOrEqual | ( | LinearArgument | expr, |
long | value ) |
Adds expr >= value
.
Definition at line 298 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterOrEqual | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left >= right
.
Definition at line 303 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterOrEqual | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left >= right
.
Definition at line 303 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterThan | ( | LinearArgument | expr, |
long | value ) |
Adds expr > value
.
Definition at line 311 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterThan | ( | LinearArgument | expr, |
long | value ) |
Adds expr > value
.
Definition at line 311 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterThan | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left > right
.
Definition at line 316 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addGreaterThan | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left > right
.
Definition at line 316 of file CpModel.java.
void com.google.ortools.sat.CpModel.addHint | ( | IntVar | var, |
long | value ) |
Adds hinting to a variable
Definition at line 899 of file CpModel.java.
void com.google.ortools.sat.CpModel.addHint | ( | IntVar | var, |
long | value ) |
Adds hinting to a variable
Definition at line 899 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addImplication | ( | Literal | a, |
Literal | b ) |
Adds a => b
.
Definition at line 228 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addImplication | ( | Literal | a, |
Literal | b ) |
Adds a => b
.
Definition at line 228 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addInverse | ( | IntVar[] | variables, |
IntVar[] | inverseVariables ) |
Adds Inverse(variables, inverseVariables)
.
An inverse constraint enforces that if 'variables[i]' is assigned a value 'j', then inverseVariables[j] is assigned a value 'i'. And vice versa.
variables | an array of integer variables |
inverseVariables | an array of integer variables |
MismatchedArrayLengths | if variables and inverseVariables have different length |
Definition at line 543 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addInverse | ( | IntVar[] | variables, |
IntVar[] | inverseVariables ) |
Adds Inverse(variables, inverseVariables)
.
An inverse constraint enforces that if 'variables[i]' is assigned a value 'j', then inverseVariables[j] is assigned a value 'i'. And vice versa.
variables | an array of integer variables |
inverseVariables | an array of integer variables |
MismatchedArrayLengths | if variables and inverseVariables have different length |
Definition at line 543 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessOrEqual | ( | LinearArgument | expr, |
long | value ) |
Adds expr <= value
.
Definition at line 272 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessOrEqual | ( | LinearArgument | expr, |
long | value ) |
Adds expr <= value
.
Definition at line 272 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessOrEqual | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left <= right
.
Definition at line 277 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessOrEqual | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left <= right
.
Definition at line 277 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessThan | ( | LinearArgument | expr, |
long | value ) |
Adds expr < value
.
Definition at line 285 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessThan | ( | LinearArgument | expr, |
long | value ) |
Adds expr < value
.
Definition at line 285 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessThan | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left < right
.
Definition at line 290 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLessThan | ( | LinearArgument | left, |
LinearArgument | right ) |
Adds left < right
.
Definition at line 290 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLinearConstraint | ( | LinearArgument | expr, |
long | lb, | ||
long | ub ) |
Adds lb <= expr <= ub
.
Definition at line 254 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLinearConstraint | ( | LinearArgument | expr, |
long | lb, | ||
long | ub ) |
Adds lb <= expr <= ub
.
Definition at line 254 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addLinearExpressionInDomain | ( | LinearArgument | expr, |
Domain | domain ) |
Constraint com.google.ortools.sat.CpModel.addLinearExpressionInDomain | ( | LinearArgument | expr, |
Domain | domain ) |
Adds var == i + offset <=> booleans[i] == true for all i in [0, booleans.length)
.
Definition at line 595 of file CpModel.java.
Adds var == i + offset <=> booleans[i] == true for all i in [0, booleans.length)
.
Definition at line 595 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMaxEquality | ( | LinearArgument | target, |
Iterable<? extends LinearArgument > | exprs ) |
Adds target == Max(exprs)
.
Definition at line 637 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMaxEquality | ( | LinearArgument | target, |
Iterable<? extends LinearArgument > | exprs ) |
Adds target == Max(exprs)
.
Definition at line 637 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMaxEquality | ( | LinearArgument | target, |
LinearArgument[] | exprs ) |
Adds target == Max(vars)
.
Definition at line 626 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMaxEquality | ( | LinearArgument | target, |
LinearArgument[] | exprs ) |
Adds target == Max(vars)
.
Definition at line 626 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMinEquality | ( | LinearArgument | target, |
Iterable<? extends LinearArgument > | exprs ) |
Adds target == Min(exprs)
.
Definition at line 614 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMinEquality | ( | LinearArgument | target, |
Iterable<? extends LinearArgument > | exprs ) |
Adds target == Min(exprs)
.
Definition at line 614 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMinEquality | ( | LinearArgument | target, |
LinearArgument[] | exprs ) |
Adds target == Min(vars)
.
Definition at line 603 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMinEquality | ( | LinearArgument | target, |
LinearArgument[] | exprs ) |
Adds target == Min(vars)
.
Definition at line 603 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addModuloEquality | ( | LinearArgument | target, |
LinearArgument | var, | ||
LinearArgument | mod ) |
Adds target == var % mod
.
Definition at line 671 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addModuloEquality | ( | LinearArgument | target, |
LinearArgument | var, | ||
LinearArgument | mod ) |
Adds target == var % mod
.
Definition at line 671 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addModuloEquality | ( | LinearArgument | target, |
LinearArgument | var, | ||
long | mod ) |
Adds target == var % mod
.
Definition at line 683 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addModuloEquality | ( | LinearArgument | target, |
LinearArgument | var, | ||
long | mod ) |
Adds target == var % mod
.
Definition at line 683 of file CpModel.java.
MultipleCircuitConstraint com.google.ortools.sat.CpModel.addMultipleCircuit | ( | ) |
Adds MultipleCircuit()
.
Adds an empty multiple circuit constraint.
A multiple circuit is set of cycles in a subgraph of the total graph. The node index by 0 must be part of all cycles of length > 1. Each node with index > 0 belongs to exactly one cycle. If such node does not belong in any cycle of length > 1, then there must be a looping arc on this node attached to a literal that will be true. Otherwise, the constraint will fail.
Definition at line 426 of file CpModel.java.
MultipleCircuitConstraint com.google.ortools.sat.CpModel.addMultipleCircuit | ( | ) |
Adds MultipleCircuit()
.
Adds an empty multiple circuit constraint.
A multiple circuit is set of cycles in a subgraph of the total graph. The node index by 0 must be part of all cycles of length > 1. Each node with index > 0 belongs to exactly one cycle. If such node does not belong in any cycle of length > 1, then there must be a looping arc on this node attached to a literal that will be true. Otherwise, the constraint will fail.
Definition at line 426 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMultiplicationEquality | ( | LinearArgument | target, |
LinearArgument | left, | ||
LinearArgument | right ) |
Adds target == left * right
.
Definition at line 705 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMultiplicationEquality | ( | LinearArgument | target, |
LinearArgument | left, | ||
LinearArgument | right ) |
Adds target == left * right
.
Definition at line 705 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMultiplicationEquality | ( | LinearArgument | target, |
LinearArgument[] | exprs ) |
Adds target == Product(exprs)
.
Definition at line 694 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addMultiplicationEquality | ( | LinearArgument | target, |
LinearArgument[] | exprs ) |
Adds target == Product(exprs)
.
Definition at line 694 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addNoOverlap | ( | IntervalVar[] | intervalVars | ) |
Adds NoOverlap(intervalVars)
.
A NoOverlap constraint ensures that all present intervals do not overlap in time.
intervalVars | the list of interval variables to constrain |
Definition at line 832 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addNoOverlap | ( | IntervalVar[] | intervalVars | ) |
Adds NoOverlap(intervalVars)
.
A NoOverlap constraint ensures that all present intervals do not overlap in time.
intervalVars | the list of interval variables to constrain |
Definition at line 832 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addNoOverlap | ( | Iterable< IntervalVar > | intervalVars | ) |
Adds NoOverlap(intervalVars)
.
Definition at line 841 of file CpModel.java.
Constraint com.google.ortools.sat.CpModel.addNoOverlap | ( | Iterable< IntervalVar > | intervalVars | ) |
Adds NoOverlap(intervalVars)
.
Definition at line 841 of file CpModel.java.
NoOverlap2dConstraint com.google.ortools.sat.CpModel.addNoOverlap2D | ( | ) |
Adds NoOverlap2D(xIntervals, yIntervals)
.
A NoOverlap2D constraint ensures that all present rectangles do not overlap on a plan. Each rectangle is aligned with the X and Y axis, and is defined by two intervals which represent its projection onto the X and Y axis.
Furthermore, one box is optional if at least one of the x or y interval is optional.
Definition at line 862 of file CpModel.java.
NoOverlap2dConstraint com.google.ortools.sat.CpModel.addNoOverlap2D | ( | ) |
Adds NoOverlap2D(xIntervals, yIntervals)
.
A NoOverlap2D constraint ensures that all present rectangles do not overlap on a plan. Each rectangle is aligned with the X and Y axis, and is defined by two intervals which represent its projection onto the X and Y axis.
Furthermore, one box is optional if at least one of the x or y interval is optional.
Definition at line 862 of file CpModel.java.
ReservoirConstraint com.google.ortools.sat.CpModel.addReservoirConstraint | ( | long | minLevel, |
long | maxLevel ) |
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, levelChange, active), if active is true, and if time is assigned a value t, then the level of the reservoir changes by levelChange (which is constant) at time t. Therefore, at any time t:
sum(levelChanges[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.
minLevel | at any time, the level of the reservoir must be greater of equal than the min level. minLevel must me <= 0. |
maxLevel | at any time, the level of the reservoir must be less or equal than the max level. maxLevel must be >= 0. |
IllegalArgumentException | if minLevel > 0 |
IllegalArgumentException | if maxLevel < 0 |
Definition at line 581 of file CpModel.java.
ReservoirConstraint com.google.ortools.sat.CpModel.addReservoirConstraint | ( | long | minLevel, |
long | maxLevel ) |
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, levelChange, active), if active is true, and if time is assigned a value t, then the level of the reservoir changes by levelChange (which is constant) at time t. Therefore, at any time t:
sum(levelChanges[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.
minLevel | at any time, the level of the reservoir must be greater of equal than the min level. minLevel must me <= 0. |
maxLevel | at any time, the level of the reservoir must be less or equal than the max level. maxLevel must be >= 0. |
IllegalArgumentException | if minLevel > 0 |
IllegalArgumentException | if maxLevel < 0 |
Definition at line 581 of file CpModel.java.
void com.google.ortools.sat.CpModel.clearAssumptions | ( | ) |
Remove all assumptions from the model
Definition at line 922 of file CpModel.java.
void com.google.ortools.sat.CpModel.clearAssumptions | ( | ) |
Remove all assumptions from the model
Definition at line 922 of file CpModel.java.
void com.google.ortools.sat.CpModel.clearHints | ( | ) |
Remove all solution hints
Definition at line 905 of file CpModel.java.
void com.google.ortools.sat.CpModel.clearHints | ( | ) |
Remove all solution hints
Definition at line 905 of file CpModel.java.
void com.google.ortools.sat.CpModel.clearObjective | ( | ) |
Clears the objective.
Definition at line 972 of file CpModel.java.
void com.google.ortools.sat.CpModel.clearObjective | ( | ) |
Clears the objective.
Definition at line 972 of file CpModel.java.
Boolean com.google.ortools.sat.CpModel.exportToFile | ( | String | file | ) |
Write the model as a protocol buffer to 'file'.
file | file to write the model to. If the filename ends with 'txt', the model will be written as a text file, otherwise, the binary format will be used. |
Definition at line 1024 of file CpModel.java.
Boolean com.google.ortools.sat.CpModel.exportToFile | ( | String | file | ) |
Write the model as a protocol buffer to 'file'.
file | file to write the model to. If the filename ends with 'txt', the model will be written as a text file, otherwise, the binary format will be used. |
Definition at line 1024 of file CpModel.java.
Literal com.google.ortools.sat.CpModel.falseLiteral | ( | ) |
Returns the false literal.
Definition at line 121 of file CpModel.java.
Literal com.google.ortools.sat.CpModel.falseLiteral | ( | ) |
Returns the false literal.
Definition at line 121 of file CpModel.java.
BoolVar com.google.ortools.sat.CpModel.getBoolVarFromProtoIndex | ( | int | index | ) |
Rebuilds a Boolean variable from an index. Useful after cloning a model.
Definition at line 131 of file CpModel.java.
BoolVar com.google.ortools.sat.CpModel.getBoolVarFromProtoIndex | ( | int | index | ) |
Rebuilds a Boolean variable from an index. Useful after cloning a model.
Definition at line 131 of file CpModel.java.
CpModelProto.Builder com.google.ortools.sat.CpModel.getBuilder | ( | ) |
Returns the model builder.
Definition at line 1060 of file CpModel.java.
CpModelProto.Builder com.google.ortools.sat.CpModel.getBuilder | ( | ) |
Returns the model builder.
Definition at line 1060 of file CpModel.java.
CpModel com.google.ortools.sat.CpModel.getClone | ( | ) |
Definition at line 69 of file CpModel.java.
CpModel com.google.ortools.sat.CpModel.getClone | ( | ) |
Definition at line 69 of file CpModel.java.
IntVar com.google.ortools.sat.CpModel.getIntVarFromProtoIndex | ( | int | index | ) |
Rebuilds an integer variable from an index. Useful after cloning a model.
Definition at line 136 of file CpModel.java.
IntVar com.google.ortools.sat.CpModel.getIntVarFromProtoIndex | ( | int | index | ) |
Rebuilds an integer variable from an index. Useful after cloning a model.
Definition at line 136 of file CpModel.java.
boolean com.google.ortools.sat.CpModel.hasObjective | ( | ) |
Checks if the model contains an objective.
Definition at line 978 of file CpModel.java.
boolean com.google.ortools.sat.CpModel.hasObjective | ( | ) |
Checks if the model contains an objective.
Definition at line 978 of file CpModel.java.
void com.google.ortools.sat.CpModel.maximize | ( | DoubleLinearExpr | expr | ) |
Adds a maximization objective of a linear expression.
Definition at line 962 of file CpModel.java.
void com.google.ortools.sat.CpModel.maximize | ( | DoubleLinearExpr | expr | ) |
Adds a maximization objective of a linear expression.
Definition at line 962 of file CpModel.java.
void com.google.ortools.sat.CpModel.maximize | ( | LinearArgument | expr | ) |
Adds a maximization objective of a linear expression.
Definition at line 950 of file CpModel.java.
void com.google.ortools.sat.CpModel.maximize | ( | LinearArgument | expr | ) |
Adds a maximization objective of a linear expression.
Definition at line 950 of file CpModel.java.
void com.google.ortools.sat.CpModel.minimize | ( | DoubleLinearExpr | expr | ) |
Adds a minimization objective of a linear expression.
Definition at line 940 of file CpModel.java.
void com.google.ortools.sat.CpModel.minimize | ( | DoubleLinearExpr | expr | ) |
Adds a minimization objective of a linear expression.
Definition at line 940 of file CpModel.java.
void com.google.ortools.sat.CpModel.minimize | ( | LinearArgument | expr | ) |
Objective.
Adds a minimization objective of a linear expression.
Definition at line 929 of file CpModel.java.
void com.google.ortools.sat.CpModel.minimize | ( | LinearArgument | expr | ) |
Objective.
Adds a minimization objective of a linear expression.
Definition at line 929 of file CpModel.java.
CpModelProto com.google.ortools.sat.CpModel.model | ( | ) |
Getters.
Definition at line 1051 of file CpModel.java.
CpModelProto com.google.ortools.sat.CpModel.model | ( | ) |
Getters.
Definition at line 1051 of file CpModel.java.
String com.google.ortools.sat.CpModel.modelStats | ( | ) |
Returns some statistics on model as a string.
Definition at line 1007 of file CpModel.java.
String com.google.ortools.sat.CpModel.modelStats | ( | ) |
Returns some statistics on model as a string.
Definition at line 1007 of file CpModel.java.
int com.google.ortools.sat.CpModel.negated | ( | int | index | ) |
Definition at line 1055 of file CpModel.java.
int com.google.ortools.sat.CpModel.negated | ( | int | index | ) |
Definition at line 1055 of file CpModel.java.
BoolVar com.google.ortools.sat.CpModel.newBoolVar | ( | String | name | ) |
Creates a Boolean variable with the given name.
Definition at line 96 of file CpModel.java.
BoolVar com.google.ortools.sat.CpModel.newBoolVar | ( | String | name | ) |
Creates a Boolean variable with the given name.
Definition at line 96 of file CpModel.java.
IntVar com.google.ortools.sat.CpModel.newConstant | ( | long | value | ) |
Creates a constant variable.
Definition at line 101 of file CpModel.java.
IntVar com.google.ortools.sat.CpModel.newConstant | ( | long | value | ) |
Creates a constant variable.
Definition at line 101 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newFixedInterval | ( | long | start, |
long | size, | ||
String | name ) |
Creates a fixed interval from its start and its size.
Definition at line 760 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newFixedInterval | ( | long | start, |
long | size, | ||
String | name ) |
Creates a fixed interval from its start and its size.
Definition at line 760 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newFixedSizeIntervalVar | ( | LinearArgument | start, |
long | size, | ||
String | name ) |
Creates an interval variable from an affine expression start, and a fixed size.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the fixed size of the interval. |
name | the name of the interval variable. |
Definition at line 750 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newFixedSizeIntervalVar | ( | LinearArgument | start, |
long | size, | ||
String | name ) |
Creates an interval variable from an affine expression start, and a fixed size.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the fixed size of the interval. |
name | the name of the interval variable. |
Definition at line 750 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newIntervalVar | ( | LinearArgument | start, |
LinearArgument | size, | ||
LinearArgument | end, | ||
String | name ) |
Scheduling support.
Creates an interval variable from three affine expressions start, size, and end.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
Internally, it ensures that start + size == end
.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the size of the interval. It needs to be an affine or constant expression. |
end | the end of the interval. It needs to be an affine or constant expression. |
name | the name of the interval variable |
Definition at line 731 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newIntervalVar | ( | LinearArgument | start, |
LinearArgument | size, | ||
LinearArgument | end, | ||
String | name ) |
Scheduling support.
Creates an interval variable from three affine expressions start, size, and end.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
Internally, it ensures that start + size == end
.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the size of the interval. It needs to be an affine or constant expression. |
end | the end of the interval. It needs to be an affine or constant expression. |
name | the name of the interval variable |
Definition at line 731 of file CpModel.java.
IntVar com.google.ortools.sat.CpModel.newIntVar | ( | long | lb, |
long | ub, | ||
String | name ) |
Integer variables.
Creates an integer variable with domain [lb, ub].
Definition at line 80 of file CpModel.java.
IntVar com.google.ortools.sat.CpModel.newIntVar | ( | long | lb, |
long | ub, | ||
String | name ) |
Integer variables.
Creates an integer variable with domain [lb, ub].
Definition at line 80 of file CpModel.java.
Creates an integer variable with given domain.
domain | an instance of the Domain class. |
name | the name of the variable |
Definition at line 91 of file CpModel.java.
Creates an integer variable with given domain.
domain | an instance of the Domain class. |
name | the name of the variable |
Definition at line 91 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newOptionalFixedInterval | ( | long | start, |
long | size, | ||
Literal | isPresent, | ||
String | name ) |
Creates an optional fixed interval from start and size, and an isPresent literal.
Definition at line 817 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newOptionalFixedInterval | ( | long | start, |
long | size, | ||
Literal | isPresent, | ||
String | name ) |
Creates an optional fixed interval from start and size, and an isPresent literal.
Definition at line 817 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newOptionalFixedSizeIntervalVar | ( | LinearArgument | start, |
long | size, | ||
Literal | isPresent, | ||
String | name ) |
Creates an optional interval variable from an affine expression start, and a fixed size.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the fixed size of the interval. |
isPresent | a literal that indicates if the interval is active or not. A inactive interval is simply ignored by all constraints. |
name | the name of the interval variable. |
Definition at line 806 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newOptionalFixedSizeIntervalVar | ( | LinearArgument | start, |
long | size, | ||
Literal | isPresent, | ||
String | name ) |
Creates an optional interval variable from an affine expression start, and a fixed size.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the fixed size of the interval. |
isPresent | a literal that indicates if the interval is active or not. A inactive interval is simply ignored by all constraints. |
name | the name of the interval variable. |
Definition at line 806 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newOptionalIntervalVar | ( | LinearArgument | start, |
LinearArgument | size, | ||
LinearArgument | end, | ||
Literal | isPresent, | ||
String | name ) |
Creates an optional interval variable from three affine expressions start, size, end, and isPresent.
An optional interval variable is a constraint, that is itself used in other constraints like NoOverlap. This constraint is protected by an isPresent
literal that indicates if it is active or not.
Internally, it ensures that isPresent => start + size == end
.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the size of the interval. It needs to be an affine or constant expression. |
end | the end of the interval. It needs to be an affine or constant expression. |
isPresent | a literal that indicates if the interval is active or not. A inactive interval is simply ignored by all constraints. |
name | The name of the interval variable |
Definition at line 784 of file CpModel.java.
IntervalVar com.google.ortools.sat.CpModel.newOptionalIntervalVar | ( | LinearArgument | start, |
LinearArgument | size, | ||
LinearArgument | end, | ||
Literal | isPresent, | ||
String | name ) |
Creates an optional interval variable from three affine expressions start, size, end, and isPresent.
An optional interval variable is a constraint, that is itself used in other constraints like NoOverlap. This constraint is protected by an isPresent
literal that indicates if it is active or not.
Internally, it ensures that isPresent => start + size == end
.
start | the start of the interval. It needs to be an affine or constant expression. |
size | the size of the interval. It needs to be an affine or constant expression. |
end | the end of the interval. It needs to be an affine or constant expression. |
isPresent | a literal that indicates if the interval is active or not. A inactive interval is simply ignored by all constraints. |
name | The name of the interval variable |
Definition at line 784 of file CpModel.java.
Literal com.google.ortools.sat.CpModel.trueLiteral | ( | ) |
Returns the true literal.
Definition at line 111 of file CpModel.java.
Literal com.google.ortools.sat.CpModel.trueLiteral | ( | ) |
Returns the true literal.
Definition at line 111 of file CpModel.java.
String com.google.ortools.sat.CpModel.validate | ( | ) |
Returns a non empty string explaining the issue if the model is invalid.
Definition at line 1012 of file CpModel.java.
String com.google.ortools.sat.CpModel.validate | ( | ) |
Returns a non empty string explaining the issue if the model is invalid.
Definition at line 1012 of file CpModel.java.