public interface Problem
The standard will cover the following Constraints:
Problem Definition is completely independent of the Problem Resolution (class Solver).
ConstrainedVariable
,
Var
,
Constraint
,
Solver
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JSR331_VERSION |
Modifier and Type | Method and Description |
---|---|
Constraint |
add(Constraint constraint)
Adds a Constraint "constraint" to the problem, then returns the constraint.
|
Var |
add(java.lang.String name,
Var var)
Gives the Var variable "var" a new name "name", adds it to the problem,
and returns the newly added Var.
|
Var |
add(Var var)
Adds a Var variable "var" to the problem, and returns the newly added Var.
|
VarBool |
add(VarBool var)
Adds a VarBool variable "var" to the problem, and returns the newly added VarBool.
|
VarReal |
add(VarReal var)
Adds a VarReal variable "var" to the problem, and returns the newly added VarReal.
|
void |
add(VarString var) |
Constraint |
allDiff(java.util.ArrayList<Var> vars)
This method create a new Constraint stating that all of the elements of
the list of variables "vars" must take different values from each other.
|
Constraint |
allDiff(Var[] vars)
This method create a new Constraint stating that all of the elements of
the array of variables "vars" must take different values from each other.
|
boolean |
areThereProbabilityConstraints() |
Var |
createVariable(java.lang.String name,
int min,
int max)
Creates a Var with the name "name" and domain [min;max] of the default domain type,
and returns the newly added Var.
|
VarReal |
createVariableReal(java.lang.String name,
double min,
double max)
Creates a VarReal with the name "name" and domain [min;max] of the default domain type,
and returns the newly added VarReal
|
Var |
element(java.util.ArrayList<Var> list,
Var indexVar) |
Var |
element(int[] array,
Var indexVar)
Returns a constrained integer variable that is an element of the integer "array"
with index defined as another constrained integer variable "indexVar".
|
VarSet |
element(java.util.Set<java.lang.Integer>[] sets,
Var indexVar)
Creates a set variable that corresponds to sets[index]
|
Var |
element(Var[] array,
Var indexVar)
Returns a constrained integer variable that is an element of the "array" of variables
with index defined as another constrained integer variable "indexVar".
|
java.lang.String |
getAPIVersion()
Returns JSR331 API version number
|
Constraint |
getConstraint(java.lang.String name)
Returns the Constraint the name "name", or null if no such constraints exists in the problem.
|
Constraint[] |
getConstraints()
Returns an array of Constraints previously added to the problem.
|
Constraint |
getFalseConstraint()
Returns the constant constraint that always will fail when it is posted or executed.
|
java.lang.String |
getImplVersion()
Returns JSR331 Implementation version number
|
java.lang.String |
getName()
Returns the problem name
|
double |
getRealPrecision()
Returns the precision for VarReals
|
Solver |
getSolver()
Returns an instance of a Solver associated with this problem.
|
Var |
getTotalConstraintViolation() |
Constraint |
getTrueConstraint()
Returns the constant constraint that always succeeds when it is posted or executed.
|
Var |
getVar(java.lang.String name)
Returns the Var variable with the name "name", or null if no such variable exists in the problem.
|
Var[] |
getVarArray(java.lang.String name)
Returns the array of Var variables with the name "name", or null if no such array exists in the problem.
|
VarBool[] |
getVarBools()
Returns an array containing the VarBool variables previously added to the problem.
|
VarMatrix |
getVarMatrix(java.lang.String name) |
VarReal |
getVarReal(java.lang.String name)
Returns the VarReal variable with the name "name", or null if no such variable exists in the problem.
|
VarReal[] |
getVarReals()
Returns an array containing the VarReal variables previously added to the problem.
|
Var[] |
getVars()
Returns an array containing the Var variables previously added to the problem.
|
VarReal[] |
getVarSets()
Returns an array containing the VarSet variables previously added to the problem.
|
VarString |
getVarString(java.lang.String name) |
VarString[] |
getVarStrings() |
Constraint |
linear(Var var,
java.lang.String oper,
int value)
Creates a constraint: var "oper" value without posting
|
Constraint |
linear(VarString var,
java.lang.String oper,
java.lang.String value) |
Constraint |
linear(VarString var1,
java.lang.String oper,
VarString var2) |
Constraint |
linear(Var var1,
java.lang.String oper,
Var var2)
Creates a constraint: var1 "oper" var2 without posting
|
void |
loadFromXML(java.io.InputStream in)
Loads a Problem represented by the XML document on the specified
input stream into this instance of the Problem
|
void |
log(java.util.ArrayList<Var> vars) |
void |
log(java.lang.String text)
Logs (displays) the String parameter "text"
|
void |
log(Var[] vars)
Logs the integer constrained variables contained in the array "vars".
|
void |
log(VarReal[] vars)
Logs the real constrained variables contained in the array "vars".
|
Var |
max(java.util.ArrayList<Var> listOfVariables) |
Var |
max(Var[] arrayOfVariables)
Returns a constrained integer variable that is equal to the maximal variable in the array
"arrayOfVariables" when they are all instantiated.
|
Var |
max(Var var1,
Var var2)
Returns a constrained integer variable that is equal to the maximal of two variablea
var1 or var 2 when they are both instantiated.
|
Var |
min(java.util.ArrayList<Var> listOfVariables) |
Var |
min(Var[] arrayOfVariables)
Returns a constrained integer variable that is equal to the minimal variable in the array
"arrayOfVariables" when they are all instantiated.
|
Var |
min(Var var1,
Var var2)
Returns a constrained integer variable that is equal to the minimal of two variablea
var1 or var 2 when they are both instantiated.
|
Constraint |
post(java.util.ArrayList<Var> vars,
java.lang.String oper,
int value)
Deprecated.
|
Constraint |
post(java.util.ArrayList<Var> vars,
java.lang.String oper,
Var var)
Deprecated.
|
void |
post(Constraint c)
Posts the constraint "c".
|
Constraint |
post(double[] array,
ConstrainedVariable[] vars,
java.lang.String oper,
ConstrainedVariable var)
Deprecated.
|
Constraint |
post(double[] array,
ConstrainedVariable[] vars,
java.lang.String oper,
double value)
Deprecated.
|
Constraint |
post(double[] array,
VarReal[] vars,
java.lang.String oper,
double value)
Deprecated.
|
Constraint |
post(double[] array,
VarReal[] vars,
java.lang.String oper,
VarReal var)
Deprecated.
|
Constraint |
post(int[] array,
java.util.ArrayList<Var> vars,
java.lang.String oper,
int value)
Deprecated.
|
Constraint |
post(int[] array,
Var[] vars,
java.lang.String oper,
int value)
Deprecated.
|
Constraint |
post(int[] array,
Var[] vars,
java.lang.String oper,
Var var)
Deprecated.
|
Constraint |
post(java.lang.String name,
java.lang.String symbolicExpression)
Creates a Constraint based on the symbolicExpression such as "x*y-z = 3*r",
adds this constraint to the problem, and returns the newly added Constraint.
|
Constraint |
post(Var[] vars,
java.lang.String oper,
int value)
Deprecated.
|
Constraint |
post(Var[] vars,
java.lang.String oper,
Var var)
Deprecated.
|
Constraint |
post(VarReal[] vars,
java.lang.String oper,
double value)
Deprecated.
|
Constraint |
post(VarReal[] vars,
java.lang.String oper,
VarReal var)
Deprecated.
|
Constraint |
post(VarReal var,
java.lang.String oper,
double value)
Creates and posts a constraint: var "oper" double value
|
Constraint |
post(VarReal var,
java.lang.String oper,
int value)
Creates and posts a constraint: var "oper" integer value
|
Constraint |
post(VarReal var1,
java.lang.String oper,
Var var2)
Creates and posts a constraint: var1 "oper" var2
|
Constraint |
post(VarReal var1,
java.lang.String oper,
VarReal var2)
Creates and posts a constraint: var1 "oper" var2
|
Constraint |
post(Var var,
java.lang.String oper,
int value)
Creates and posts a constraint: var "oper" value
|
Constraint |
post(VarString var,
java.lang.String oper,
java.lang.String value) |
Constraint |
post(VarString var1,
java.lang.String oper,
VarString var2) |
Constraint |
post(Var var1,
java.lang.String oper,
Var var2)
Creates and posts a constraint: var1 "oper" var2
|
Constraint |
post(Var var1,
java.lang.String oper,
VarReal var2)
Creates and posts a constraint: var1 "oper" var2
|
Constraint |
post(Var var1,
Var var2,
java.lang.String oper,
int value)
Deprecated.
|
Constraint |
post(Var var1,
Var var2,
java.lang.String oper,
Var var)
Deprecated.
|
Constraint |
postAllDiff(java.util.ArrayList<Var> vars)
Similar to postAllDiff for variables saved in the ArrayList vars
|
Constraint |
postAllDiff(Var[] vars)
This constraint is a synonym for postAllDifferent
|
Constraint |
postAllDiff(VarString[] varStrings)
Posts allDiff constraint for an array of VarString variables
|
Constraint |
postAllDifferent(java.util.ArrayList<Var> vars)
Similar to postAllDifferent for variables saved in the ArrayList vars
|
Constraint |
postAllDifferent(Var[] vars)
Creates and posts a new Constraint stating that all of the elements of
the array of variables "vars" must take different values from each other.
|
Constraint |
postAnd(Constraint c1,
Constraint c2)
Creates and posts a constraint an "AND" Constraint.
|
Constraint |
postCardinality(java.util.ArrayList<Var> vars,
int cardValue,
java.lang.String oper,
int value) |
Constraint |
postCardinality(java.util.ArrayList<Var> vars,
int cardValue,
java.lang.String oper,
Var var) |
Constraint |
postCardinality(java.util.ArrayList<Var> vars,
Var cardVar,
java.lang.String oper,
int value) |
Constraint |
postCardinality(java.util.ArrayList<Var> vars,
Var cardVar,
java.lang.String oper,
Var var) |
Constraint |
postCardinality(Var[] vars,
int cardValue,
java.lang.String oper,
int value)
This method creates and posts a new cardinality constraint
“cardinality(vars,cardValue) 'oper' value”.
|
Constraint |
postCardinality(Var[] vars,
int cardValue,
java.lang.String oper,
Var var)
This method is similar to the one above but instead of “value”
the “cardinality(vars,cardValue)” is being constrained by “var”.
|
Constraint |
postCardinality(Var[] vars,
Var cardVar,
java.lang.String oper,
int value)
This method is similar to the one above but instead of “var”
it uses "value"
|
Constraint |
postCardinality(Var[] vars,
Var cardVar,
java.lang.String oper,
Var var)
This method is similar to the one above but instead of “cardValue”
it uses "cardVar"
|
Constraint |
postElement(int[] array,
Var indexVar,
java.lang.String oper,
int value)
Creates and posts a new constraint: array[indexVar] 'oper' value
Here "array[indexVar]" denotes a constrained integer variable, which domain
consists of integers array[i] where i is within domain of the "indexVar".
|
Constraint |
postElement(int[] array,
Var indexVar,
java.lang.String oper,
Var var)
Creates and posts a constraint: array[indexVar] 'oper' var
Here "array[indexVar]" denotes a constrained integer variable, which domain
consists of integers array[i] where i is within domain of the "indexVar".
|
Constraint |
postElement(java.util.Set[] arrayOfSets,
Var indexVar,
java.lang.String oper,
VarSet var)
Creates and posts a constraint: arrayOfSets[indexVar] 'oper' setVar
Here "arrayOfSets[indexVar]" denotes a constrained set variable, which domain
consists of sets of integers arrayOfSets[i] where i is within domain of the "indexVar".
|
Constraint |
postElement(Var[] vars,
Var indexVar,
java.lang.String oper,
int value)
Posts a constraint: vars[indexVar] 'oper' value
|
Constraint |
postElement(Var[] vars,
Var indexVar,
java.lang.String oper,
Var var)
Posts a new constraint: vars[indexVar] 'oper' var
|
Constraint |
postGlobalCardinality(java.util.ArrayList<Var> vars,
int[] values,
int[] cardMin,
int[] cardMax) |
Constraint |
postGlobalCardinality(java.util.ArrayList<Var> vars,
int[] values,
Var[] cardinalityVars) |
Constraint |
postGlobalCardinality(Var[] vars,
int[] values,
int[] cardMin,
int[] cardMax)
Creates and posts a new global cardinality constraint that states:
|
Constraint |
postGlobalCardinality(Var[] vars,
int[] values,
Var[] cardinalityVars)
Creates and posts a new global cardinality constraint that states:
|
Constraint |
postIfThen(Constraint constraint1,
Constraint constraint2)
Creates and posts a constraint that states the implication: if constraint1 then constraint2.
|
Constraint |
postIfThen(VarBool var1,
VarBool var2)
Returns a Constraint that states the implication:
"if boolean variable var1 is true then boolean variable var2 is also true"
|
Constraint |
postMax(Var[] vars,
java.lang.String oper,
int value)
Creates and posts a constraint: max(vars) "oper" value
where max(vars) is a maximal variable in the array "vars"
when they are all instantiated.
|
Constraint |
postMax(Var[] vars,
java.lang.String oper,
Var var)
Creates and posts a constraint: max(vars) "oper" var
where max(vars) is a maximal variable in the array "vars"
when they are all instantiated.
|
Constraint |
postMin(Var[] vars,
java.lang.String oper,
int value)
Creates and posts a constraint: min(vars) "oper" value
where max(vars) is a minimal variable in the array "vars"
when they are all instantiated.
|
Constraint |
postMin(Var[] vars,
java.lang.String oper,
Var var)
Creates and posts a constraint: min(vars) "oper" var
where max(vars) is a minimal variable in the array "vars"
when they are all instantiated.
|
Constraint |
postOr(Constraint c1,
Constraint c2)
Creates and posts a constraint an "OR" Constraint.
|
Constraint |
postScalProd(Var var,
java.lang.String oper,
int[] arrayOfValues,
Var[] arrayOfVariables)
Creates and posts a constraint: var "oper" scalProd(arrayOfValues,arrayOfVariables)
|
VarReal |
scalProd(double[] arrayOfValues,
ConstrainedVariable[] arrayOfVariables)
Returns a real constrained variable equal to the scalar product of an array of values "arrayOfValues"
and an array of variables "arrayOfVariables".
|
VarReal |
scalProd(double[] arrayOfValues,
VarReal[] arrayOfVariables)
Returns a real constrained variable equal to the scalar product of an array of values "arrayOfValues"
and an array of variables "arrayOfVariables".
|
Var |
scalProd(int[] arrayOfValues,
java.util.ArrayList<Var> listOfVariables) |
Var |
scalProd(int[] arrayOfValues,
Var[] arrayOfVariables)
Returns an integer constrained variable equal to the scalar product of an array of values "arrayOfValues"
and an array of variables "arrayOfVariables".
|
void |
setDomainType(DomainType type)
Sets the domain type that will be used as the default for subsequent creation
of variables using addVar-methods
|
void |
setName(java.lang.String name)
Sets the problem name
|
void |
setRealPrecision(double value)
Sets the precision for VarReals
|
void |
setSolver(Solver solver)
Associates a "solver" with the problem
making it available through the method "getSolver()".
|
void |
storeToXML(java.io.OutputStream os,
java.lang.String comment)
Emits an XML document representing this instance of the Problem.
|
Var |
sum(java.util.ArrayList<Var> vars)
Returns a constrained integer variable that is constrained to be
the sum of the variables in the ArrayList of Var "vars".
|
Var |
sum(Var[] vars)
Returns a constrained integer variable that is constrained to be
the sum of the variables in the array "vars".
|
VarReal |
sum(VarReal[] vars)
Returns a constrained integer variable that is constrained to be
the sum of the variables in the array "vars".
|
VarReal |
sum(VarReal var1,
VarReal var2)
Returns a constrained real variable that is constrained to be
the sum of the variables var1 and var2.
|
VarReal |
sum(VarReal var1,
VarReal var2,
VarReal var3)
Returns a constrained real variable that is constrained to be
the sum of the variables var1, var2, and var3.
|
Var |
sum(Var var1,
Var var2)
Returns a constrained integer variable that is constrained to be
the sum of the variables var1 and var2.
|
Var |
sum(Var var1,
Var var2,
Var var3)
Returns a constrained integer variable that is constrained to be
the sum of the variables var1, var2, and var3.
|
Var |
variable(int[] domain)
An equivalent of var("",domain)
|
Var |
variable(int min,
int max)
Creates a Var with domain [min;max].
|
Var |
variable(java.lang.String name,
int[] domain)
Creates a Var with the name "name" and domain containing the values in the array "domain"
of the default domain type, adds this variable to the problem, and returns the newly added Var.
|
Var |
variable(java.lang.String name,
int min,
int max)
Creates a Var by calling createVariable(name,min,max) and
adds this variable to the problem.
|
Var |
variable(java.lang.String name,
int min,
int max,
DomainType domainType)
Similar to variable(String name, int min, int max) but also has one more parameter
that defines the default domain type.
|
Var[] |
variableArray(java.lang.String name,
int min,
int max,
int size)
Creates an array of Var variables with the name "name" and domains [min;max], adds
this array of variables to the problem, and returns the newly added Var array.
|
VarBool |
variableBool()
Creates a boolean constrained variable without name.
|
VarBool |
variableBool(java.lang.String name)
Creates a boolean constrained variable with the name "name" and adds
this variable to the problem, and returns the newly added VarBool.
|
VarMatrix |
variableMatrix(java.lang.String name,
int min,
int max,
int rows,
int columns) |
VarReal |
variableReal(java.lang.String name)
Creates a VarReal with the name "name" and default domain [Problem.REAL_MIN;Problem.REAL_MAX], adds
this variable to the problem, and returns the newly added VarReal.
|
VarReal |
variableReal(java.lang.String name,
double min,
double max)
Creates a VarReal with the name "name" and domain [min;max], adds
this variable to the problem, and returns the newly added VarReal.
|
VarSet |
variableSet(java.lang.String name,
int[] values)
Creates a constrained set variable VarSet with the name "name"
and which domain consists of integer values from the array "value".
|
VarSet |
variableSet(java.lang.String name,
int min,
int max)
Creates a constrained set variable VarSet with the name "name"
and domain of integer values from "min" to "max" inclusive.
|
VarSet |
variableSet(java.lang.String name,
java.util.Set set)
Creates a constrained set variable VarSet with the name "name" and which
domain consists of integer values from the Set "set".
|
VarString |
variableString(java.lang.String name,
java.lang.String[] allStrings) |
static final java.lang.String JSR331_VERSION
Constraint add(Constraint constraint)
constraint
- the constraint to add to the problem.Var add(java.lang.String name, Var var)
name
- the new name for var.var
- the variable to add to the problem.Var add(Var var)
var
- the variable to add to the problem.VarBool add(VarBool var)
var
- the booolean constrained variable to add to the problem.VarReal add(VarReal var)
var
- the real variable to add to the problem.void add(VarString var)
Constraint allDiff(java.util.ArrayList<Var> vars)
vars
- the ArrayList of Var which must all take different values.java.lang.RuntimeException
- if the posting failsConstraint allDiff(Var[] vars)
vars
- the array of Vars which must all take different values.java.lang.RuntimeException
- if the posting failsboolean areThereProbabilityConstraints()
Var createVariable(java.lang.String name, int min, int max)
name
- the name for the new Var.min
- the minimum value in the domain for the new Var.max
- the maximum value in the domain for the new Var.VarReal createVariableReal(java.lang.String name, double min, double max)
name
- the name for the new VarReal.min
- the minimum value in the domain for the new VarReal.max
- the maximum value in the domain for the new VarReal.Var element(int[] array, Var indexVar)
array
- an array of integersindexVar
- a constrained integer variable whose domain serves as an index into
the array.VarSet element(java.util.Set<java.lang.Integer>[] sets, Var indexVar) throws java.lang.Exception
sets
- an array of Set objectsindexVar
- a constrained integer variablejava.lang.Exception
Var element(Var[] array, Var indexVar)
array
- an array of Var variables.indexVar
- a constrained integer variable whose domain serves as an index into
the array.java.lang.String getAPIVersion()
Constraint getConstraint(java.lang.String name)
name
- the name of the desired constraint.Constraint[] getConstraints()
Constraint getFalseConstraint()
java.lang.String getImplVersion()
java.lang.String getName()
double getRealPrecision()
Solver getSolver()
Var getTotalConstraintViolation()
Constraint getTrueConstraint()
Var getVar(java.lang.String name)
name
- the name of the desired variable.Var[] getVarArray(java.lang.String name)
name
- the name of the desired array of Var variables.VarBool[] getVarBools()
VarMatrix getVarMatrix(java.lang.String name)
VarReal getVarReal(java.lang.String name)
name
- the name of the desired variable.VarReal[] getVarReals()
Var[] getVars()
VarReal[] getVarSets()
VarString getVarString(java.lang.String name)
VarString[] getVarStrings()
Constraint linear(Var var, java.lang.String oper, int value)
Constraint linear(VarString var, java.lang.String oper, java.lang.String value)
Constraint linear(VarString var1, java.lang.String oper, VarString var2)
Constraint linear(Var var1, java.lang.String oper, Var var2)
void loadFromXML(java.io.InputStream in) throws java.lang.Exception
in
- the input stream from which to read the XML document.java.lang.Exception
- if reading from the specified input stream
results in an IOException or data on input stream does not
constitute a valid XML document with the mandated document type.void log(java.util.ArrayList<Var> vars)
void log(java.lang.String text)
void log(Var[] vars)
vars
- the array of Vars to log.void log(VarReal[] vars)
vars
- the array of VarReals to log.Var max(Var[] arrayOfVariables)
arrayOfVariables
- the array of variables from which we desire the maximal variable.Var max(Var var1, Var var2)
var1
- integer variablevar2
- integer variableVar min(Var[] arrayOfVariables)
arrayOfVariables
- the array of variables from which we desire the minimal variable.Var min(Var var1, Var var2)
var1
- integer variablevar2
- integer variable@Deprecated Constraint post(java.util.ArrayList<Var> vars, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(java.util.ArrayList<Var> vars, java.lang.String oper, Var var)
java.lang.RuntimeException
- if the posting failsvoid post(Constraint c)
c
- the constraint to post.java.lang.RuntimeException
- if the posting fails.@Deprecated Constraint post(double[] array, ConstrainedVariable[] vars, java.lang.String oper, ConstrainedVariable var)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(double[] array, ConstrainedVariable[] vars, java.lang.String oper, double value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(double[] array, VarReal[] vars, java.lang.String oper, double value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(double[] array, VarReal[] vars, java.lang.String oper, VarReal var)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(int[] array, java.util.ArrayList<Var> vars, java.lang.String oper, int value)
@Deprecated Constraint post(int[] array, Var[] vars, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(int[] array, Var[] vars, java.lang.String oper, Var var)
java.lang.RuntimeException
- if the posting failsConstraint post(java.lang.String name, java.lang.String symbolicExpression)
name
- the name for a new constraintsymbolicExpression
- a string that defines a constrained expression that uses
already defined variables, e.g. "x*y-z = 3*r"@Deprecated Constraint post(Var[] vars, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(Var[] vars, java.lang.String oper, Var var)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(VarReal[] vars, java.lang.String oper, double value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(VarReal[] vars, java.lang.String oper, VarReal var)
java.lang.RuntimeException
- if the posting failsConstraint post(VarReal var, java.lang.String oper, double value)
java.lang.RuntimeException
- if the posting failsConstraint post(VarReal var, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting failsConstraint post(VarReal var1, java.lang.String oper, Var var2)
java.lang.RuntimeException
- if the posting failsConstraint post(VarReal var1, java.lang.String oper, VarReal var2)
java.lang.RuntimeException
- if the posting failsConstraint post(Var var, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting failsConstraint post(VarString var, java.lang.String oper, java.lang.String value)
Constraint post(VarString var1, java.lang.String oper, VarString var2)
Constraint post(Var var1, java.lang.String oper, Var var2)
java.lang.RuntimeException
- if the posting failsConstraint post(Var var1, java.lang.String oper, VarReal var2)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(Var var1, Var var2, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting fails@Deprecated Constraint post(Var var1, Var var2, java.lang.String oper, Var var)
java.lang.RuntimeException
- if the posting failsConstraint postAllDiff(java.util.ArrayList<Var> vars)
Constraint postAllDiff(Var[] vars)
Constraint postAllDiff(VarString[] varStrings)
Constraint postAllDifferent(java.util.ArrayList<Var> vars)
Constraint postAllDifferent(Var[] vars)
vars
- the array of Vars which must all take different values.java.lang.RuntimeException
- if the posting failsConstraint postAnd(Constraint c1, Constraint c2)
c1
- a Constraintc2
- a ConstraintConstraint postCardinality(java.util.ArrayList<Var> vars, int cardValue, java.lang.String oper, int value)
Constraint postCardinality(java.util.ArrayList<Var> vars, int cardValue, java.lang.String oper, Var var)
Constraint postCardinality(java.util.ArrayList<Var> vars, Var cardVar, java.lang.String oper, int value)
Constraint postCardinality(java.util.ArrayList<Var> vars, Var cardVar, java.lang.String oper, Var var)
Constraint postCardinality(Var[] vars, int cardValue, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting failsConstraint postCardinality(Var[] vars, int cardValue, java.lang.String oper, Var var)
Constraint postCardinality(Var[] vars, Var cardVar, java.lang.String oper, int value)
Constraint postCardinality(Var[] vars, Var cardVar, java.lang.String oper, Var var)
Constraint postElement(int[] array, Var indexVar, java.lang.String oper, int value)
array
- an array of integers.indexVar
- a constrained integer variable whose domain serves as
an index into the "array".java.lang.RuntimeException
- if the posting failsConstraint postElement(int[] array, Var indexVar, java.lang.String oper, Var var)
array
- an array of integers.indexVar
- a constrained integer variable whose domain serves as
an index into the "array".java.lang.RuntimeException
- if the posting failsConstraint postElement(java.util.Set[] arrayOfSets, Var indexVar, java.lang.String oper, VarSet var)
arrayOfSets
- an array of integer sets.indexVar
- a constrained integer variable whose domain serves as
an index into the "arrayOfSets".java.lang.RuntimeException
- if the posting failsConstraint postElement(Var[] vars, Var indexVar, java.lang.String oper, int value)
java.lang.RuntimeException
- if the posting failsConstraint postElement(Var[] vars, Var indexVar, java.lang.String oper, Var var)
java.lang.RuntimeException
- if the posting failsConstraint postGlobalCardinality(java.util.ArrayList<Var> vars, int[] values, int[] cardMin, int[] cardMax)
Constraint postGlobalCardinality(java.util.ArrayList<Var> vars, int[] values, Var[] cardinalityVars)
Constraint postGlobalCardinality(Var[] vars, int[] values, int[] cardMin, int[] cardMax)
For each index i the number of times the value "values[i]" occurs in the array "vars" should be between cardMin[i] and cardMax[i] (inclusive)
vars
- array of constrained integer variablesvalues
- array of integer values within domain of all varscardMin
- array of integers that serves as lower bounds for values[i]cardMax
- array of integers that serves as upper bounds for values[i]
Note that arrays values, cardMin, and cardMax should have the same size
otherwise a RuntimeException will be thrownConstraint postGlobalCardinality(Var[] vars, int[] values, Var[] cardinalityVars)
For each index i the number of times the value "values[i]" occurs in the array "vars" is exactly "cardinalityVars[i]"
vars
- array of constrained integer variablescardinalityVars
- array of constrained integer variables (cardinality variables)values
- array of integer valuesjava.lang.RuntimeException
- if arrays “cardinalityVars” and "values" have different sizes.Constraint postIfThen(Constraint constraint1, Constraint constraint2)
constraint1
- If-Constraint in the implication.constraint2
- Then-Constraint in the implication.Constraint postIfThen(VarBool var1, VarBool var2)
var1
- the VarBoolvar2
- the VarBoolConstraint postMax(Var[] vars, java.lang.String oper, int value)
vars
- oper
- value
- Constraint postMax(Var[] vars, java.lang.String oper, Var var)
vars
- oper
- var
- Constraint postMin(Var[] vars, java.lang.String oper, int value)
vars
- oper
- value
- Constraint postMin(Var[] vars, java.lang.String oper, Var var)
vars
- oper
- var
- Constraint postOr(Constraint c1, Constraint c2)
c1
- a Constraintc2
- a ConstraintConstraint postScalProd(Var var, java.lang.String oper, int[] arrayOfValues, Var[] arrayOfVariables)
var
- the constraint variableoper
- arrayOfValues
- the array of values.arrayOfVariables
- the array of variables.VarReal scalProd(double[] arrayOfValues, ConstrainedVariable[] arrayOfVariables)
arrayOfValues
- the array of values.arrayOfVariables
- the array of variables.VarReal scalProd(double[] arrayOfValues, VarReal[] arrayOfVariables)
arrayOfValues
- the array of values.arrayOfVariables
- the array of variables.Var scalProd(int[] arrayOfValues, Var[] arrayOfVariables)
arrayOfValues
- the array of values.arrayOfVariables
- the array of variables.void setDomainType(DomainType type)
type
- void setName(java.lang.String name)
name
- void setRealPrecision(double value)
value
- the new precision for VarRealsvoid setSolver(Solver solver)
solver
- void storeToXML(java.io.OutputStream os, java.lang.String comment) throws java.lang.Exception
os
- the output stream on which to emit the XML document.comment
- a description of the property list, or null if no
comment is desired. If the specified comment is null then no
comment will be stored in the document.java.lang.Exception
- IOException - if writing to the specified
output stream results in an IOException; NullPointerException -
if os is null.Var sum(java.util.ArrayList<Var> vars)
vars
- the list of variables from which we desire the sum.Var sum(Var[] vars)
vars
- the array of variables from which we desire the sum.VarReal sum(VarReal[] vars)
vars
- the array of variables from which we desire the sum.VarReal sum(VarReal var1, VarReal var2)
var1,
- var2 - variables which we desire to sumVarReal sum(VarReal var1, VarReal var2, VarReal var3)
var1,
- var2, var3 - variables which we desire to sumVar sum(Var var1, Var var2)
var1,
- var2 - variables which we desire to sumVar sum(Var var1, Var var2, Var var3)
var1,
- var2, var3 - variables which we desire to sumVar variable(int[] domain)
domain
- an array specifying the values in the domain for the new Var.Var variable(int min, int max)
min
- the minimum value in the domain for the new Var.max
- the maximum value in the domain for the new Var.Var variable(java.lang.String name, int[] domain)
name
- the name for the new Var.domain
- an array specifying the values in the domain for the new Var.Var variable(java.lang.String name, int min, int max)
name
- the name for the new Var.min
- the minimum value in the domain for the new Var.max
- the maximum value in the domain for the new Var.Var variable(java.lang.String name, int min, int max, DomainType domainType)
name
- the name for the new Var.min
- the minimum value in the domain for the new Var.max
- the maximum value in the domain for the new Var.domainType
- DomainType
Var[] variableArray(java.lang.String name, int min, int max, int size)
name
- the name for the new Var array.min
- the minimum value in the domains for the new Vars in the new Var array.max
- the maximum value in the domain for the new Vars in the new Var array.size
- the number of Vars in the new Var array.VarBool variableBool()
VarBool variableBool(java.lang.String name)
name
- the name for the new Var.VarMatrix variableMatrix(java.lang.String name, int min, int max, int rows, int columns)
VarReal variableReal(java.lang.String name)
name
- the name for the new VarReal.VarReal variableReal(java.lang.String name, double min, double max)
name
- the name for the new VarReal.min
- the minimum value in the domain for the new VarReal.max
- the maximum value in the domain for the new VarReal.VarSet variableSet(java.lang.String name, int[] values) throws java.lang.Exception
name
- values
- java.lang.Exception
VarSet variableSet(java.lang.String name, int min, int max) throws java.lang.Exception
name
- min
- max
- java.lang.Exception
VarSet variableSet(java.lang.String name, java.util.Set set) throws java.lang.Exception
name
- java.lang.Exception
VarString variableString(java.lang.String name, java.lang.String[] allStrings)