Package org.xcsp.modeler.api
Interface ProblemAPIBase
-
- All Known Subinterfaces:
ProblemAPI,ProblemAPIOnVals,ProblemAPIOnVars,ProblemAPISymbolic
- All Known Implementing Classes:
AllInterval,Bibd,Blackhole,BoardColoration,MagicSequence,Pic,Pic2,Queens,Rack,Rack2,Sudoku,Warehouse,Zebra
public interface ProblemAPIBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classProblemAPIBase.IndexClass that is useful to represent objects wrapping indexing information.static interfaceProblemAPIBase.Occurrences
-
Field Summary
Fields Modifier and Type Field Description static Types.TypeRankANYA constant denoting that a search is conducted with respect to any object (typically, variable) of a structure (typically, a 1-dimensional array of variables) having a certain property.static Map<ProblemAPI,ProblemIMP>api2impAdvanced Use: you shouldn't normally use this map that relatesProblemAPIobjects withProblemIMPobjects.static Types.TypeClassBLOCKSThe constant "blocks" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static Types.TypeClassCHANNELINGThe constant "channeling" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static BooleanCLOSEDA constant, equal to Boolean.TRUE, that can be used to indicate that some variables must take their values in some set of values (e.g., for the constraintcardinality.static Types.TypeClassCLUESThe constant "clues" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static Types.TypeClassCOLUMNSThe constant "columns" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static Types.TypeOperatorRelDECREASINGA constant denoting the relational operator "Greater than or Equal", which is useful for expressing an ordering, as for example inordered(x, DECREASING)orlex(x, DECREASING).static Types.TypeClassDIAGONALSThe constant "diagonals" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static Types.TypeConditionOperatorRelEQA constant denoting the relational operator "Equal", which is useful for expressing conditions, as for example insum(x, EQ, 10)orcount(x, takingValue(0), EQ, 5).static Types.TypeObjectiveEXPRESSIONA constant denoting the type "expression" for an objective function, as for example inminimize(EXPRESSION, add(x,mul(y,3)).static Types.TypeRankFIRSTA constant denoting that a search is conducted with respect to the first object (typically, variable) of a structure (typically, a 1-dimensional array of variables) having a certain property.static Types.TypeConditionOperatorRelGEA constant denoting the relational operator "Greater than or Equal", which is useful for expressing conditions, as for example insum(x, GE, 10)orcount(x, takingValue(0), GE, 5).static Types.TypeConditionOperatorRelGTA constant denoting the relational operator "strictly Greater Than", which is useful for expressing conditions, as for example insum(x, GT, 10)orcount(x, takingValue(0), GT, 5).static Types.TypeConditionOperatorSetINA constant denoting the set operator "In", which is useful for expressing conditions, as for example insum(x, IN, 5, 10)orcount(x, takingValue(0), IN, 5, 10).static Types.TypeOperatorRelINCREASINGA constant denoting the relational operator "Less than or Equal", which is useful for expressing an ordering, as for example inordered(x, INCREASING)orlex(x, INCREASING).static Types.TypeRankLASTA constant denoting that a search is conducted with respect to the last object (typically, variable) of a structure (typically, a 1-dimensional array of variables) having a certain property.static Types.TypeConditionOperatorRelLEA constant denoting the relational operator "Less than or Equal", which is useful for expressing conditions, as for example insum(x, LE, 10)orcount(x, takingValue(0), LE, 5).static Types.TypeObjectiveLEXA constant denoting the type "lex" for an objective function, as for example inminimize(LEX, x, y, z).static Types.TypeConditionOperatorRelLTA constant denoting the relational operator "strictly Less Than", which is useful for expressing conditions, as for example insum(x, LT, 10)orcount(x, takingValue(0), LT, 5).static Types.TypeObjectiveMAXIMUMA constant denoting the type "maximum" for an objective function, as for example inminimize(MAXIMUM, x, y, z).static Types.TypeObjectiveMINIMUMA constant denoting the type "minimum" for an objective function, as for example inmaximize(MINIMUM, x, y, z).static Types.TypeConditionOperatorRelNEA constant denoting the relational operator "Not Equal", which is useful for expressing conditions, as for example insum(x, NE, 10)orcount(x, takingValue(takingValue(0), NE, 5).static BooleanNEGATIVEA constant, equal to Boolean.FALSE, that can be used to indicate that a set of tuples corresponds to conflicts.static Types.TypeClassNOGOODSThe constant "nogoods" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static Types.TypeConditionOperatorSetNOTINA constant denoting the set operator "Not In", which is useful for expressing conditions, as for example insum(x, NOTIN, 5, 10)orcount(x, takingValue(0), NOTIN, 5, 10).static Types.TypeObjectiveNVALUESA constant denoting the type "nValues" for an objective function, as for example inminimize(NVALUES, x).static BooleanPOSITIVEA constant, equal to Boolean.TRUE, that can be used to indicate that a set of tuples corresponds to supports.static Types.TypeObjectivePRODUCTA constant denoting the type "product" for an objective function, as for example inminimize(PRODUCT, x, y, z).static Types.TypeClassREDUNDANT_CONSTRAINTSThe constant "redundantConstraints" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static Types.TypeClassROWSThe constant "rows" that can be used for tagging elements such as variables, constraints, blocks, groups, ...static intSTARThe constant used for denoting "*" in integer tuples.static intSTAR_INTThe constant used for denoting "*" in integer tuples.static StringSTAR_SYMBOLThe constant used for denoting the symbol "*".static Types.TypeOperatorRelSTRICTLY_DECREASINGA constant denoting the relational operator "strictly Greater Than", which is useful for expressing an ordering, as for example inordered(x, STRICTLY_DECREASING)orlex(x, STRICTLY_DECREASING).static Types.TypeOperatorRelSTRICTLY_INCREASINGA constant denoting the relational operator "strictly Less Than", which is useful for expressing an ordering, as for example inordered(x, STRICTLY_INCREASING)orlex(x, STRICTLY_INCREASING).static Types.TypeObjectiveSUMA constant denoting the type "sum" for an objective function, as for example inminimize(SUM, x, y, z).static Types.TypeClassSYMMETRY_BREAKINGThe constant "symmetryBreaking" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default IVar.Varat(IVar.Var index)Pure Syntactic Sugar: this method simply returns its argument.default Automatonautomaton(String startState, String transitions, String... finalStates)Builds anAutomatonfrom the specified transitions, start and final states.default Automatonautomaton(String startState, Transition[] transitions, String... finalStates)Builds anAutomatonfrom the specified transitions, start and final states.default Automatonautomaton(String startState, Transitions transitions, String... finalStates)Builds anAutomatonfrom the specified transitions, start and final states.default CtrEntities.CtrArrayblock(Runnable r)Builds a block by executing the specified runnable object.default Conditioncondition(Types.TypeConditionOperatorRel op, long limit)Returns an objectConditioncomposed of the specified relational operator and value (right operand).default Conditioncondition(Types.TypeConditionOperatorRel op, IVar.Var limit)Returns an objectConditioncomposed of the specified relational operator and variable (right operand).default Conditioncondition(Types.TypeConditionOperatorSet op, int[] values)Returns an objectConditioncomposed of the specified set operator and array of integers (right operand).default Conditioncondition(Types.TypeConditionOperatorSet op, Range range)Returns an objectConditioncomposed of the specified set operator and interval (defined from the two specified bounds).default voidcontrol(boolean b, Object... objects)Controls that the specifiedbooleanargument istrue.default intexceptValue(int value)Pure Syntactic Sugar: this method simply returns its argument.default int[]exceptValues(int... values)Pure Syntactic Sugar: this method simply returns its argument.default String[]finalState(String finalState)Pure Syntactic Sugar: this method simply returns its argument.default String[]finalStates(String... finalStates)Pure Syntactic Sugar: this method simply returns its argument.default CtrEntities.CtrArrayforall(Range.Rangesx2 rangesx2, FunctionalInterfaces.Intx2Consumer c2)Builds a group of constraints by executing the specified consumer on each double value of the specified double range.default CtrEntities.CtrArrayforall(Range.Rangesx3 rangesx3, FunctionalInterfaces.Intx3Consumer c3)Builds a group of constraints by executing the specified consumer on each triple value of the specified triple range.default CtrEntities.CtrArrayforall(Range.Rangesx4 rangesx4, FunctionalInterfaces.Intx4Consumer c4)Builds a group of constraints by executing the specified consumer on each quadruple value of the specified quadruple range.default CtrEntities.CtrArrayforall(Range.Rangesx5 rangesx5, FunctionalInterfaces.Intx5Consumer c5)Builds a group of constraints by executing the specified consumer on each quintuple value of the specified quintuple range.default CtrEntities.CtrArrayforall(Range.Rangesx6 rangesx6, FunctionalInterfaces.Intx6Consumer c6)Builds a group of constraints by executing the specified consumer on each sixtuple value of the specified sixtuple range.default CtrEntities.CtrArrayforall(Range range, java.util.function.IntConsumer c)Builds a group of constraints by executing the specified consumer on each value of the specified range.default ProblemIMPimp()Advanced Use: you shouldn't normally use theProblemIMPobject that offers implementation stuff for this object.default ProblemAPIBase.Indexindex(IVar.Var variable)Returns an objectIndexwrapping the specified variable (and the default value ANY).default ProblemAPIBase.Indexindex(IVar.Var variable, Types.TypeRank rank)Returns an objectIndexwrapping the specified variable and the specified rank type.default int[][]indexing(int... t)Builds and returns a 2-dimensional array of integers, obtained from the specified 1-dimensional array by replacing each valuevat indexiwith a pair(i,v).default int[][]indexing(int[]... m)Builds and returns a 2-dimensional array of integers, obtained from the specified 2-dimensional array by collecting triplets(i,j,v)wherevis the value v at index(i,j)of the array.default int[][]indexing(java.util.stream.IntStream t)Builds and returns a 2-dimensional array of integers, obtained by replacing each valuevat positioniof the specified stream with a pair(i,v).default int[][]indexingTuples(int[]... tuples)Builds and returns a 2-dimensional array of integers, obtained from the specified array by replacing each tuple(v1,v2,...,vr)at indexiwith a new tuple(i,v1,v2,...,vr).default int[][]indexingTuples(java.util.stream.Stream<int[]> tuples)Builds and returns a 2-dimensional array of integers, obtained by replacing each tuple(v1,v2,...,vr)at positioniof the specified stream with a new tuple(i,v1,v2,...,vr).default booleanisModel(String s)Deprecated.default StringmodelVariant()Returns the name of the model variant.default booleanmodelVariant(String s)Returnstrueiff the user has indicated (through the compiler by using the argument -variant=) that the model variant corresponds to the value of the specified string.default Stringname()Returns the name of this object (i.e., the name of this problem instance).default int[][]number(int... t)Deprecated.default ProblemAPIBase.OccurrencesoccurBetween(int[] occursMin, int[] occursMax)Returns an objectOccurrencesthat represents the respective bounds about the number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.default ProblemAPIBase.OccurrencesoccurExactly(int... occurs)Returns an objectOccurrencesthat represents the respective number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.default ProblemAPIBase.OccurrencesoccurExactly(IVar.Var... occurs)Returns an objectOccurrencesthat represents the respective numbers of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.default ProblemAPIBase.Occurrencesoccurrences(int... occurs)Deprecated.default ProblemAPIBase.Occurrencesoccurrences(IVar.Var... occurs)Deprecated.default ProblemAPIBase.OccurrencesoccursBetween(int[] occursMin, int[] occursMax)Deprecated.default ProblemAPIBase.OccurrencesoccursEachBetween(int occursMin, int occursMax)Returns an objectOccurrencesthat represents the bounds about the number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur each.default ProblemAPIBase.OccurrencesoccursEachExactly(int occurs)Returns an objectOccurrencesthat represents the number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.default FunctionalInterfaces.Intx2PredicateonlyOn(FunctionalInterfaces.Intx2Predicate p)Pure Syntactic Sugar: this method simply returns its argument.default java.util.stream.Stream<String>readFileLines(String filename)Returns a stream composed of the non-empty trimmed lines (String) of the specified filedefault <T> java.util.stream.Stream<T>readFileLines(String filename, java.util.function.Function<String,T> f)Returns a stream of objects from class T, after converting each non-empty trimmed line of the specified filedefault intstartIndex(int value)Pure Syntactic Sugar: this method simply returns its argument.default Tabletable()Builds an empty integer table that can be fed with tuples.default Tabletable(boolean positive)Builds an empty integer table which is either positive (i.e, contains supports) or negative (i.e., contains conflicts) depending on the specified Boolean value.default Tabletable(int[]... tuples)Builds an integer table containing the specified tuples.default Tabletable(int value, int... otherValues)Builds an integer table containing the specified tuple.default Tabletable(String tuples)Builds an integer table after parsing the specified string.default Tabletable(Collection<int[]> collection)Builds an integer table containing the specified tuples.default Tabletable(java.util.stream.Stream<int[]> stream)Builds an integer table containing the specified tuples.default Tabletable(Table table)Builds an integer table containing all tuples from the specified table.default TabletableIntersection(Table table1, Table table2)Returns a table corresponding to the intersection of the two specified tablesdefault TabletableWithNewColumn(Table table, int position, int value)Returns a new integer table obtained after adding a new column at the specified table.default inttakingValue(int value)Pure Syntactic Sugar: this method simply returns its argument.default IVar.VartakingValue(IVar.Var value)Pure Syntactic Sugar: this method simply returns its argument.default int[]takingValues(int... values)Pure Syntactic Sugar: this method simply returns its argument.default int[][]takingValues(int[]... values)Pure Syntactic Sugar: this method simply returns its argument.default int[]takingValues(Range values)Syntactic Sugar: this method returns the 1-dimensional array of integers represented by the specified range.default Transitionstransitions()Builds and returns an empty objectTransitions.default Transitionstransitions(String transitions)Builds and returns an objectTransitionsafter parsing the specified string.default int[]tuple(int value, int... otherValues)Returns a tuple (array) of integers from the specified parameters.default int[]weightedBy(int... coeffs)Pure Syntactic Sugar: this method simply returns its argument.default int[][]weightedBy(int[]... coeffs)Pure Syntactic Sugar: this method simply returns its argument.default IVar.Var[]weightedBy(IVar.Var... coeffs)Pure Syntactic Sugar: this method simply returns its argument.default IVar.Var[][]weightedBy(IVar.Var[]... coeffs)Pure Syntactic Sugar: this method simply returns its argument.
-
-
-
Field Detail
-
LT
static final Types.TypeConditionOperatorRel LT
A constant denoting the relational operator "strictly Less Than", which is useful for expressing conditions, as for example insum(x, LT, 10)orcount(x, takingValue(0), LT, 5).
-
LE
static final Types.TypeConditionOperatorRel LE
A constant denoting the relational operator "Less than or Equal", which is useful for expressing conditions, as for example insum(x, LE, 10)orcount(x, takingValue(0), LE, 5).
-
GE
static final Types.TypeConditionOperatorRel GE
A constant denoting the relational operator "Greater than or Equal", which is useful for expressing conditions, as for example insum(x, GE, 10)orcount(x, takingValue(0), GE, 5).
-
GT
static final Types.TypeConditionOperatorRel GT
A constant denoting the relational operator "strictly Greater Than", which is useful for expressing conditions, as for example insum(x, GT, 10)orcount(x, takingValue(0), GT, 5).
-
NE
static final Types.TypeConditionOperatorRel NE
A constant denoting the relational operator "Not Equal", which is useful for expressing conditions, as for example insum(x, NE, 10)orcount(x, takingValue(takingValue(0), NE, 5).
-
EQ
static final Types.TypeConditionOperatorRel EQ
A constant denoting the relational operator "Equal", which is useful for expressing conditions, as for example insum(x, EQ, 10)orcount(x, takingValue(0), EQ, 5).
-
IN
static final Types.TypeConditionOperatorSet IN
A constant denoting the set operator "In", which is useful for expressing conditions, as for example insum(x, IN, 5, 10)orcount(x, takingValue(0), IN, 5, 10).
-
NOTIN
static final Types.TypeConditionOperatorSet NOTIN
A constant denoting the set operator "Not In", which is useful for expressing conditions, as for example insum(x, NOTIN, 5, 10)orcount(x, takingValue(0), NOTIN, 5, 10).
-
STRICTLY_INCREASING
static final Types.TypeOperatorRel STRICTLY_INCREASING
A constant denoting the relational operator "strictly Less Than", which is useful for expressing an ordering, as for example inordered(x, STRICTLY_INCREASING)orlex(x, STRICTLY_INCREASING).
-
INCREASING
static final Types.TypeOperatorRel INCREASING
A constant denoting the relational operator "Less than or Equal", which is useful for expressing an ordering, as for example inordered(x, INCREASING)orlex(x, INCREASING).
-
DECREASING
static final Types.TypeOperatorRel DECREASING
A constant denoting the relational operator "Greater than or Equal", which is useful for expressing an ordering, as for example inordered(x, DECREASING)orlex(x, DECREASING).
-
STRICTLY_DECREASING
static final Types.TypeOperatorRel STRICTLY_DECREASING
A constant denoting the relational operator "strictly Greater Than", which is useful for expressing an ordering, as for example inordered(x, STRICTLY_DECREASING)orlex(x, STRICTLY_DECREASING).
-
EXPRESSION
static final Types.TypeObjective EXPRESSION
A constant denoting the type "expression" for an objective function, as for example inminimize(EXPRESSION, add(x,mul(y,3)).
-
SUM
static final Types.TypeObjective SUM
A constant denoting the type "sum" for an objective function, as for example inminimize(SUM, x, y, z).
-
PRODUCT
static final Types.TypeObjective PRODUCT
A constant denoting the type "product" for an objective function, as for example inminimize(PRODUCT, x, y, z).
-
MINIMUM
static final Types.TypeObjective MINIMUM
A constant denoting the type "minimum" for an objective function, as for example inmaximize(MINIMUM, x, y, z).
-
MAXIMUM
static final Types.TypeObjective MAXIMUM
A constant denoting the type "maximum" for an objective function, as for example inminimize(MAXIMUM, x, y, z).
-
NVALUES
static final Types.TypeObjective NVALUES
A constant denoting the type "nValues" for an objective function, as for example inminimize(NVALUES, x).
-
LEX
static final Types.TypeObjective LEX
A constant denoting the type "lex" for an objective function, as for example inminimize(LEX, x, y, z).
-
CHANNELING
static final Types.TypeClass CHANNELING
The constant "channeling" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
CLUES
static final Types.TypeClass CLUES
The constant "clues" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
ROWS
static final Types.TypeClass ROWS
The constant "rows" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
COLUMNS
static final Types.TypeClass COLUMNS
The constant "columns" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
BLOCKS
static final Types.TypeClass BLOCKS
The constant "blocks" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
DIAGONALS
static final Types.TypeClass DIAGONALS
The constant "diagonals" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
SYMMETRY_BREAKING
static final Types.TypeClass SYMMETRY_BREAKING
The constant "symmetryBreaking" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
REDUNDANT_CONSTRAINTS
static final Types.TypeClass REDUNDANT_CONSTRAINTS
The constant "redundantConstraints" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
NOGOODS
static final Types.TypeClass NOGOODS
The constant "nogoods" that can be used for tagging elements such as variables, constraints, blocks, groups, ...
-
FIRST
static final Types.TypeRank FIRST
A constant denoting that a search is conducted with respect to the first object (typically, variable) of a structure (typically, a 1-dimensional array of variables) having a certain property.
-
LAST
static final Types.TypeRank LAST
A constant denoting that a search is conducted with respect to the last object (typically, variable) of a structure (typically, a 1-dimensional array of variables) having a certain property.
-
ANY
static final Types.TypeRank ANY
A constant denoting that a search is conducted with respect to any object (typically, variable) of a structure (typically, a 1-dimensional array of variables) having a certain property.
-
POSITIVE
static final Boolean POSITIVE
A constant, equal to Boolean.TRUE, that can be used to indicate that a set of tuples corresponds to supports.
-
NEGATIVE
static final Boolean NEGATIVE
A constant, equal to Boolean.FALSE, that can be used to indicate that a set of tuples corresponds to conflicts.
-
CLOSED
static final Boolean CLOSED
A constant, equal to Boolean.TRUE, that can be used to indicate that some variables must take their values in some set of values (e.g., for the constraintcardinality.
-
STAR
static final int STAR
The constant used for denoting "*" in integer tuples.- See Also:
- Constant Field Values
-
STAR_INT
static final int STAR_INT
The constant used for denoting "*" in integer tuples.- See Also:
- Constant Field Values
-
STAR_SYMBOL
static final String STAR_SYMBOL
The constant used for denoting the symbol "*".- See Also:
- Constant Field Values
-
api2imp
static final Map<ProblemAPI,ProblemIMP> api2imp
Advanced Use: you shouldn't normally use this map that relatesProblemAPIobjects withProblemIMPobjects.
-
-
Method Detail
-
imp
default ProblemIMP imp()
Advanced Use: you shouldn't normally use theProblemIMPobject that offers implementation stuff for this object.- Returns:
- the
ProblemIMPobject that offers implementation stuff for thisProblemAPIobject
-
control
default void control(boolean b, Object... objects)Controls that the specifiedbooleanargument istrue. If it is not the case, the program will stop and specified objects will be displayed.- Parameters:
b- abooleanvalue to be controlled to betrueobjects- a sequence of objects used for displaying information when the specifiedbooleanargument isfalse
-
name
default String name()
Returns the name of this object (i.e., the name of this problem instance). By default, this is the name of the class implementingProblemAPIfollowed by the values of all parameters (separated by the symbol '-'). The parameters are the fields, used as data, which are declared in the class implementingProblemAPI, or the name of a JSON file, if one is given. Possibly, the name of a model variant, if used, is inserted after the name of the class.
-
modelVariant
default String modelVariant()
Returns the name of the model variant. If no model variant has been explicitly specified, it isnull.- Returns:
- the name of the model variant, or (
nullis no model variant has been explicitly specified)
-
modelVariant
default boolean modelVariant(String s)
Returnstrueiff the user has indicated (through the compiler by using the argument -variant=) that the model variant corresponds to the value of the specified string.- Parameters:
s- a string representing the name of a model variant- Returns:
trueiff the model variant corresponds to the specified string
-
isModel
@Deprecated default boolean isModel(String s)
Deprecated.
-
readFileLines
default <T> java.util.stream.Stream<T> readFileLines(String filename, java.util.function.Function<String,T> f)
Returns a stream of objects from class T, after converting each non-empty trimmed line of the specified file- Parameters:
filename- the name of a filef- a function mapping each line (String) into an object of class T- Returns:
- a stream of objects from class T, after converting each non-empty trimmed line of the specified file
-
readFileLines
default java.util.stream.Stream<String> readFileLines(String filename)
Returns a stream composed of the non-empty trimmed lines (String) of the specified file- Parameters:
filename- the name of a file- Returns:
- a stream composed of the non-empty trimmed lines (
String) of the specified file
-
tuple
default int[] tuple(int value, int... otherValues)Returns a tuple (array) of integers from the specified parameters.- Parameters:
value- an integerotherValues- a sequence of integers- Returns:
- a 1-dimensional array of
int
-
number
@Deprecated default int[][] number(int... t)
Deprecated.
-
indexing
default int[][] indexing(int... t)
Builds and returns a 2-dimensional array of integers, obtained from the specified 1-dimensional array by replacing each valuevat indexiwith a pair(i,v). For example, indexing[2,4,1]yields[[0,2],[1,4],[2,1]].- Parameters:
t- a 1-dimensional array of integers- Returns:
- a 2-dimensional array of integers
-
indexing
default int[][] indexing(java.util.stream.IntStream t)
Builds and returns a 2-dimensional array of integers, obtained by replacing each valuevat positioniof the specified stream with a pair(i,v). For example, indexing[2,4,1]from a stream yields[[0,2],[1,4],[2,1]].- Parameters:
t- a stream of integer values- Returns:
- A 2-dimensional array of integers
-
indexing
default int[][] indexing(int[]... m)
Builds and returns a 2-dimensional array of integers, obtained from the specified 2-dimensional array by collecting triplets(i,j,v)wherevis the value v at index(i,j)of the array. For example, indexing[[1,2,1],[2,5,1]]yields[[0,0,1],[0,1,2],[0,2,1],[1,0,2],[1,1,5],[1,2,1]].- Parameters:
m- a 2-dimensional array of integers- Returns:
- a 2-dimensional array of integers
-
indexingTuples
default int[][] indexingTuples(int[]... tuples)
Builds and returns a 2-dimensional array of integers, obtained from the specified array by replacing each tuple(v1,v2,...,vr)at indexiwith a new tuple(i,v1,v2,...,vr). For example, indexing[[0,3,1],[2,4,1]]yields[[0,0,3,1],[1,2,4,1]].- Parameters:
tuples- a 2-dimensional array of integers- Returns:
- a 2-dimensional array of integers
-
indexingTuples
default int[][] indexingTuples(java.util.stream.Stream<int[]> tuples)
Builds and returns a 2-dimensional array of integers, obtained by replacing each tuple(v1,v2,...,vr)at positioniof the specified stream with a new tuple(i,v1,v2,...,vr). For example, indexing[[0,3,1],[2,4,1]]from a stream yields[[0,0,3,1],[1,2,4,1]].- Parameters:
tuples- a stream of arrays of integers- Returns:
- a 2-dimensional array of integers
-
table
default Table table()
Builds an empty integer table that can be fed with tuples.- Returns:
- an object
TableInteger
-
table
default Table table(boolean positive)
Builds an empty integer table which is either positive (i.e, contains supports) or negative (i.e., contains conflicts) depending on the specified Boolean value.- Parameters:
positive- a Boolean value indicating if the created table is positive (true) or negative (false)- Returns:
- an empty integer table
-
table
default Table table(int value, int... otherValues)
Builds an integer table containing the specified tuple.- Parameters:
value- an integerotherValues- a sequence of integers- Returns:
- an integer table with one tuple
-
table
default Table table(int[]... tuples)
Builds an integer table containing the specified tuples.- Parameters:
tuples- a sequence of tuples- Returns:
- an integer table with the specified tuples
-
table
default Table table(java.util.stream.Stream<int[]> stream)
Builds an integer table containing the specified tuples.- Parameters:
stream- a stream of tuples- Returns:
- an integer table with the specified tuples
-
table
default Table table(Collection<int[]> collection)
Builds an integer table containing the specified tuples.- Parameters:
collection- a collection of tuples- Returns:
- an integer table with the specified tuples
-
table
default Table table(Table table)
Builds an integer table containing all tuples from the specified table.- Parameters:
table- an existing table- Returns:
- an integer table with all tuples from the specified table.
-
tableIntersection
default Table tableIntersection(Table table1, Table table2)
Returns a table corresponding to the intersection of the two specified tables- Parameters:
table1- a first integer tabletable2- a second integer table- Returns:
- an integer table that represents the intersection of the two specified tables
-
tableWithNewColumn
default Table tableWithNewColumn(Table table, int position, int value)
Returns a new integer table obtained after adding a new column at the specified table. The position of the new column is specified as well as the value that must be put in that column. For example, it can be useful for adding a column with '*' in tables.- Parameters:
table- an integer tableposition- the position of a new column where the value must be putvalue- the value that must be put in the column- Returns:
- an integer table obtained after adding a new column at the specified table
-
table
default Table table(String tuples)
Builds an integer table after parsing the specified string. The string is what can be expected in XCSP3, as for example(1,2)(1,3)(2,3)for an integer table.- Parameters:
tuples- a string representing a sequence of integer tuples.- Returns:
- a table containing the parsed specified tuples
-
transitions
default Transitions transitions()
Builds and returns an empty objectTransitions. It is then possible to add transitions.- Returns:
- an object
Transitions
-
transitions
default Transitions transitions(String transitions)
Builds and returns an objectTransitionsafter parsing the specified string. The string is what can be expected in XCSP3, as for example"(q0,0,q1)(q0,2,q2)(q1,0,q3)".- Parameters:
transitions- a string representing the transitions- Returns:
- an object
Transitions
-
finalStates
default String[] finalStates(String... finalStates)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the set of final states when building an automaton.- Parameters:
finalStates- a sequence ofString- Returns:
- an array of
String
-
finalState
default String[] finalState(String finalState)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the (unique) final state when building an automaton.- Parameters:
finalState- aString- Returns:
- a
String
-
automaton
default Automaton automaton(String startState, Transition[] transitions, String... finalStates)
Builds anAutomatonfrom the specified transitions, start and final states.- Parameters:
startState- the start statetransitions- the transitions of the automatonfinalStates- the final states- Returns:
- an automaton
-
automaton
default Automaton automaton(String startState, Transitions transitions, String... finalStates)
Builds anAutomatonfrom the specified transitions, start and final states.- Parameters:
startState- the start statetransitions- the object denoting the transitionsfinalStates- the final states- Returns:
- an automaton
-
automaton
default Automaton automaton(String startState, String transitions, String... finalStates)
Builds anAutomatonfrom the specified transitions, start and final states.- Parameters:
startState- the start statetransitions- the string denoting the transitionsfinalStates- the final states- Returns:
- an automaton
-
occursEachExactly
default ProblemAPIBase.Occurrences occursEachExactly(int occurs)
Returns an objectOccurrencesthat represents the number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.- Parameters:
occurs- an integer- Returns:
- an object
Occurrencesthat can be used with constraintcardinality
-
occursEachBetween
default ProblemAPIBase.Occurrences occursEachBetween(int occursMin, int occursMax)
Returns an objectOccurrencesthat represents the bounds about the number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur each.- Parameters:
occursMin- the lower bound for the number of occurrencesoccursMax- the upper bound for the number of occurrences- Returns:
- an object
Occurrencesthat can be used with constraintcardinality
-
occurExactly
default ProblemAPIBase.Occurrences occurExactly(int... occurs)
Returns an objectOccurrencesthat represents the respective number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.- Parameters:
occurs- a 1-dimensional array of integers representing the respective numbers of occurrences- Returns:
- an object
Occurrencesthat can be used with constraintcardinality
-
occurrences
@Deprecated default ProblemAPIBase.Occurrences occurrences(int... occurs)
Deprecated.
-
occurBetween
default ProblemAPIBase.Occurrences occurBetween(int[] occursMin, int[] occursMax)
Returns an objectOccurrencesthat represents the respective bounds about the number of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.- Parameters:
occursMin- the lower bounds for the number of occurrencesoccursMax- the upper bounds for the number of occurrences- Returns:
- an object
Occurrencesthat can be used with constraintcardinality
-
occursBetween
@Deprecated default ProblemAPIBase.Occurrences occursBetween(int[] occursMin, int[] occursMax)
Deprecated.
-
occurExactly
default ProblemAPIBase.Occurrences occurExactly(IVar.Var... occurs)
Returns an objectOccurrencesthat represents the respective numbers of times each value of a given set in a certain context (when posting a constraintcardinality) must occur.- Parameters:
occurs- a 1-dimensional array of integer variables- Returns:
- an object
Occurrencesthat can be used with constraintcardinality
-
occurrences
@Deprecated default ProblemAPIBase.Occurrences occurrences(IVar.Var... occurs)
Deprecated.
-
condition
default Condition condition(Types.TypeConditionOperatorRel op, long limit)
Returns an objectConditioncomposed of the specified relational operator and value (right operand). Such object can be used when posting constraints.- Parameters:
op- a relational operatorlimit- an integer- Returns:
- an object
Conditioncomposed of the specified relational operator and value
-
condition
default Condition condition(Types.TypeConditionOperatorRel op, IVar.Var limit)
Returns an objectConditioncomposed of the specified relational operator and variable (right operand). Such object can be used when posting constraints.- Parameters:
op- a relational operatorlimit- an integer variable- Returns:
- an object
Conditioncomposed of the specified relational operator and variable
-
condition
default Condition condition(Types.TypeConditionOperatorSet op, Range range)
Returns an objectConditioncomposed of the specified set operator and interval (defined from the two specified bounds). Such object can be used when posting constraints.- Parameters:
op- a set operatorrange- a range (interval) of values- Returns:
- an object
Conditioncomposed of the specified set operator and interval
-
condition
default Condition condition(Types.TypeConditionOperatorSet op, int[] values)
Returns an objectConditioncomposed of the specified set operator and array of integers (right operand). Such object can be used when posting constraints.- Parameters:
op- a set operatorvalues- an array of integers- Returns:
- an object
Conditioncomposed of the specified set operator and array of integers
-
index
default ProblemAPIBase.Index index(IVar.Var variable)
Returns an objectIndexwrapping the specified variable (and the default value ANY). Such object can be used when posting constraints.- Parameters:
variable- an integer variable- Returns:
- an object
Indexwrapping the specified variable
-
index
default ProblemAPIBase.Index index(IVar.Var variable, Types.TypeRank rank)
Returns an objectIndexwrapping the specified variable and the specified rank type. In the context of looking for an object with a certain property P in a structure (typically, a variable with property P in a 1-dimensional array of variables), the value ofrankindicates ifvariablemust be:- the smallest valid index number (FIRST), meaning that
variablemust refer to the first object in the structure with property P - the greatest valid index number (LAST), meaning that
variablemust refer to the last variable in the structure with property P - or any valid index number (ANY), meaning that
variablecan refer to any variable in the structure with property P.
- Parameters:
variable- an integer variablerank- the way indexing search is considered (FIRST, LAST or ANY)- Returns:
- an object
Indexwrapping the specified variable and the specified rank type
- the smallest valid index number (FIRST), meaning that
-
startIndex
default int startIndex(int value)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the value used as starting index when posting some constraints (e.g.,element,channelorminimum).- Parameters:
value- an integer- Returns:
- the same integer
-
onlyOn
default FunctionalInterfaces.Intx2Predicate onlyOn(FunctionalInterfaces.Intx2Predicate p)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize a limitation for some constraints (e.g.,instantiation.- Parameters:
p- a predicate- Returns:
- the same predicate
-
weightedBy
default int[] weightedBy(int... coeffs)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize a scalar product.- Parameters:
coeffs- a 1-dimensional array (varargs) of integers- Returns:
- the same 1-dimensional array of integers
-
weightedBy
default IVar.Var[] weightedBy(IVar.Var... coeffs)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize a scalar product.- Parameters:
coeffs- a 1-dimensional array (varargs) of variables- Returns:
- the same 1-dimensional array of variables
-
weightedBy
default int[][] weightedBy(int[]... coeffs)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize a scalar product.- Parameters:
coeffs- a 2-dimensional array (varargs) of integers- Returns:
- the same 2-dimensional array of integers
-
weightedBy
default IVar.Var[][] weightedBy(IVar.Var[]... coeffs)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize a scalar product.- Parameters:
coeffs- a 2-dimensional array (varargs) of variables- Returns:
- the same 2-dimensional array of variables
-
takingValue
default int takingValue(int value)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the target when posting some constraints (e.g.,count,elementorinstantiation).- Parameters:
value- an integer- Returns:
- the same integer
-
takingValue
default IVar.Var takingValue(IVar.Var value)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the target when posting some constraints (e.g.,count,elementorinstantiation).- Parameters:
value- a variable- Returns:
- the same variable
-
exceptValue
default int exceptValue(int value)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful when posting constraints with an "exceptional" value to be indicated.- Parameters:
value- an integer- Returns:
- the same integer
-
exceptValues
default int[] exceptValues(int... values)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful when posting constraints with "exceptional" values to be indicated.- Parameters:
values- a 1-dimensional array (varargs) of integers- Returns:
- the same 1-dimensional array of integers
-
takingValues
default int[] takingValues(int... values)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the target when posting some constraints (e.g.,count,elementorinstantiation).- Parameters:
values- a 1-dimensional array (varargs) of integers- Returns:
- the same 1-dimensional array of integers
-
takingValues
default int[] takingValues(Range values)
Syntactic Sugar: this method returns the 1-dimensional array of integers represented by the specified range. It can be useful to emphasize the target when posting some constraints (e.g.,count,elementorinstantiation).- Parameters:
values- an objectRange- Returns:
- the 1-dimensional array of integers, represented by the specified range
-
takingValues
default int[][] takingValues(int[]... values)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize the target when posting some constraints (e.g.,instantiation).- Parameters:
values- a 2-dimensional array (varargs) of integers- Returns:
- the same 2-dimensional array of integers
-
at
default IVar.Var at(IVar.Var index)
Pure Syntactic Sugar: this method simply returns its argument. It can be useful to emphasize a specific variable when posting some constraints (e.g.,element).- Parameters:
index- a variable- Returns:
- the same variable
-
block
default CtrEntities.CtrArray block(Runnable r)
Builds a block by executing the specified runnable object. For example:block(() -> { instantiation(x, t); lexMatrix(x, INCREASING); }).tag(SYMMETRY_BREAKING);- Parameters:
r- an object to run- Returns:
- an object
CtrArraythat wraps the built block and allows us to provide note and tags by method chaining
-
forall
default CtrEntities.CtrArray forall(Range range, java.util.function.IntConsumer c)
Builds a group of constraints by executing the specified consumer on each value of the specified range. For example:forall(range(n - 1), i -> equal(x[i], x[i + 1]));- Parameters:
range- a range of valuesc- a consumer- Returns:
- an object
CtrArraythat wraps the built group and allows us to provide note and tags by method chaining
-
forall
default CtrEntities.CtrArray forall(Range.Rangesx2 rangesx2, FunctionalInterfaces.Intx2Consumer c2)
Builds a group of constraints by executing the specified consumer on each double value of the specified double range. For example:forall(range(n).range(n), (i,j) -> lessThan(x[i], y[j]));- Parameters:
rangesx2- a double range of valuesc2- a consumer that accepts two integers- Returns:
- an object
CtrArraythat wraps the built group and allows us to provide note and tags by method chaining
-
forall
default CtrEntities.CtrArray forall(Range.Rangesx3 rangesx3, FunctionalInterfaces.Intx3Consumer c3)
Builds a group of constraints by executing the specified consumer on each triple value of the specified triple range. For example:forall(range(n).range(n).range(2), (i,j,k) -> lessThan(x[i], add(y[j],k)));- Parameters:
rangesx3- a triple range of valuesc3- a consumer that accepts three integers- Returns:
- an object
CtrArraythat wraps the built group and allows us to provide note and tags by method chaining
-
forall
default CtrEntities.CtrArray forall(Range.Rangesx4 rangesx4, FunctionalInterfaces.Intx4Consumer c4)
Builds a group of constraints by executing the specified consumer on each quadruple value of the specified quadruple range. For example:forall(range(n).range(n).range(2).range(2), (i,j,k,l) -> lessThan(add(x[i],l), add(y[j],k)));- Parameters:
rangesx4- a quadruple range of valuesc4- a consumer that accepts four integers- Returns:
- an object
CtrArraythat wraps the built group and allows us to provide note and tags by method chaining
-
forall
default CtrEntities.CtrArray forall(Range.Rangesx5 rangesx5, FunctionalInterfaces.Intx5Consumer c5)
Builds a group of constraints by executing the specified consumer on each quintuple value of the specified quintuple range. For example:forall(range(n).range(n).range(2).range(2).range(10), (i,j,k,l,m) -> lessThan(add(x[i],dist(l,m)), add(y[j],k)));- Parameters:
rangesx5- a quintuple range of valuesc5- a consumer that accepts five integers- Returns:
- an object
CtrArraythat wraps the built group and allows us to provide note and tags by method chaining
-
forall
default CtrEntities.CtrArray forall(Range.Rangesx6 rangesx6, FunctionalInterfaces.Intx6Consumer c6)
Builds a group of constraints by executing the specified consumer on each sixtuple value of the specified sixtuple range.- Parameters:
rangesx6- a sixtuple range of valuesc6- a consumer that accepts six integers- Returns:
- an object
CtrArraythat wraps the built group and allows us to provide note and tags by method chaining
-
-