Java Reference
Java Reference
Detailed Description
Main modeling class.
Proposes a factory to create all modeling objects understood by the SAT solver.
Definition at line 41 of file CpModel.java.
Classes | |
class | CpModelException |
class | MismatchedArrayLengths |
Exception thrown when parallel arrays have mismatched lengths. More... | |
class | WrongLength |
Exception thrown when an array has a wrong length. More... | |
Public Member Functions | |
CpModel () | |
IntVar | newIntVar (long lb, long ub, String name) |
Creates an integer variable with domain [lb, ub]. More... | |
IntVar | newIntVarFromDomain (Domain domain, String name) |
Creates an integer variable with given domain. More... | |
IntVar | newBoolVar (String name) |
Creates a Boolean variable with the given name. More... | |
IntVar | newConstant (long value) |
Creates a constant variable. More... | |
Literal | trueLiteral () |
Returns the true literal. More... | |
Literal | falseLiteral () |
Returns the false literal. More... | |
Constraint | addBoolOr (Literal[] literals) |
Adds. More... | |
Constraint | addBoolAnd (Literal[] literals) |
Adds. More... | |
Constraint | addBoolXor (Literal[] literals) |
Adds. More... | |
Constraint | addImplication (Literal a, Literal b) |
Adds. More... | |
Constraint | addLinearExpressionInDomain (LinearExpr expr, Domain domain) |
Adds. More... | |
Constraint | addLinearConstraint (LinearExpr expr, long lb, long ub) |
Adds. More... | |
Constraint | addEquality (LinearExpr expr, long value) |
Adds. More... | |
Constraint | addEquality (LinearExpr left, LinearExpr right) |
Adds. More... | |
Constraint | addEqualityWithOffset (LinearExpr left, LinearExpr right, long offset) |
Adds. More... | |
Constraint | addLessOrEqual (LinearExpr expr, long value) |
Adds. More... | |
Constraint | addLessOrEqual (LinearExpr left, LinearExpr right) |
Adds. More... | |
Constraint | addLessThan (LinearExpr expr, long value) |
Adds. More... | |
Constraint | addLessThan (LinearExpr left, LinearExpr right) |
Adds. More... | |
Constraint | addLessOrEqualWithOffset (LinearExpr left, LinearExpr right, long offset) |
Adds. More... | |
Constraint | addGreaterOrEqual (LinearExpr expr, long value) |
Adds. More... | |
Constraint | addGreaterOrEqual (LinearExpr left, LinearExpr right) |
Adds. More... | |
Constraint | addGreaterThan (LinearExpr expr, long value) |
Adds. More... | |
Constraint | addGreaterThan (LinearExpr left, LinearExpr right) |
Adds. More... | |
Constraint | addGreaterOrEqualWithOffset (LinearExpr left, LinearExpr right, long offset) |
Adds. More... | |
Constraint | addDifferent (LinearExpr expr, long value) |
Adds. More... | |
Constraint | addDifferent (IntVar left, IntVar right) |
Adds. More... | |
Constraint | addDifferentWithOffset (IntVar left, IntVar right, long offset) |
Adds. More... | |
Constraint | addAllDifferent (IntVar[] variables) |
Adds. More... | |
Constraint | addElement (IntVar index, IntVar[] variables, IntVar target) |
Adds the element constraint: More... | |
Constraint | addElement (IntVar index, long[] values, IntVar target) |
Adds the element constraint: More... | |
Constraint | addElement (IntVar index, int[] values, IntVar target) |
Adds the element constraint: More... | |
Constraint | addCircuit (int[] tails, int[] heads, Literal[] literals) |
Adds. More... | |
Constraint | addAllowedAssignments (IntVar[] variables, long[][] tuplesList) |
Adds. More... | |
Constraint | addAllowedAssignments (IntVar[] variables, int[][] tuplesList) |
Adds. More... | |
Constraint | addForbiddenAssignments (IntVar[] variables, long[][] tuplesList) |
Adds. More... | |
Constraint | addForbiddenAssignments (IntVar[] variables, int[][] tuplesList) |
Adds. More... | |
Constraint | addAutomaton (IntVar[] transitionVariables, long startingState, long[] finalStates, long[][] transitions) |
Adds an automaton constraint. More... | |
Constraint | addInverse (IntVar[] variables, IntVar[] inverseVariables) |
Adds. More... | |
Constraint | addReservoirConstraint (IntVar[] times, long[] demands, long minLevel, long maxLevel) |
Adds. More... | |
Constraint | addReservoirConstraint (IntVar[] times, int[] demands, long minLevel, long maxLevel) |
Adds. More... | |
Constraint | addReservoirConstraintWithActive (IntVar[] times, long[] demands, IntVar[] actives, long minLevel, long maxLevel) |
Adds. More... | |
Constraint | addReservoirConstraintWithActive (IntVar[] times, int[] demands, IntVar[] actives, long minLevel, long maxLevel) |
Adds. More... | |
void | addMapDomain (IntVar var, Literal[] booleans, long offset) |
Adds. More... | |
Constraint | addMinEquality (IntVar target, IntVar[] vars) |
Adds. More... | |
Constraint | addMaxEquality (IntVar target, IntVar[] vars) |
Adds. More... | |
Constraint | addDivisionEquality (IntVar target, IntVar num, IntVar denom) |
Adds. More... | |
Constraint | addAbsEquality (IntVar target, IntVar var) |
Adds. More... | |
Constraint | addModuloEquality (IntVar target, IntVar var, IntVar mod) |
Adds. More... | |
Constraint | addModuloEquality (IntVar target, IntVar var, long mod) |
Adds. More... | |
Constraint | addProductEquality (IntVar target, IntVar[] vars) |
Adds. More... | |
IntervalVar | newIntervalVar (IntVar start, IntVar size, IntVar end, String name) |
Creates an interval variable from start, size, and end. More... | |
IntervalVar | newIntervalVar (IntVar start, IntVar size, long end, String name) |
Creates an interval variable with a fixed end. More... | |
IntervalVar | newIntervalVar (IntVar start, long size, IntVar end, String name) |
Creates an interval variable with a fixed size. More... | |
IntervalVar | newIntervalVar (long start, IntVar size, IntVar end, String name) |
Creates an interval variable with a fixed start. More... | |
IntervalVar | newFixedInterval (long start, long size, String name) |
Creates a fixed interval from its start and its size. More... | |
IntervalVar | newOptionalIntervalVar (IntVar start, IntVar size, IntVar end, Literal isPresent, String name) |
Creates an optional interval variable from start, size, end, and isPresent. More... | |
IntervalVar | newOptionalIntervalVar (IntVar start, IntVar size, long end, Literal isPresent, String name) |
Creates an optional interval with a fixed end. More... | |
IntervalVar | newOptionalIntervalVar (IntVar start, long size, IntVar end, Literal isPresent, String name) |
Creates an optional interval with a fixed size. More... | |
IntervalVar | newOptionalIntervalVar (long start, IntVar size, IntVar end, Literal isPresent, String name) |
Creates an optional interval with a fixed start. More... | |
IntervalVar | newOptionalFixedInterval (long start, long size, Literal isPresent, String name) |
Creates an optional fixed interval from start and size. More... | |
Constraint | addNoOverlap (IntervalVar[] intervalVars) |
Adds. More... | |
Constraint | addNoOverlap2D (IntervalVar[] xIntervals, IntervalVar[] yIntervals) |
Adds. More... | |
Constraint | addCumulative (IntervalVar[] intervals, IntVar[] demands, IntVar capacity) |
Adds. More... | |
Constraint | addCumulative (IntervalVar[] intervals, long[] demands, IntVar capacity) |
Adds. More... | |
Constraint | addCumulative (IntervalVar[] intervals, int[] demands, IntVar capacity) |
Adds. More... | |
Constraint | addCumulative (IntervalVar[] intervals, IntVar[] demands, long capacity) |
Adds. More... | |
Constraint | addCumulative (IntervalVar[] intervals, long[] demands, long capacity) |
Adds. More... | |
Constraint | addCumulative (IntervalVar[] intervals, int[] demands, long capacity) |
Adds. More... | |
void | addHint (IntVar var, long value) |
Adds hinting to a variable. More... | |
void | clearHints () |
Remove all solution hints. More... | |
void | addAssumption (Literal lit) |
Adds a literal to the model as assumption. More... | |
void | addAssumptions (Literal[] literals) |
Adds multiple literals to the model as assumptions. More... | |
void | clearAssumptions () |
Remove all assumptions from the model. More... | |
void | minimize (LinearExpr expr) |
Adds a minimization objective of a linear expression. More... | |
void | maximize (LinearExpr expr) |
Adds a maximization objective of a linear expression. More... | |
void | addDecisionStrategy (IntVar[] variables, DecisionStrategyProto.VariableSelectionStrategy varStr, DecisionStrategyProto.DomainReductionStrategy domStr) |
Adds. More... | |
String | modelStats () |
Returns some statistics on model as a string. More... | |
String | validate () |
Returns a non empty string explaining the issue if the model is invalid. More... | |
Boolean | exportToFile (String file) |
Write the model as a ascii protocol buffer to 'file'. More... | |
CpModelProto | model () |
int | negated (int index) |
CpModelProto.Builder | getBuilder () |
Returns the model builder. More... | |
Constructor & Destructor Documentation
◆ CpModel()
CpModel | ( | ) |
Definition at line 62 of file CpModel.java.
Member Function Documentation
◆ addAbsEquality()
Constraint addAbsEquality | ( | IntVar | target, |
IntVar | var | ||
) |
◆ addAllDifferent()
Constraint addAllDifferent | ( | IntVar[] | variables | ) |
Adds.
.
This constraint forces all variables to have different values.
- Parameters
-
variables a list of integer variables
- Returns
- an instance of the Constraint class
Definition at line 268 of file CpModel.java.
◆ addAllowedAssignments() [1/2]
Constraint addAllowedAssignments | ( | IntVar[] | variables, |
int | tuplesList[][] | ||
) |
◆ addAllowedAssignments() [2/2]
Constraint addAllowedAssignments | ( | IntVar[] | variables, |
long | tuplesList[][] | ||
) |
Adds.
.
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.
- Parameters
-
variables a list of variables tuplesList a list of admissible tuples. Each tuple must have the same length as the variables, and the ith value of a tuple corresponds to the ith variable.
- Returns
- an instance of the Constraint class
- Exceptions
-
WrongLength if one tuple does not have the same length as the variables
Definition at line 363 of file CpModel.java.
◆ addAssumption()
void addAssumption | ( | Literal | lit | ) |
Adds a literal to the model as assumption.
Definition at line 994 of file CpModel.java.
◆ addAssumptions()
void addAssumptions | ( | Literal[] | literals | ) |
Adds multiple literals to the model as assumptions.
Definition at line 999 of file CpModel.java.
◆ addAutomaton()
Constraint addAutomaton | ( | IntVar[] | transitionVariables, |
long | startingState, | ||
long[] | finalStates, | ||
long | transitions[][] | ||
) |
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. 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.
- Parameters
-
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 transitions a list of transition for the automaton, in the following format (currentState, variableValue, nextState)
- Returns
- an instance of the Constraint class
- Exceptions
-
WrongLength if one transition does not have a length of 3
Definition at line 468 of file CpModel.java.
◆ addBoolAnd()
Constraint addBoolAnd | ( | Literal[] | literals | ) |
◆ addBoolOr()
Constraint addBoolOr | ( | Literal[] | literals | ) |
◆ addBoolXor()
Constraint addBoolXor | ( | Literal[] | literals | ) |
◆ addCircuit()
Constraint addCircuit | ( | int[] | tails, |
int[] | heads, | ||
Literal[] | literals | ||
) |
Adds.
.
Adds a circuit constraint from a sparse list of arcs that encode the graph.
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
associated with a true literal. Otherwise this constraint will fail.
- Parameters
-
tails the tails of all arcs heads the heads of all arcs literals the literals that control whether an arc is selected or not
- Returns
- an instance of the Constraint class
- Exceptions
-
MismatchedArrayLengths if the arrays have different sizes
Definition at line 328 of file CpModel.java.
◆ addCumulative() [1/6]
Constraint addCumulative | ( | IntervalVar[] | intervals, |
int[] | demands, | ||
IntVar | capacity | ||
) |
Adds.
with fixed demands.
- See also
- addCumulative(IntervalVar[], IntVar[], IntVar) AddCumulative
Definition at line 933 of file CpModel.java.
◆ addCumulative() [2/6]
Constraint addCumulative | ( | IntervalVar[] | intervals, |
int[] | demands, | ||
long | capacity | ||
) |
Adds.
with fixed demands and fixed capacity.
- See also
- addCumulative(IntervalVar[], IntVar[], IntVar) AddCumulative
Definition at line 978 of file CpModel.java.
◆ addCumulative() [3/6]
Constraint addCumulative | ( | IntervalVar[] | intervals, |
IntVar[] | demands, | ||
IntVar | capacity | ||
) |
Adds.
.
This constraint enforces that:
.
- Parameters
-
intervals the list of intervals demands the list of demands for each interval. Each demand must be a positive integer variable. capacity the maximum capacity of the cumulative constraint. It must be a positive integer variable.
- Returns
- an instance of the Constraint class
Definition at line 897 of file CpModel.java.
◆ addCumulative() [4/6]
Constraint addCumulative | ( | IntervalVar[] | intervals, |
IntVar[] | demands, | ||
long | capacity | ||
) |
Adds.
with fixed capacity.
- See also
- addCumulative(IntervalVar[], IntVar[], IntVar) AddCumulative
Definition at line 942 of file CpModel.java.
◆ addCumulative() [5/6]
Constraint addCumulative | ( | IntervalVar[] | intervals, |
long[] | demands, | ||
IntVar | capacity | ||
) |
Adds.
with fixed demands.
- See also
- addCumulative(IntervalVar[], IntVar[], IntVar) AddCumulative
Definition at line 915 of file CpModel.java.
◆ addCumulative() [6/6]
Constraint addCumulative | ( | IntervalVar[] | intervals, |
long[] | demands, | ||
long | capacity | ||
) |
Adds.
with fixed demands and fixed capacity.
- See also
- addCumulative(IntervalVar[], IntVar[], IntVar) AddCumulative
Definition at line 960 of file CpModel.java.
◆ addDecisionStrategy()
void addDecisionStrategy | ( | IntVar[] | variables, |
DecisionStrategyProto.VariableSelectionStrategy | varStr, | ||
DecisionStrategyProto.DomainReductionStrategy | domStr | ||
) |
◆ addDifferent() [1/2]
Constraint addDifferent | ( | IntVar | left, |
IntVar | right | ||
) |
◆ addDifferent() [2/2]
Constraint addDifferent | ( | LinearExpr | expr, |
long | value | ||
) |
◆ addDifferentWithOffset()
Constraint addDifferentWithOffset | ( | IntVar | left, |
IntVar | right, | ||
long | offset | ||
) |
◆ addDivisionEquality()
Constraint addDivisionEquality | ( | IntVar | target, |
IntVar | num, | ||
IntVar | denom | ||
) |
◆ addElement() [1/3]
Constraint addElement | ( | IntVar | index, |
int[] | values, | ||
IntVar | target | ||
) |
◆ addElement() [2/3]
Constraint addElement | ( | IntVar | index, |
IntVar[] | variables, | ||
IntVar | target | ||
) |
Adds the element constraint:
.
Definition at line 278 of file CpModel.java.
◆ addElement() [3/3]
Constraint addElement | ( | IntVar | index, |
long[] | values, | ||
IntVar | target | ||
) |
◆ addEquality() [1/2]
Constraint addEquality | ( | LinearExpr | expr, |
long | value | ||
) |
◆ addEquality() [2/2]
Constraint addEquality | ( | LinearExpr | left, |
LinearExpr | right | ||
) |
◆ addEqualityWithOffset()
Constraint addEqualityWithOffset | ( | LinearExpr | left, |
LinearExpr | right, | ||
long | offset | ||
) |
◆ addForbiddenAssignments() [1/2]
Constraint addForbiddenAssignments | ( | IntVar[] | variables, |
int | tuplesList[][] | ||
) |
◆ addForbiddenAssignments() [2/2]
Constraint addForbiddenAssignments | ( | IntVar[] | variables, |
long | tuplesList[][] | ||
) |
Adds.
.
A ForbiddenAssignments constraint is a constraint on an array of variables where the list of impossible combinations is provided in the tuples list.
- Parameters
-
variables a list of variables tuplesList a list of forbidden tuples. Each tuple must have the same length as the variables, and the ith value of a tuple corresponds to the ith variable.
- Returns
- an instance of the Constraint class
- Exceptions
-
WrongLength if one tuple does not have the same length as the variables
Definition at line 418 of file CpModel.java.
◆ addGreaterOrEqual() [1/2]
Constraint addGreaterOrEqual | ( | LinearExpr | expr, |
long | value | ||
) |
◆ addGreaterOrEqual() [2/2]
Constraint addGreaterOrEqual | ( | LinearExpr | left, |
LinearExpr | right | ||
) |
◆ addGreaterOrEqualWithOffset()
Constraint addGreaterOrEqualWithOffset | ( | LinearExpr | left, |
LinearExpr | right, | ||
long | offset | ||
) |
◆ addGreaterThan() [1/2]
Constraint addGreaterThan | ( | LinearExpr | expr, |
long | value | ||
) |
◆ addGreaterThan() [2/2]
Constraint addGreaterThan | ( | LinearExpr | left, |
LinearExpr | right | ||
) |
◆ addHint()
void addHint | ( | IntVar | var, |
long | value | ||
) |
Adds hinting to a variable.
Definition at line 983 of file CpModel.java.
◆ addImplication()
Constraint addImplication | ( | Literal | a, |
Literal | b | ||
) |
◆ addInverse()
Constraint addInverse | ( | IntVar[] | variables, |
IntVar[] | inverseVariables | ||
) |
Adds.
.
An inverse constraint enforces that if 'variables[i]' is assigned a value 'j', then inverseVariables[j] is assigned a value 'i'. And vice versa.
- Parameters
-
variables an array of integer variables inverseVariables an array of integer variables
- Returns
- an instance of the Constraint class
- Exceptions
-
MismatchedArrayLengths if variables and inverseVariables have different length
Definition at line 499 of file CpModel.java.
◆ addLessOrEqual() [1/2]
Constraint addLessOrEqual | ( | LinearExpr | expr, |
long | value | ||
) |
◆ addLessOrEqual() [2/2]
Constraint addLessOrEqual | ( | LinearExpr | left, |
LinearExpr | right | ||
) |
◆ addLessOrEqualWithOffset()
Constraint addLessOrEqualWithOffset | ( | LinearExpr | left, |
LinearExpr | right, | ||
long | offset | ||
) |
◆ addLessThan() [1/2]
Constraint addLessThan | ( | LinearExpr | expr, |
long | value | ||
) |
◆ addLessThan() [2/2]
Constraint addLessThan | ( | LinearExpr | left, |
LinearExpr | right | ||
) |
◆ addLinearConstraint()
Constraint addLinearConstraint | ( | LinearExpr | expr, |
long | lb, | ||
long | ub | ||
) |
◆ addLinearExpressionInDomain()
Constraint addLinearExpressionInDomain | ( | LinearExpr | expr, |
Domain | domain | ||
) |
◆ addMapDomain()
Adds.
.
Definition at line 639 of file CpModel.java.
◆ addMaxEquality()
Constraint addMaxEquality | ( | IntVar | target, |
IntVar[] | vars | ||
) |
◆ addMinEquality()
Constraint addMinEquality | ( | IntVar | target, |
IntVar[] | vars | ||
) |
◆ addModuloEquality() [1/2]
Constraint addModuloEquality | ( | IntVar | target, |
IntVar | var, | ||
IntVar | mod | ||
) |
◆ addModuloEquality() [2/2]
Constraint addModuloEquality | ( | IntVar | target, |
IntVar | var, | ||
long | mod | ||
) |
◆ addNoOverlap()
Constraint addNoOverlap | ( | IntervalVar[] | intervalVars | ) |
Adds.
.
A NoOverlap constraint ensures that all present intervals do not overlap in time.
- Parameters
-
intervalVars the list of interval variables to constrain
- Returns
- an instance of the Constraint class
Definition at line 850 of file CpModel.java.
◆ addNoOverlap2D()
Constraint addNoOverlap2D | ( | IntervalVar[] | xIntervals, |
IntervalVar[] | yIntervals | ||
) |
Adds.
.
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.
- Parameters
-
xIntervals the X coordinates of the rectangles yIntervals the Y coordinates of the rectangles
- Returns
- an instance of the Constraint class
Definition at line 870 of file CpModel.java.
◆ addProductEquality()
Constraint addProductEquality | ( | IntVar | target, |
IntVar[] | vars | ||
) |
◆ addReservoirConstraint() [1/2]
Constraint addReservoirConstraint | ( | IntVar[] | times, |
int[] | demands, | ||
long | minLevel, | ||
long | maxLevel | ||
) |
Adds.
.
- See also
- addReservoirConstraint(IntVar[], long[], long, long) Reservoir
Definition at line 565 of file CpModel.java.
◆ addReservoirConstraint() [2/2]
Constraint addReservoirConstraint | ( | IntVar[] | times, |
long[] | demands, | ||
long | minLevel, | ||
long | maxLevel | ||
) |
Adds.
.
Maintains a reservoir level within bounds. The water level starts at 0, and at any times, it must be between minLevel and maxLevel. If the variable
is assigned a value t, and if
is true, then the current level changes by
(which is constant) at the time t.
Note that
must be less than 0, and
must be greater than 0. Therefore,
.
- Parameters
-
times a list of integer variables which specify the time of the filling or emptying the reservoir demands a list of integer values that specifies the amount of the emptying or feeling 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.
- Returns
- an instance of the Constraint class
- Exceptions
-
MismatchedArrayLengths if times and demands have different length IllegalArgumentException if minLevel > 0 IllegalArgumentException if maxLevel < 0
Definition at line 537 of file CpModel.java.
◆ addReservoirConstraintWithActive() [1/2]
Constraint addReservoirConstraintWithActive | ( | IntVar[] | times, |
int[] | demands, | ||
IntVar[] | actives, | ||
long | minLevel, | ||
long | maxLevel | ||
) |
Adds.
.
- See also
- addReservoirConstraintWithActive(IntVar[], long[], IntVar[], long, long) Reservoir
Definition at line 632 of file CpModel.java.
◆ addReservoirConstraintWithActive() [2/2]
Constraint addReservoirConstraintWithActive | ( | IntVar[] | times, |
long[] | demands, | ||
IntVar[] | actives, | ||
long | minLevel, | ||
long | maxLevel | ||
) |
Adds.
.
Maintains a reservoir level within bounds. The water level starts at 0, and at any time, it must be between minLevel and maxLevel. If the variable
is assigned a value t, then the current level changes by
(which is constant) at the time t.
Note that
must be less than 0, and
must be greater than 0. Therefore,
.
- Parameters
-
times a list of integer variables which specify the time of the filling or emptying the reservoir demands a list of integer values that specifies the amount of the emptying or feeling 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.
- Returns
- an instance of the Constraint class
- Exceptions
-
MismatchedArrayLengths if times, demands, or actives have different length IllegalArgumentException if minLevel > 0 IllegalArgumentException if maxLevel < 0
Definition at line 593 of file CpModel.java.
◆ clearAssumptions()
void clearAssumptions | ( | ) |
Remove all assumptions from the model.
Definition at line 1006 of file CpModel.java.
◆ clearHints()
void clearHints | ( | ) |
Remove all solution hints.
Definition at line 989 of file CpModel.java.
◆ exportToFile()
Boolean exportToFile | ( | String | file | ) |
Write the model as a ascii protocol buffer to 'file'.
Definition at line 1055 of file CpModel.java.
◆ falseLiteral()
Literal falseLiteral | ( | ) |
Returns the false literal.
Definition at line 106 of file CpModel.java.
◆ getBuilder()
CpModelProto.Builder getBuilder | ( | ) |
Returns the model builder.
Definition at line 1086 of file CpModel.java.
◆ maximize()
void maximize | ( | LinearExpr | expr | ) |
Adds a maximization objective of a linear expression.
Definition at line 1022 of file CpModel.java.
◆ minimize()
void minimize | ( | LinearExpr | expr | ) |
Adds a minimization objective of a linear expression.
Definition at line 1013 of file CpModel.java.
◆ model()
CpModelProto model | ( | ) |
Definition at line 1077 of file CpModel.java.
◆ modelStats()
String modelStats | ( | ) |
Returns some statistics on model as a string.
Definition at line 1045 of file CpModel.java.
◆ negated()
int negated | ( | int | index | ) |
Definition at line 1081 of file CpModel.java.
◆ newBoolVar()
IntVar newBoolVar | ( | String | name | ) |
Creates a Boolean variable with the given name.
Definition at line 86 of file CpModel.java.
◆ newConstant()
IntVar newConstant | ( | long | value | ) |
Creates a constant variable.
Definition at line 91 of file CpModel.java.
◆ newFixedInterval()
IntervalVar newFixedInterval | ( | long | start, |
long | size, | ||
String | name | ||
) |
Creates a fixed interval from its start and its size.
Definition at line 774 of file CpModel.java.
◆ newIntervalVar() [1/4]
IntervalVar newIntervalVar | ( | IntVar | start, |
IntVar | size, | ||
IntVar | end, | ||
String | name | ||
) |
Creates an interval variable from start, size, and end.
An interval variable is a constraint, that is itself used in other constraints like NoOverlap.
Internally, it ensures that
.
- Parameters
-
start the start of the interval size the size of the interval end the end of the interval name the name of the interval variable
- Returns
- An IntervalVar object
Definition at line 739 of file CpModel.java.
◆ newIntervalVar() [2/4]
IntervalVar newIntervalVar | ( | IntVar | start, |
IntVar | size, | ||
long | end, | ||
String | name | ||
) |
Creates an interval variable with a fixed end.
Definition at line 748 of file CpModel.java.
◆ newIntervalVar() [3/4]
IntervalVar newIntervalVar | ( | IntVar | start, |
long | size, | ||
IntVar | end, | ||
String | name | ||
) |
Creates an interval variable with a fixed size.
Definition at line 758 of file CpModel.java.
◆ newIntervalVar() [4/4]
IntervalVar newIntervalVar | ( | long | start, |
IntVar | size, | ||
IntVar | end, | ||
String | name | ||
) |
Creates an interval variable with a fixed start.
Definition at line 768 of file CpModel.java.
◆ newIntVar()
IntVar newIntVar | ( | long | lb, |
long | ub, | ||
String | name | ||
) |
Creates an integer variable with domain [lb, ub].
Definition at line 70 of file CpModel.java.
◆ newIntVarFromDomain()
Creates an integer variable with given domain.
- Parameters
-
domain an instance of the Domain class. name the name of the variable
- Returns
- a variable with the given domain.
Definition at line 81 of file CpModel.java.
◆ newOptionalFixedInterval()
IntervalVar newOptionalFixedInterval | ( | long | start, |
long | size, | ||
Literal | isPresent, | ||
String | name | ||
) |
Creates an optional fixed interval from start and size.
Definition at line 836 of file CpModel.java.
◆ newOptionalIntervalVar() [1/4]
IntervalVar newOptionalIntervalVar | ( | IntVar | start, |
IntVar | size, | ||
IntVar | end, | ||
Literal | isPresent, | ||
String | name | ||
) |
Creates an optional interval variable from 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
literal that indicates if it is active or not.
Internally, it ensures that
.
- Parameters
-
start the start of the interval. It can be an integer value, or an integer variable. size the size of the interval. It can be an integer value, or an integer variable. end the end of the interval. It can be an integer value, or an integer variable. 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
- Returns
- an IntervalVar object
Definition at line 796 of file CpModel.java.
◆ newOptionalIntervalVar() [2/4]
IntervalVar newOptionalIntervalVar | ( | IntVar | start, |
IntVar | size, | ||
long | end, | ||
Literal | isPresent, | ||
String | name | ||
) |
Creates an optional interval with a fixed end.
Definition at line 807 of file CpModel.java.
◆ newOptionalIntervalVar() [3/4]
IntervalVar newOptionalIntervalVar | ( | IntVar | start, |
long | size, | ||
IntVar | end, | ||
Literal | isPresent, | ||
String | name | ||
) |
Creates an optional interval with a fixed size.
Definition at line 818 of file CpModel.java.
◆ newOptionalIntervalVar() [4/4]
IntervalVar newOptionalIntervalVar | ( | long | start, |
IntVar | size, | ||
IntVar | end, | ||
Literal | isPresent, | ||
String | name | ||
) |
Creates an optional interval with a fixed start.
Definition at line 825 of file CpModel.java.
◆ trueLiteral()
Literal trueLiteral | ( | ) |
Returns the true literal.
Definition at line 101 of file CpModel.java.
◆ validate()
String validate | ( | ) |
Returns a non empty string explaining the issue if the model is invalid.
Definition at line 1050 of file CpModel.java.
The documentation for this class was generated from the following file: