public class IntConstraintFactory extends Object
Note that, for the sack of readability, the Java naming convention is not respected for methods arguments.
Constraints are ordered as the following: 1) Unary constraints 2) Binary constraints 3) Terary constraints 4) Global constraints
Modifier and Type | Method and Description |
---|---|
static Constraint |
absolute(IntVar VAR1,
IntVar VAR2)
Enforces VAR1 = |VAR2|
|
static Constraint |
alldifferent_conditionnal(IntVar[] VARS,
Condition CONDITION)
Alldifferent holds on the subset of VARS which satisfies the given CONDITION
|
static Constraint |
alldifferent_conditionnal(IntVar[] VARS,
Condition CONDITION,
boolean AC)
Alldifferent holds on the subset of VARS which satisfies the given CONDITION
|
static Constraint |
alldifferent_except_0(IntVar[] VARS)
Variables in VARS must either be different or equal to 0
|
static Constraint |
alldifferent(IntVar[] VARS)
Ensures that all variables from VARS take a different value.
|
static Constraint |
alldifferent(IntVar[] VARS,
String CONSISTENCY)
Ensures that all variables from VARS take a different value.
|
static Constraint |
among(IntVar NVAR,
IntVar[] VARS,
int[] VALUES)
NVAR is the number of variables of the collection VARIABLES that take their value in VALUES.
|
static Constraint |
arithm(IntVar VAR,
String OP,
int CSTE)
Ensures: VAR OP CSTE, where OP in {"=", "!
|
static Constraint |
arithm(IntVar VAR1,
String OP,
IntVar VAR2)
Ensures: VAR1 OP VAR2, where OP in {"=", "!
|
static Constraint |
arithm(IntVar VAR1,
String OP1,
IntVar VAR2,
String OP2,
int CSTE)
Ensures: VAR1 OP VAR2, where OP in {"=", "!
|
static Constraint |
atleast_nvalues(IntVar[] VARS,
IntVar NVALUES,
boolean AC)
Let N be the number of distinct values assigned to the variables of the VARS collection.
|
static Constraint |
atmost_nvalues(IntVar[] VARS,
IntVar NVALUES,
boolean STRONG)
Let N be the number of distinct values assigned to the variables of the VARS collection.
|
static Constraint[] |
bin_packing(IntVar[] ITEM_BIN,
int[] ITEM_SIZE,
IntVar[] BIN_LOAD,
int OFFSET)
Bin Packing formulation:
forall b in [0,BIN_LOAD.length-1],
BIN_LOAD[b]=sum(ITEM_SIZE[i] | i in [0,ITEM_SIZE.length-1], ITEM_BIN[i] = b+OFFSET
forall i in [0,ITEM_SIZE.length-1], ITEM_BIN is in [OFFSET,BIN_LOAD.length-1+OFFSET],
|
static Constraint |
bit_channeling(BoolVar[] BITS,
IntVar VAR)
Ensures that VAR = 20*BIT_1 + 21*BIT_2 + ... 2n-1*BIT_n.
|
static Constraint |
boolean_channeling(BoolVar[] BVARS,
IntVar VAR,
int OFFSET)
Maps the boolean assignments variables BVARS with the standard assignment variable VAR.
|
static Constraint |
circuit(IntVar[] VARS,
int OFFSET)
Creates a circuit constraint which ensures that
the elements of vars define a covering circuit
where VARS[i] = OFFSET+j means that j is the successor of i.
|
static Constraint |
circuit(IntVar[] VARS,
int OFFSET,
CircuitConf CONF)
Creates a circuit constraint which ensures that
the elements of vars define a covering circuit
where VARS[i] = OFFSET+j means that j is the successor of i.
|
static Constraint |
clause_channeling(IntVar VAR,
BoolVar[] EVARS,
BoolVar[] LVARS)
Link each value from the domain of VAR to two boolean variable:
one reifies the equality to the i^th value of the variable domain,
the other reifies the less-or-equality to the i^th value of the variable domain.
|
static Constraint |
cost_regular(IntVar[] VARS,
IntVar COST,
ICostAutomaton CAUTOMATON)
Ensures that the assignment of a sequence of variables is recognized by CAUTOMATON, a deterministic finite automaton,
and that the sum of the costs associated to each assignment is bounded by the cost variable.
|
static Constraint |
count(int VALUE,
IntVar[] VARS,
IntVar LIMIT)
Let N be the number of variables of the VARIABLES collection assigned to value VALUE;
Enforce condition N = LIMIT to hold.
|
static Constraint |
count(IntVar VALUE,
IntVar[] VARS,
IntVar LIMIT)
Let N be the number of variables of the VARIABLES collection assigned to value VALUE;
Enforce condition N = LIMIT to hold.
|
static Constraint |
cumulative(Task[] TASKS,
IntVar[] HEIGHTS,
IntVar CAPACITY)
Cumulative constraint: Enforces that at each point in time,
the cumulated height of the set of tasks that overlap that point
does not exceed a given limit.
|
static Constraint |
cumulative(Task[] TASKS,
IntVar[] HEIGHTS,
IntVar CAPACITY,
boolean INCREMENTAL)
Cumulative constraint: Enforces that at each point in time,
the cumulated height of the set of tasks that overlap that point
does not exceed a given limit.
|
static Constraint[] |
diffn(IntVar[] X,
IntVar[] Y,
IntVar[] WIDTH,
IntVar[] HEIGHT,
boolean USE_CUMUL)
Constrains each rectanglei, given by their origins Xi,Yi
and sizes WIDTHi,HEIGHTi, to be non-overlapping.
|
static Constraint |
distance(IntVar VAR1,
IntVar VAR2,
String OP,
int CSTE)
Ensures:
|VAR1-VAR2| OP CSTE where OP can take its value among {"=", ">", "<", "! |
static Constraint |
distance(IntVar VAR1,
IntVar VAR2,
String OP,
IntVar VAR3)
Ensures:
|VAR1-VAR2| OP VAR3 where OP can take its value among {"=", ">", "<"} |
static Constraint |
element(IntVar VALUE,
int[] TABLE,
IntVar INDEX)
Build ELEMENT constraint: VALUE = TABLE[INDEX]
|
static Constraint |
element(IntVar VALUE,
int[] TABLE,
IntVar INDEX,
int OFFSET,
String SORT)
Build ELEMENT constraint: VALUE = TABLE[INDEX-OFFSET]
|
static Constraint |
element(IntVar VALUE,
IntVar[] TABLE,
IntVar INDEX,
int OFFSET)
Build an ELEMENT constraint: VALUE = TABLE[INDEX-OFFSET] where TABLE is an array of variables.
|
static Constraint |
eucl_div(IntVar DIVIDEND,
IntVar DIVISOR,
IntVar RESULT)
Ensures DIVIDEND / DIVISOR = RESULT, rounding towards 0 -- Euclidean division
Also ensures DIVISOR !
|
static Constraint |
FALSE(Solver solver)
Ensures the FALSE constraint
|
static gnu.trove.list.array.TIntArrayList |
getDomainUnion(IntVar[] vars) |
static Constraint |
global_cardinality(IntVar[] VARS,
int[] VALUES,
IntVar[] OCCURRENCES,
boolean CLOSED)
Global Cardinality constraint (GCC):
Each value VALUES[i] should be taken by exactly OCCURRENCES[i] variables of VARS.
|
static Constraint |
inverse_channeling(IntVar[] VARS1,
IntVar[] VARS2,
int OFFSET1,
int OFFSET2)
Make an inverse channeling between VARS1 and VARS2:
VARS1[i-OFFSET2] = j <=> VARS2[j-OFFSET1] = i
Performs AC if domains are enumerated.
|
static Constraint |
knapsack(IntVar[] OCCURRENCES,
IntVar TOTAL_WEIGHT,
IntVar TOTAL_ENERGY,
int[] WEIGHT,
int[] ENERGY)
Ensures that :
- OCCURRENCES[i] * WEIGHT[i] ≤ TOTAL_WEIGHT - OCCURRENCES[i] * ENERGY[i] = TOTAL_ENERGY and maximizing the value of TOTAL_ENERGY. |
static Constraint |
lex_chain_less_eq(IntVar[]... VARS)
For each pair of consecutive vectors VARSi and VARSi+1 of the VARS collection
VARSi is lexicographically less or equal than than VARSi+1
|
static Constraint |
lex_chain_less(IntVar[]... VARS)
For each pair of consecutive vectors VARSi and VARSi+1 of the VARS collection
VARSi is lexicographically strictly less than than VARSi+1
|
static Constraint |
lex_less_eq(IntVar[] VARS1,
IntVar[] VARS2)
Ensures that VARS1 is lexicographically less or equal than VARS2.
|
static Constraint |
lex_less(IntVar[] VARS1,
IntVar[] VARS2)
Ensures that VARS1 is lexicographically strictly less than VARS2.
|
static Constraint |
maximum(BoolVar MAX,
BoolVar[] VARS)
MAX is the maximum value of the collection of boolean variables VARS
|
static Constraint |
maximum(IntVar MAX,
IntVar[] VARS)
MAX is the maximum value of the collection of domain variables VARS
|
static Constraint |
maximum(IntVar MAX,
IntVar VAR1,
IntVar VAR2)
Ensures: MAX = MAX(VAR1, VAR2)
(Bound Consistency)
|
static Constraint |
mddc(IntVar[] VARS,
MultivaluedDecisionDiagram MDD)
Create a constraint where solutions (tuples) are encoded by a multi-valued decision diagram.
|
static Constraint |
member(IntVar VAR,
int[] TABLE)
Ensures VAR takes its values in TABLE
|
static Constraint |
member(IntVar VAR,
int LB,
int UB)
Ensures VAR takes its values in [LB, UB]
|
static Constraint |
minimum(BoolVar MIN,
BoolVar[] VARS)
MIN is the minimum value of the collection of boolean variables VARS
|
static Constraint |
minimum(IntVar MIN,
IntVar[] VARS)
MIN is the minimum value of the collection of domain variables VARS
|
static Constraint |
minimum(IntVar MIN,
IntVar VAR1,
IntVar VAR2)
Ensures: VAR1 = MIN(VAR2, VAR3)
(Bound Consistency)
|
static Constraint |
mod(IntVar X,
IntVar Y,
IntVar Z)
Ensures X % Y = Z,
i.e. |
static Constraint |
multicost_regular(IntVar[] VARS,
IntVar[] CVARS,
ICostAutomaton CAUTOMATON)
Ensures that the assignment of a sequence of VARS is recognized by CAUTOMATON, a deterministic finite automaton,
and that the sum of the cost vector COSTS associated to each assignment is bounded by the variable vector CVARS.
|
static Constraint |
not_member(IntVar VAR,
int[] TABLE)
Ensures VAR does not take its values in TABLE
|
static Constraint |
not_member(IntVar VAR,
int LB,
int UB)
Ensures VAR does not take its values in [LB, UB]
|
static Constraint[] |
nvalues(IntVar[] VARS,
IntVar NVALUES)
Let N be the number of distinct values assigned to the variables of the VARS collection.
|
static Constraint[] |
path(IntVar[] VARS,
IntVar START,
IntVar END,
int OFFSET)
Creates a path constraint which ensures that
the elements of VARS define a covering path from START to END
where VARS[i] = OFFSET+j means that j is the successor of i.
|
static Constraint |
regular(IntVar[] VARS,
IAutomaton AUTOMATON)
Enforces the sequence of VARS to be a word
recognized by the deterministic finite automaton AUTOMATON.
|
static Constraint |
scalar(IntVar[] VARS,
int[] COEFFS,
IntVar SCALAR)
Enforces that ∑i in |VARS|COEFFSi * VARSi = SCALAR.
|
static Constraint |
scalar(IntVar[] VARS,
int[] COEFFS,
String OPERATOR,
IntVar SCALAR)
A scalar constraint which ensures that Sum(VARS[i]*COEFFS[i]) OPERATOR SCALAR
|
static Constraint |
sort(IntVar[] VARS,
IntVar[] SORTEDVARS)
Creates a sort constraint which ensures that the variables of SORTEDVARS correspond to the variables
of VARS according to a permutation.
|
static Constraint |
square(IntVar VAR1,
IntVar VAR2)
Enforces VAR1 = VAR2^2
|
static Constraint |
subcircuit(IntVar[] VARS,
int OFFSET,
IntVar SUBCIRCUIT_SIZE)
Creates a subcircuit constraint which ensures that
the elements of vars define a single circuit of subcircuitSize nodes where
VARS[i] = OFFSET+j means that j is the successor of i.
|
static Constraint[] |
subpath(IntVar[] VARS,
IntVar START,
IntVar END,
int OFFSET,
IntVar SIZE)
Creates a subpath constraint which ensures that
the elements of VARS define a path of SIZE vertices, leading from START to END
where VARS[i] = OFFSET+j means that j is the successor of i.
|
static Constraint |
sum(BoolVar[] VARS,
IntVar SUM)
Enforces that ∑i in |VARS|VARSi = SUM.
|
static Constraint |
sum(BoolVar[] VARS,
String OPERATOR,
IntVar SUM)
Enforces that ∑i in |VARS|VARSi OPERATOR SUM.
|
static Constraint |
sum(IntVar[] VARS,
IntVar SUM)
Enforces that ∑i in |VARS|VARSi = SUM.
|
static Constraint |
sum(IntVar[] VARS,
String OPERATOR,
IntVar SUM)
Enforces that ∑i in |VARS|VARSi OPERATOR SUM.
|
static Constraint |
table(IntVar[] VARS,
Tuples TUPLES,
String ALGORITHM)
Create a table constraint, with the specified algorithm defined ALGORITHM
- GAC2001: Arc Consistency version 2001 for tuples,
- GAC2001+: Arc Consistency version 2001 for allowed tuples, - GAC3rm: Arc Consistency version AC3 rm for tuples, - GAC3rm+ (default): Arc Consistency version 3rm for allowed tuples, - GACSTR+: Arc Consistency version STR for allowed tuples, - STR2+: Arc Consistency version STR2 for allowed tuples, - FC: Forward Checking. |
static Constraint |
table(IntVar VAR1,
IntVar VAR2,
Tuples TUPLES,
String ALGORITHM)
Create a table constraint over a couple of variables VAR1 and VAR2:
- AC2001: table constraint which applies the AC2001 algorithm, - AC3: table constraint which applies the AC3 algorithm, - AC3rm: table constraint which applies the AC3 rm algorithm, - AC3bit+rm (default): table constraint which applies the AC3 bit+rm algorithm, - FC: table constraint which applies forward checking algorithm. |
static Constraint |
times(IntVar X,
int Y,
IntVar Z)
Ensures: X * Y = Z
|
static Constraint |
times(IntVar X,
IntVar Y,
IntVar Z)
Ensures: X * Y = Z
|
static Constraint |
tree(IntVar[] SUCCS,
IntVar NBTREES,
int OFFSET)
Partition SUCCS variables into NBTREES (anti) arborescences
SUCCS[i] = OFFSET+j means that j is the successor of i.
|
static Constraint |
TRUE(Solver solver)
Ensures the TRUE constraint
|
static Constraint[] |
tsp(IntVar[] SUCCS,
IntVar COST,
int[][] COST_MATRIX)
A constraint for the Traveling Salesman Problem :
Enforces SUCCS to form a hamiltonian circuit of value COST
|
static boolean |
tupleIt(IntVar... VARS)
Check whether the intension constraint to extension constraint substitution is enabled and can be achieved
|
public static Constraint TRUE(Solver solver)
solver
- a solverpublic static Constraint FALSE(Solver solver)
solver
- a solverpublic static Constraint arithm(IntVar VAR, String OP, int CSTE)
VAR
- a variableOP
- an operatorCSTE
- a constantpublic static Constraint member(IntVar VAR, int[] TABLE)
VAR
- an integer variableTABLE
- an array of valuespublic static Constraint member(IntVar VAR, int LB, int UB)
VAR
- an integer variableLB
- the lower bound of the intervalUB
- the upper bound of the intervalpublic static Constraint not_member(IntVar VAR, int[] TABLE)
VAR
- an integer variableTABLE
- an array of valuespublic static Constraint not_member(IntVar VAR, int LB, int UB)
VAR
- an integer variableLB
- the lower bound of the intervalUB
- the upper bound of the intervalpublic static Constraint absolute(IntVar VAR1, IntVar VAR2)
public static Constraint arithm(IntVar VAR1, String OP, IntVar VAR2)
VAR1
- first variableOP
- an operatorVAR2
- second variablepublic static Constraint arithm(IntVar VAR1, String OP1, IntVar VAR2, String OP2, int CSTE)
VAR1
- first variableOP1
- an operatorVAR2
- second variableOP2
- another operatorCSTE
- an operatorpublic static Constraint distance(IntVar VAR1, IntVar VAR2, String OP, int CSTE)
public static Constraint element(IntVar VALUE, int[] TABLE, IntVar INDEX, int OFFSET, String SORT)
VALUE
- an integer variable taking its value in TABLETABLE
- an array of integer valuesINDEX
- an integer variable representing the value of VALUE in TABLEOFFSET
- offset matching INDEX.LB and TABLE[0] (Generally 0)SORT
- defines ordering properties of TABLE:
"none" if TABLE is not sorted
"asc" if TABLE is sorted in the increasing order
"desc" if TABLE is sorted in the decreasing order
"detect" Let the constraint detects the ordering of TABLE, if anypublic static Constraint element(IntVar VALUE, int[] TABLE, IntVar INDEX)
VALUE
- an integer variable taking its value in TABLETABLE
- an array of integer valuesINDEX
- an integer variable representing the value of VALUE in TABLEpublic static Constraint square(IntVar VAR1, IntVar VAR2)
public static Constraint table(IntVar VAR1, IntVar VAR2, Tuples TUPLES, String ALGORITHM)
VAR1
- first variableVAR2
- second variableTUPLES
- the relation between the two variables, among {"AC3", "AC3rm", "AC3bit+rm", "AC2001", "FC"}public static Constraint distance(IntVar VAR1, IntVar VAR2, String OP, IntVar VAR3)
VAR1
- first variableVAR2
- second variableOP
- an operatorVAR3
- resulting variablepublic static Constraint eucl_div(IntVar DIVIDEND, IntVar DIVISOR, IntVar RESULT)
DIVIDEND
- dividendDIVISOR
- divisorRESULT
- resultpublic static Constraint maximum(IntVar MAX, IntVar VAR1, IntVar VAR2)
MAX
- a variableVAR1
- a variableVAR2
- a variablepublic static Constraint minimum(IntVar MIN, IntVar VAR1, IntVar VAR2)
MIN
- resultVAR1
- resultVAR2
- first variablepublic static Constraint mod(IntVar X, IntVar Y, IntVar Z)
X
- first variableY
- second variableZ
- resultpublic static Constraint times(IntVar X, IntVar Y, IntVar Z)
X
- first variableY
- second variableZ
- result variablepublic static Constraint times(IntVar X, int Y, IntVar Z)
X
- first variableY
- a constantZ
- result variablepublic static Constraint alldifferent(IntVar[] VARS)
VARS
- list of variablespublic static Constraint alldifferent(IntVar[] VARS, String CONSISTENCY)
VARS
- list of variablesCONSISTENCY
- consistency level, among {"BC", "AC"}
BC:
Based on: "A Fast and Simple Algorithm for Bounds Consistency of the AllDifferent Constraint"
A. Lopez-Ortiz, CG. Quimper, J. Tromp, P.van Beek
AC:
Uses Regin algorithm
Runs in O(m.n) worst case time for the initial propagation and then in O(n+m) on average.
DEFAULT:
Uses BC plus a probabilistic AC propagator to get a compromise between BC and AC
public static Constraint alldifferent_conditionnal(IntVar[] VARS, Condition CONDITION, boolean AC)
VARS
- collection of variablesCONDITION
- condition defining which variables should be constrainedAC
- specifies is AC filtering should be establishedpublic static Constraint alldifferent_conditionnal(IntVar[] VARS, Condition CONDITION)
VARS
- collection of variablesCONDITION
- condition defining which variables should be constrainedpublic static Constraint alldifferent_except_0(IntVar[] VARS)
VARS
- collection of variablespublic static Constraint among(IntVar NVAR, IntVar[] VARS, int[] VALUES)
NVAR
- a variableVARS
- vector of variablesVALUES
- set of valuespublic static Constraint atleast_nvalues(IntVar[] VARS, IntVar NVALUES, boolean AC)
This embeds a light propagator by default. Additional filtering algorithms can be added.
VARS
- collection of variablesNVALUES
- limit variableAC
- additional filtering algorithm, domain filtering algorithm derivated from (Soft)AllDifferentpublic static Constraint atmost_nvalues(IntVar[] VARS, IntVar NVALUES, boolean STRONG)
This embeds a light propagator by default. Additional filtering algorithms can be added.
VARS
- collection of variablesNVALUES
- limit variableSTRONG
- "AMNVpublic static Constraint[] bin_packing(IntVar[] ITEM_BIN, int[] ITEM_SIZE, IntVar[] BIN_LOAD, int OFFSET)
ITEM_BIN
- IntVar representing the bin of each itemITEM_SIZE
- int representing the size of each itemBIN_LOAD
- IntVar representing the load of each bin (i.e. the sum of the size of the items in it)OFFSET
- 0 by default but typically 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)public static Constraint boolean_channeling(BoolVar[] BVARS, IntVar VAR, int OFFSET)
BVARS
- array of boolean variablesVAR
- observed variable. Should presumably have an enumerated domainOFFSET
- 0 by default but typically 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)public static Constraint bit_channeling(BoolVar[] BITS, IntVar VAR)
BITS
- the array of bitsVAR
- the numeric valuepublic static Constraint clause_channeling(IntVar VAR, BoolVar[] EVARS, BoolVar[] LVARS)
VAR
- an Integer variableEVARS
- array of EQ boolean variablesLVARS
- array of LQ boolean variablespublic static Constraint circuit(IntVar[] VARS, int OFFSET, CircuitConf CONF)
Filtering algorithms:
subtour elimination : Caseau & Laburthe (ICLP'97) allDifferent GAC algorithm: Régin (AAAI'94) dominator-based filtering: Fages & Lorca (CP'11) Strongly Connected Components based filtering (Cambazard & Bourreau JFPC'06 and Fages and Lorca TechReport'12) See Fages PhD Thesis (2014) for more informationVARS
- vector of variables which take their value in [OFFSET,OFFSET+|VARS|-1]OFFSET
- 0 by default but typically 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)CONF
- filtering optionspublic static Constraint circuit(IntVar[] VARS, int OFFSET)
Filtering algorithms:
subtour elimination : Caseau & Laburthe (ICLP'97) allDifferent GAC algorithm: Régin (AAAI'94) dominator-based filtering: Fages & Lorca (CP'11) Strongly Connected Components based filtering (Cambazar & Bourreau JFPC'06 and Fages and Lorca TechReport'12)VARS
- vector of variables which take their value in [OFFSET,OFFSET+|VARS|-1]OFFSET
- 0 by default but typically 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)public static Constraint cost_regular(IntVar[] VARS, IntVar COST, ICostAutomaton CAUTOMATON)
VARS
- sequence of variablesCOST
- cost variableCAUTOMATON
- a deterministic finite automaton defining the regular language and the costs
Can be built with method CostAutomaton.makeSingleResource(...)public static Constraint count(int VALUE, IntVar[] VARS, IntVar LIMIT)
VALUE
- an intVARS
- a vector of variablesLIMIT
- a variablepublic static Constraint count(IntVar VALUE, IntVar[] VARS, IntVar LIMIT)
VALUE
- a variableVARS
- a vector of variablesLIMIT
- a variablepublic static Constraint cumulative(Task[] TASKS, IntVar[] HEIGHTS, IntVar CAPACITY)
TASKS
- TASK objects containing start, duration and end variablesHEIGHTS
- integer variables representing the resource consumption of each taskCAPACITY
- integer variable representing the resource capacitypublic static Constraint cumulative(Task[] TASKS, IntVar[] HEIGHTS, IntVar CAPACITY, boolean INCREMENTAL)
TASKS
- TASK objects containing start, duration and end variablesHEIGHTS
- integer variables representing the resource consumption of each taskCAPACITY
- integer variable representing the resource capacityINCREMENTAL
- specifies if an incremental propagation should be appliedpublic static Constraint[] diffn(IntVar[] X, IntVar[] Y, IntVar[] WIDTH, IntVar[] HEIGHT, boolean USE_CUMUL)
X
- collection of coordinates in first dimensionY
- collection of coordinates in second dimensionWIDTH
- collection of width (each duration should be > 0)HEIGHT
- collection of height (each height should be >= 0)USE_CUMUL
- indicates whether or not redundant cumulative constraints should be put on each dimension (advised)public static Constraint element(IntVar VALUE, IntVar[] TABLE, IntVar INDEX, int OFFSET)
VALUE
- value variableTABLE
- array of variablesINDEX
- index variable in range [OFFSET,OFFSET+|TABLE|-1]OFFSET
- int offset, generally 0public static Constraint global_cardinality(IntVar[] VARS, int[] VALUES, IntVar[] OCCURRENCES, boolean CLOSED)
VARS
- collection of variablesVALUES
- collection of constrained valuesOCCURRENCES
- collection of cardinality variablesCLOSED
- restricts domains of VARS to VALUES if set to truepublic static Constraint inverse_channeling(IntVar[] VARS1, IntVar[] VARS2, int OFFSET1, int OFFSET2)
Beware you should have |VARS1| = |VARS2|
VARS1
- vector of variables which take their value in [OFFSET1,OFFSET1+|VARS2|-1]VARS2
- vector of variables which take their value in [OFFSET2,OFFSET2+|VARS1|-1]OFFSET1
- lowest value in VARS1 (most often 0)OFFSET2
- lowest value in VARS2 (most often 0)public static Constraint knapsack(IntVar[] OCCURRENCES, IntVar TOTAL_WEIGHT, IntVar TOTAL_ENERGY, int[] WEIGHT, int[] ENERGY)
A knapsack constraint
wikipedia:
"Given a set of items, each with a weight and an energy value,
determine the count of each item to include in a collection so that
the total weight is less than or equal to a given limit and the total value is as large as possible.
It derives its name from the problem faced by someone who is constrained by a fixed-size knapsack
and must fill it with the most useful items."
OCCURRENCES
- number of occurrences of an itemTOTAL_WEIGHT
- capacity of the knapsackTOTAL_ENERGY
- variable to maximizeWEIGHT
- weight of each itemENERGY
- energy of each itempublic static Constraint lex_chain_less(IntVar[]... VARS)
VARS
- collection of vectors of variablespublic static Constraint lex_chain_less_eq(IntVar[]... VARS)
VARS
- collection of vectors of variablespublic static Constraint lex_less(IntVar[] VARS1, IntVar[] VARS2)
VARS1
- vector of variablesVARS2
- vector of variablespublic static Constraint lex_less_eq(IntVar[] VARS1, IntVar[] VARS2)
VARS1
- vector of variablesVARS2
- vector of variablespublic static Constraint maximum(IntVar MAX, IntVar[] VARS)
MAX
- a variableVARS
- a vector of variablespublic static Constraint maximum(BoolVar MAX, BoolVar[] VARS)
MAX
- a boolean variableVARS
- a vector of boolean variablespublic static Constraint mddc(IntVar[] VARS, MultivaluedDecisionDiagram MDD)
VARS
- the array of variablesMDD
- the multi-valued decision diagram encoding solutionspublic static Constraint minimum(IntVar MIN, IntVar[] VARS)
MIN
- a variableVARS
- a vector of variablespublic static Constraint minimum(BoolVar MIN, BoolVar[] VARS)
MIN
- a boolean variableVARS
- a vector of boolean variablespublic static Constraint multicost_regular(IntVar[] VARS, IntVar[] CVARS, ICostAutomaton CAUTOMATON)
VARS
- sequence of variablesCVARS
- cost variablesCAUTOMATON
- a deterministic finite automaton defining the regular language and the costs
Can be built from method CostAutomaton.makeMultiResources(...)public static Constraint[] nvalues(IntVar[] VARS, IntVar NVALUES)
This embeds a light propagator by default. Additional filtering algorithms can be added.
see atleast_nvalue and atmost_nvalue
VARS
- collection of variablesNVALUES
- limit variablepublic static Constraint[] path(IntVar[] VARS, IntVar START, IntVar END, int OFFSET)
Filtering algorithms: see circuit constraint
VARS
- vector of variables which take their value in [OFFSET,OFFSET+|VARS|]START
- variable indicating the index of the first variable in the pathEND
- variable indicating the index of the last variable in the pathOFFSET
- 0 by default but typically 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)public static Constraint regular(IntVar[] VARS, IAutomaton AUTOMATON)
VARS
- sequence of variablesAUTOMATON
- a deterministic finite automaton defining the regular languagepublic static Constraint scalar(IntVar[] VARS, int[] COEFFS, IntVar SCALAR)
VARS
- a vector of variablesCOEFFS
- a vector of intSCALAR
- a variablepublic static Constraint scalar(IntVar[] VARS, int[] COEFFS, String OPERATOR, IntVar SCALAR)
VARS
- a collection of IntVarCOEFFS
- a collection of int, for which |VARS|=|COEFFS|OPERATOR
- an operator in {"=", "!=", ">","<",">=","<="}SCALAR
- an IntVarpublic static Constraint sort(IntVar[] VARS, IntVar[] SORTEDVARS)
For example:
- X= (4,2,1,3)
- Y= (1,2,3,4)
VARS
- an array of variablesSORTEDVARS
- an array of variables sorted in increasing orderpublic static Constraint subcircuit(IntVar[] VARS, int OFFSET, IntVar SUBCIRCUIT_SIZE)
Filtering algorithms: subtour elimination : Caseau & Laburthe (ICLP'97) allDifferent GAC algorithm: Régin (AAAI'94) dominator-based filtering: Fages & Lorca (CP'11) SCC-based filtering
VARS
- a vector of variablesOFFSET
- 0 by default but 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)SUBCIRCUIT_SIZE
- expected number of nodes in the circuitpublic static Constraint[] subpath(IntVar[] VARS, IntVar START, IntVar END, int OFFSET, IntVar SIZE)
Filtering algorithms: see subcircuit constraint
VARS
- vector of variables which take their value in [OFFSET,OFFSET+|VARS|]START
- variable indicating the index of the first variable in the pathEND
- variable indicating the index of the last variable in the pathOFFSET
- 0 by default but typically 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)SIZE
- variable indicating the number of variables to belong to the pathpublic static Constraint sum(IntVar[] VARS, IntVar SUM)
VARS
- a vector of variablesSUM
- a variablepublic static Constraint sum(IntVar[] VARS, String OPERATOR, IntVar SUM)
VARS
- a collection of IntVarOPERATOR
- operator in {"=", "!=", ">","<",">=","<="}SUM
- an IntVarpublic static Constraint sum(BoolVar[] VARS, IntVar SUM)
VARS
- a vector of boolean variablesSUM
- a variablepublic static Constraint sum(BoolVar[] VARS, String OPERATOR, IntVar SUM)
VARS
- a vector of boolean variablesSUM
- a variablepublic static Constraint table(IntVar[] VARS, Tuples TUPLES, String ALGORITHM)
- GAC2001: Arc Consistency version 2001 for tuples,
- GAC2001+: Arc Consistency version 2001 for allowed tuples,
- GAC3rm: Arc Consistency version AC3 rm for tuples,
- GAC3rm+ (default): Arc Consistency version 3rm for allowed tuples,
- GACSTR+: Arc Consistency version STR for allowed tuples,
- STR2+: Arc Consistency version STR2 for allowed tuples,
- FC: Forward Checking.
VARS
- first variableTUPLES
- the relation between the variables (list of allowed/forbidden tuples)ALGORITHM
- to choose among {"GAC3rm", "GAC2001", "GACSTR", "GAC2001+", "GAC3rm+", "FC", "STR2+"}public static Constraint tree(IntVar[] SUCCS, IntVar NBTREES, int OFFSET)
dominator-based filtering: Fages & Lorca (CP'11) However, the filtering over NBTREES is quite light here
SUCCS
- successors variablesNBTREES
- number of arborescences (=number of loops)OFFSET
- 0 by default but 1 if used within MiniZinc
(which counts from 1 to n instead of from 0 to n-1)public static Constraint[] tsp(IntVar[] SUCCS, IntVar COST, int[][] COST_MATRIX)
SUCCS
- successors variablesCOST
- cost of the cycleCOST_MATRIX
- symmetric cost matrixpublic static gnu.trove.list.array.TIntArrayList getDomainUnion(IntVar[] vars)
public static boolean tupleIt(IntVar... VARS)
VARS
- list of variables involvedCopyright © 2015. All rights reserved.