javax.constraints
Interface Problem

All Known Implementing Classes:
AbstractProblem, ProblemDelegator

public interface Problem

A constraint satisfaction problem Problem can be defined in terms of constrained variables and constraints. The standard will cover the following types of Constrained Variables:

The standard will cover the following Constraints:

Problem Definition is completely independent of the Problem Resolution (class Solver).

See Also:
ConstrainedVariable, Var, Constraint, Solver

Field Summary
static java.lang.String JSR331_VERSION
           
 
Method Summary
 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(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.
 Constraint allDiff(VarList 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.
 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.
 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".
 Var element(VarList list, Var 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.
 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(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.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(VarList vars)
           
 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(VarList listOfVariables)
           
 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(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(VarList listOfVariables)
           
 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.
 void post(Constraint c)
          Posts the constraint "c".
 Constraint post(int[] array, Var[] vars, java.lang.String oper, int value)
          Creates and posts a constraint: array*vars value
 Constraint post(int[] array, Var[] vars, java.lang.String oper, Var var)
          Creates and posts a constraint: array*vars var
 Constraint post(int[] array, VarList vars, java.lang.String oper, int value)
           
 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)
          Creates and posts a constraint: sum of vars value
 Constraint post(Var[] vars, java.lang.String oper, Var var)
          Creates and posts a constraint: sum of vars "oper" var
 Constraint post(VarList vars, java.lang.String oper, int value)
          Creates and posts a constraint: sum of vars value
 Constraint post(VarList vars, java.lang.String oper, Var var)
          Creates and posts a constraint: sum of vars "oper" var
 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, Var var2, java.lang.String oper, int value)
          Creates and posts a constraint: (var1 + var2) "oper" value
 Constraint post(Var var1, Var var2, java.lang.String oper, Var var)
          Creates and posts a constraint: (var1 + var2) "oper" var
 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 constraintAllDifferent
 Constraint postAllDifferent(java.util.ArrayList<Var> vars)
          Similar to postAllDifferent for variables saved in the ArrayList vars
 Constraint postAllDifferent(java.util.List 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 postAllDifferent(VarList vars)
           
 Constraint postAnd(Constraint c1, Constraint c2)
          Creates and posts a constraint an "AND" Constraint.
 Constraint postCardinality(Var[] vars, int cardValue, java.lang.String oper, int value)
          This method creates and posts a new cardinality constraint “cardinality(vars,cardValue) < 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 postCardinality(VarList vars, int cardValue, java.lang.String oper, int value)
           
 Constraint postCardinality(VarList vars, int cardValue, java.lang.String oper, Var var)
           
 Constraint postCardinality(VarList vars, Var cardVar, java.lang.String oper, int value)
           
 Constraint postCardinality(VarList vars, Var cardVar, java.lang.String oper, Var var)
           
 Constraint postElement(int[] array, Var indexVar, java.lang.String oper, int value)
          Creates and posts a new constraint: array[indexVar] 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] 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] 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] value
 Constraint postElement(Var[] vars, Var indexVar, java.lang.String oper, Var var)
          Posts a new constraint: vars[indexVar] var
 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 postGlobalCardinality(VarList vars, int[] values, int[] cardMin, int[] cardMax)
           
 Constraint postGlobalCardinality(VarList vars, int[] values, Var[] cardinalityVars)
           
 Constraint postIfThen(Constraint constraint1, Constraint constraint2)
          Creates and posts a constraint that states the implication: constraint1 => constraint2.
 Constraint postLinear(int[] array, Var[] vars, java.lang.String oper, int value)
          Synonym for constraint(int[] array, Var[] vars, String oper, int value)
 Constraint postLinear(int[] array, Var[] vars, java.lang.String oper, Var var)
          Synonym for constraint(int[] array, Var[] vars, String oper, Var var)
 Constraint postLinear(int[] array, VarList vars, java.lang.String oper, int value)
           
 Constraint postLinear(Var[] vars, java.lang.String oper, int value)
          Synonym for constraint(Var[] vars, String oper, int value)
 Constraint postLinear(Var[] vars, java.lang.String oper, Var var)
          Synonym for constraint(Var[] vars, String oper, Var var)
 Constraint postLinear(Var var, java.lang.String oper, int value)
          Synonym for constraint(Var var, String oper, int value)
 Constraint postLinear(Var var1, java.lang.String oper, Var var2)
          Synonym for constraint(Var var1, String oper, Var var2)
 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.
 Var scalProd(int[] arrayOfValues, Var[] arrayOfVariables)
          Returns a constrained variable equal to the scalar product of an array of values "arrayOfValues" and an array of variables "arrayOfVariables".
 Var scalProd(int[] arrayOfValues, VarList listOfVariables)
           
 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(Var[] vars)
          Returns a constrained integer variable that is constrained to be the sum of the variables in the array "vars".
 Var sum(VarList vars)
          Returns a constrained integer variable that is constrained to be the sum of the variables in the VarList "vars".
 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.
 VarList variableList()
           
 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)
           
 

Field Detail

JSR331_VERSION

static final java.lang.String JSR331_VERSION
See Also:
Constant Field Values
Method Detail

add

Constraint add(Constraint constraint)
Adds a Constraint "constraint" to the problem, then returns the constraint. The Constraint is not posted.

Parameters:
constraint - the constraint to add to the problem.
Returns:
the Constraint added to the problem.

add

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.

Parameters:
name - the new name for var.
var - the variable to add to the problem.
Returns:
the Var variable added to the problem.

add

Var add(Var var)
Adds a Var variable "var" to the problem, and returns the newly added Var.

Parameters:
var - the variable to add to the problem.
Returns:
the Var variable added to the problem.

add

VarBool add(VarBool var)
Adds a VarBool variable "var" to the problem, and returns the newly added VarBool.

Parameters:
var - the booolean constrained variable to add to the problem.
Returns:
the VarBool variable added to the problem.

add

VarReal add(VarReal var)
Adds a VarReal variable "var" to the problem, and returns the newly added VarReal.

Parameters:
var - the real variable to add to the problem.
Returns:
the VarReal variable added to the problem.

add

void add(VarString var)

allDiff

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. To have an effect the constraint should be posted using Constraint's methods post() or post(ConsistencyLevel consistencyLevel)

Parameters:
vars - the array of Vars which must all take different values.
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

allDiff

Constraint allDiff(VarList 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. To have an effect the constraint should be posted using Constraint's methods post() or post(ConsistencyLevel consistencyLevel)

Parameters:
vars - the VarList which must all take different values.
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

createVariable

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. The variable will be created with the default domain type or by the latest call of the method setDomainType().

Parameters:
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.
Returns:
the Var variable created and added to the problem.

element

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". When index is bound to the value i, the value of the resulting variable is array[i]. More generally, the domain of the returned variable is the set of values array[i] where the i are in the domain of index.

Parameters:
array - an array of integers
indexVar - a constrained integer variable whose domain serves as an index into the array.
Returns:
a constrained integer variable whose domain is the set of values array[i] where each i is in the domain of "indexVar".

element

VarSet element(java.util.Set<java.lang.Integer>[] sets,
               Var indexVar)
               throws java.lang.Exception
Creates a set variable that corresponds to sets[index]

Parameters:
sets - an array of Set objects
indexVar - a constrained integer variable
Returns:
a set variable that corresponds to sets[index]
Throws:
java.lang.Exception

element

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". When index is bound to the value i, the value of the resulting variable is array[i]. More generally, the domain of the returned variable is the set of values array[i] where the i are in the domain of index.

Parameters:
array - an array of Var variables.
indexVar - a constrained integer variable whose domain serves as an index into the array.
Returns:
a constrained integer variable whose domain is the set of values array[i] where each i is in the domain of "indexVar".

element

Var element(VarList list,
            Var indexVar)

getAPIVersion

java.lang.String getAPIVersion()
Returns JSR331 API version number

Returns:
JSR331 API version number

getConstraint

Constraint getConstraint(java.lang.String name)
Returns the Constraint the name "name", or null if no such constraints exists in the problem.

Parameters:
name - the name of the desired constraint.
Returns:
the Constraint the name "name", or null if no such constraints exists in the problem.

getConstraints

Constraint[] getConstraints()
Returns an array of Constraints previously added to the problem.

Returns:
an array of Constraints previously added to the problem.

getFalseConstraint

Constraint getFalseConstraint()
Returns the constant constraint that always will fail when it is posted or executed.

Returns:
the False Constraint

getImplVersion

java.lang.String getImplVersion()
Returns JSR331 Implementation version number

Returns:
JSR331 Implementation version number

getName

java.lang.String getName()
Returns the problem name

Returns:
the problem name

getRealPrecision

double getRealPrecision()
Returns the precision for VarReals

Returns:
the precision for VarReals

getSolver

Solver getSolver()
Returns an instance of a Solver associated with this problem. If a solver is not defined yet, creates a new Solver and associates it with the problem.

Returns:
a solver

getTrueConstraint

Constraint getTrueConstraint()
Returns the constant constraint that always succeeds when it is posted or executed.

Returns:
the True Constraint

getVar

Var getVar(java.lang.String name)
Returns the Var variable with the name "name", or null if no such variable exists in the problem.

Parameters:
name - the name of the desired variable.
Returns:
the Var variable with the name "name", or null if no such variable exists in the problem.

getVarArray

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.

Parameters:
name - the name of the desired array of Var variables.
Returns:
the array of Var variables with the name "name", or null if no such array exists in the problem.

getVarBools

VarBool[] getVarBools()
Returns an array containing the VarBool variables previously added to the problem.

Returns:
an array containing the VarBool variables previously added to the problem.

getVarMatrix

VarMatrix getVarMatrix(java.lang.String name)

getVarReal

VarReal getVarReal(java.lang.String name)
Returns the VarReal variable with the name "name", or null if no such variable exists in the problem.

Parameters:
name - the name of the desired variable.
Returns:
the VarReal variable with the name "name", or null if no such variable exists in the problem.

getVarReals

VarReal[] getVarReals()
Returns an array containing the VarReal variables previously added to the problem.

Returns:
an array containing the VarReal variables previously added to the problem.

getVars

Var[] getVars()
Returns an array containing the Var variables previously added to the problem.

Returns:
an array containing the Var variables previously added to the problem.

getVarSets

VarReal[] getVarSets()
Returns an array containing the VarSet variables previously added to the problem.

Returns:
an array containing the VarSet variables previously added to the problem.

getVarString

VarString getVarString(java.lang.String name)

getVarStrings

VarString[] getVarStrings()

linear

Constraint linear(Var var,
                  java.lang.String oper,
                  int value)
Creates a constraint: var "oper" value without posting

Returns:
a newly created constraint

linear

Constraint linear(VarString var,
                  java.lang.String oper,
                  java.lang.String value)

linear

Constraint linear(Var var1,
                  java.lang.String oper,
                  Var var2)
Creates a constraint: var1 "oper" var2 without posting

Returns:
a newly created constraint

loadFromXML

void loadFromXML(java.io.InputStream in)
                 throws java.lang.Exception
Loads a Problem represented by the XML document on the specified input stream into this instance of the Problem

Parameters:
in - the input stream from which to read the XML document.
Throws:
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.

log

void log(java.lang.String text)
Logs (displays) the String parameter "text"


log

void log(Var[] vars)
Logs the integer constrained variables contained in the array "vars".

Parameters:
vars - the array of Vars to log.

log

void log(VarList vars)

max

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.

Parameters:
arrayOfVariables - the array of variables from which we desire the maximal variable.
Returns:
a constrained integer variable that is equal to the maximal variable in the array "arrayOfVariables" when they are all instantiated.

max

Var max(VarList listOfVariables)

max

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.

Parameters:
var1 - integer variable
var2 - integer variable
Returns:
a constrained integer variable that is equal to the maximal of two variablea var1 or var 2 when they are both instantiated.

min

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.

Parameters:
arrayOfVariables - the array of variables from which we desire the minimal variable.
Returns:
a constrained integer variable that is equal to the minimal variable in the array "arrayOfVariables" when they are all instantiated.

min

Var min(VarList listOfVariables)

min

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.

Parameters:
var1 - integer variable
var2 - integer variable
Returns:
a constrained integer variable that is equal to the minimal of two variablea var1 or var 2 when they are both instantiated.

post

void post(Constraint c)
Posts the constraint "c". Throws a RuntimeException if a failure happens during the posting.

Parameters:
c - the constraint to post.
Throws:
java.lang.RuntimeException - if the posting fails.

post

Constraint post(int[] array,
                Var[] vars,
                java.lang.String oper,
                int value)
Creates and posts a constraint: array*vars value

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(int[] array,
                Var[] vars,
                java.lang.String oper,
                Var var)
Creates and posts a constraint: array*vars var

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(int[] array,
                VarList vars,
                java.lang.String oper,
                int value)

post

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. It is assumed that all variables in the expression were previously created under names used within this expression. If the returned Constraint is null, there is either an error inside the symbolicExpression or there is no concrete solver implementation of this method. In either case, the constraint will not have been added to the problem.

Parameters:
name - the name for a new constraint
symbolicExpression - a string that defines a constrained expression that uses already defined variables, e.g. "x*y-z<3*r"
Returns:
the constraint created and added to the problem, or null if there is an error inside the symbolicExpression or if this method is not defined by a concrete solver implementation.

post

Constraint post(Var[] vars,
                java.lang.String oper,
                int value)
Creates and posts a constraint: sum of vars value

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(Var[] vars,
                java.lang.String oper,
                Var var)
Creates and posts a constraint: sum of vars "oper" var

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(VarList vars,
                java.lang.String oper,
                int value)
Creates and posts a constraint: sum of vars value

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(VarList vars,
                java.lang.String oper,
                Var var)
Creates and posts a constraint: sum of vars "oper" var

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(Var var,
                java.lang.String oper,
                int value)
Creates and posts a constraint: var "oper" value

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(VarString var,
                java.lang.String oper,
                java.lang.String value)

post

Constraint post(VarString var1,
                java.lang.String oper,
                VarString var2)

post

Constraint post(Var var1,
                java.lang.String oper,
                Var var2)
Creates and posts a constraint: var1 "oper" var2

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(Var var1,
                Var var2,
                java.lang.String oper,
                int value)
Creates and posts a constraint: (var1 + var2) "oper" value

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

post

Constraint post(Var var1,
                Var var2,
                java.lang.String oper,
                Var var)
Creates and posts a constraint: (var1 + var2) "oper" var

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postAllDiff

Constraint postAllDiff(java.util.ArrayList<Var> vars)
Similar to postAllDiff for variables saved in the ArrayList vars


postAllDiff

Constraint postAllDiff(Var[] vars)
This constraint is a synonym for constraintAllDifferent


postAllDifferent

Constraint postAllDifferent(java.util.ArrayList<Var> vars)
Similar to postAllDifferent for variables saved in the ArrayList vars


postAllDifferent

Constraint postAllDifferent(java.util.List vars)

postAllDifferent

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.

Parameters:
vars - the array of Vars which must all take different values.
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postAllDifferent

Constraint postAllDifferent(VarList vars)

postAnd

Constraint postAnd(Constraint c1,
                   Constraint c2)
Creates and posts a constraint an "AND" Constraint. The Constraint "AND" is satisfied if both of the Constraints "c1" and "c2" are satisfied. The Constraint "AND" is not satisfied if at least one of the Constraints "c1" or "c2" are not satisfied.

Parameters:
c1 - a Constraint
c2 - a Constraint
Returns:
a Constraint "AND" between the Constraints "c1" and "c2".

postCardinality

Constraint postCardinality(Var[] vars,
                           int cardValue,
                           java.lang.String oper,
                           int value)
This method creates and posts a new cardinality constraint “cardinality(vars,cardValue) < value”. Here “cardinality(vars,cardValue)” denotes a constrained integer variable that is equal to the number of those elements in the array "vars" that are bound to the "cardValue". For example, if “oper” is "<" it means that the variable “cardinality(vars,cardValue)” must be less than the “value”. This constraint does NOT assume a creation of an intermediate variable "cardinality(vars,cardValue)".

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postCardinality

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”.


postCardinality

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"


postCardinality

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"


postCardinality

Constraint postCardinality(VarList vars,
                           int cardValue,
                           java.lang.String oper,
                           int value)

postCardinality

Constraint postCardinality(VarList vars,
                           int cardValue,
                           java.lang.String oper,
                           Var var)

postCardinality

Constraint postCardinality(VarList vars,
                           Var cardVar,
                           java.lang.String oper,
                           int value)

postCardinality

Constraint postCardinality(VarList vars,
                           Var cardVar,
                           java.lang.String oper,
                           Var var)

postElement

Constraint postElement(int[] array,
                       Var indexVar,
                       java.lang.String oper,
                       int value)
Creates and posts a new constraint: array[indexVar] value Here "array[indexVar]" denotes a constrained integer variable, which domain consists of integers array[i] where i is within domain of the "indexVar". When indexVar is bound to the value v, the value of the resulting variable is array[v]. The operator "oper" defines the type of relationships between "array[indexVar]" and "value"

Parameters:
array - an array of integers.
indexVar - a constrained integer variable whose domain serves as an index into the "array".
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postElement

Constraint postElement(int[] array,
                       Var indexVar,
                       java.lang.String oper,
                       Var var)
Creates and posts a constraint: array[indexVar] var Here "array[indexVar]" denotes a constrained integer variable, which domain consists of integers array[i] where i is within domain of the "indexVar". When indexVar is bound to the value v, the value of the resulting variable is array[v]. The operator "oper" defines the type of relationships between "array[indexVar]" and "var"

Parameters:
array - an array of integers.
indexVar - a constrained integer variable whose domain serves as an index into the "array".
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postElement

Constraint postElement(java.util.Set[] arrayOfSets,
                       Var indexVar,
                       java.lang.String oper,
                       VarSet var)
Creates and posts a constraint: arrayOfSets[indexVar] 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". When indexVar is bound to the value v, the value of the resulting variable is arrayOfSets[v]. The operator "oper" defines the type of relationships between "arrayOfSets[indexVar]" and "setVar"

Parameters:
arrayOfSets - an array of integer sets.
indexVar - a constrained integer variable whose domain serves as an index into the "arrayOfSets".
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postElement

Constraint postElement(Var[] vars,
                       Var indexVar,
                       java.lang.String oper,
                       int value)
Posts a constraint: vars[indexVar] value

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postElement

Constraint postElement(Var[] vars,
                       Var indexVar,
                       java.lang.String oper,
                       Var var)
Posts a new constraint: vars[indexVar] var

Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if the posting fails

postGlobalCardinality

Constraint postGlobalCardinality(Var[] vars,
                                 int[] values,
                                 int[] cardMin,
                                 int[] cardMax)
Creates and posts a new global cardinality constraint that states:

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)

Parameters:
vars - array of constrained integer variables
values - array of integer values within domain of all vars
cardMin - 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 thrown

postGlobalCardinality

Constraint postGlobalCardinality(Var[] vars,
                                 int[] values,
                                 Var[] cardinalityVars)
Creates and posts a new global cardinality constraint that states:

For each index i the number of times the value "values[i]" occurs in the array "vars" is exactly "cardinalityVars[i]"

Parameters:
vars - array of constrained integer variables
cardinalityVars - array of constrained integer variables (cardinality variables)
values - array of integer values
Returns:
a newly created constraint
Throws:
java.lang.RuntimeException - if arrays “cardinalityVars” and "values" have different sizes.

postGlobalCardinality

Constraint postGlobalCardinality(VarList vars,
                                 int[] values,
                                 int[] cardMin,
                                 int[] cardMax)

postGlobalCardinality

Constraint postGlobalCardinality(VarList vars,
                                 int[] values,
                                 Var[] cardinalityVars)

postIfThen

Constraint postIfThen(Constraint constraint1,
                      Constraint constraint2)
Creates and posts a constraint that states the implication: constraint1 => constraint2. In other words, if this constraint1 is satisfied, then constraint2 should also be satisfied.

Parameters:
constraint1 - If-Constraint in the implication.
constraint2 - Then-Constraint in the implication.
Returns:
a Constraint that means: if constraint1 then constraint2

postLinear

Constraint postLinear(int[] array,
                      Var[] vars,
                      java.lang.String oper,
                      int value)
Synonym for constraint(int[] array, Var[] vars, String oper, int value)


postLinear

Constraint postLinear(int[] array,
                      Var[] vars,
                      java.lang.String oper,
                      Var var)
Synonym for constraint(int[] array, Var[] vars, String oper, Var var)


postLinear

Constraint postLinear(int[] array,
                      VarList vars,
                      java.lang.String oper,
                      int value)

postLinear

Constraint postLinear(Var[] vars,
                      java.lang.String oper,
                      int value)
Synonym for constraint(Var[] vars, String oper, int value)


postLinear

Constraint postLinear(Var[] vars,
                      java.lang.String oper,
                      Var var)
Synonym for constraint(Var[] vars, String oper, Var var)


postLinear

Constraint postLinear(Var var,
                      java.lang.String oper,
                      int value)
Synonym for constraint(Var var, String oper, int value)


postLinear

Constraint postLinear(Var var1,
                      java.lang.String oper,
                      Var var2)
Synonym for constraint(Var var1, String oper, Var var2)


postMax

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.

Parameters:
vars -
oper -
value -

postMax

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.

Parameters:
vars -
oper -
var -

postMin

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.

Parameters:
vars -
oper -
value -

postMin

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.

Parameters:
vars -
oper -
var -

postOr

Constraint postOr(Constraint c1,
                  Constraint c2)
Creates and posts a constraint an "OR" Constraint. The Constraint "OR" is satisfied if at least one of constraints "c1" or "c2" are satisfied. The Constraint "OR" is not satisfied if both constraints "c1" or "c2" are not satisfied.

Parameters:
c1 - a Constraint
c2 - a Constraint
Returns:
a Constraint "OR" between the Constraints "c1" and "c2".

scalProd

Var scalProd(int[] arrayOfValues,
             Var[] arrayOfVariables)
Returns a constrained variable equal to the scalar product of an array of values "arrayOfValues" and an array of variables "arrayOfVariables".

Parameters:
arrayOfValues - the array of values.
arrayOfVariables - the array of variables.
Returns:
a constrained variable equal to the scalar product of an array of values "arrayOfValues" and an array of variables "arrayOfVariables".

scalProd

Var scalProd(int[] arrayOfValues,
             VarList listOfVariables)

setDomainType

void setDomainType(DomainType type)
Sets the domain type that will be used as the default for subsequent creation of variables using addVar-methods

Parameters:
type -

setName

void setName(java.lang.String name)
Sets the problem name

Parameters:
name -

setRealPrecision

void setRealPrecision(double value)
Sets the precision for VarReals

Parameters:
value - the new precision for VarReals

setSolver

void setSolver(Solver solver)
Associates a "solver" with the problem making it available through the method "getSolver()".

Parameters:
solver -

storeToXML

void storeToXML(java.io.OutputStream os,
                java.lang.String comment)
                throws java.lang.Exception
Emits an XML document representing this instance of the Problem.

Parameters:
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.
Throws:
java.lang.Exception - IOException - if writing to the specified output stream results in an IOException; NullPointerException - if os is null.

sum

Var sum(Var[] vars)
Returns a constrained integer variable that is constrained to be the sum of the variables in the array "vars".

Parameters:
vars - the array of variables from which we desire the sum.
Returns:
a constrained integer variable that is equal to the sum of the variables in the array "var".

sum

Var sum(VarList vars)
Returns a constrained integer variable that is constrained to be the sum of the variables in the VarList "vars".

Parameters:
vars - the list of variables from which we desire the sum.
Returns:
a constrained integer variable that is equal to the sum of the variables in the array "var".

variable

Var variable(int[] domain)
An equivalent of var("",domain)

Parameters:
domain - an array specifying the values in the domain for the new Var.
Returns:
the Var variable created and added to the problem.

variable

Var variable(int min,
             int max)
Creates a Var with domain [min;max]. The variable will be created with the default domain type or by the latest call of the method setDomainType(). This variable has an empty name and is not added to the problem.

Parameters:
min - the minimum value in the domain for the new Var.
max - the maximum value in the domain for the new Var.
Returns:
the Var created variable

variable

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. The variable will be created with the default domain type or by the latest call of the method setDomainType().

Parameters:
name - the name for the new Var.
domain - an array specifying the values in the domain for the new Var.
Returns:
the Var variable created and added to the problem.

variable

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. The variable will be created with the default domain type or by the latest call of the method setDomainType().

Parameters:
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.
Returns:
the Var variable created and added to the problem.

variable

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. .

Parameters:
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
Returns:
the Var variable created and added to the problem.

variableArray

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. The "size" parameter specifies how many Var variables are contained in this new array. The variables will be created with the default domain type or as defined by the latest call of the method setDomainType().

Parameters:
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.
Returns:
the array of Var variables created and added to the problem.

variableBool

VarBool variableBool()
Creates a boolean constrained variable without name. This variable is not added to the problem,

Returns:
the Var variable created

variableBool

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.

Parameters:
name - the name for the new Var.
Returns:
the Var variable created and added to the problem.

variableList

VarList variableList()

variableMatrix

VarMatrix variableMatrix(java.lang.String name,
                         int min,
                         int max,
                         int rows,
                         int columns)

variableReal

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.

Parameters:
name - the name for the new VarReal.
Returns:
the VarReal variable created and added to the problem.

variableReal

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.

Parameters:
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.
Returns:
the VarReal variable created and added to the problem.

variableSet

VarSet variableSet(java.lang.String name,
                   int[] values)
                   throws java.lang.Exception
Creates a constrained set variable VarSet with the name "name" and which domain consists of integer values from the array "value".

Parameters:
name -
values -
Returns:
the VarSet variable created and added to the problem.
Throws:
java.lang.Exception

variableSet

VarSet variableSet(java.lang.String name,
                   int min,
                   int max)
                   throws java.lang.Exception
Creates a constrained set variable VarSet with the name "name" and domain of integer values from "min" to "max" inclusive. This interface show how to create a new constrained set variable which, when bound, is equal to a set of elements. The domain of a constrained set variable is a set of Sets that consist of regular integers.The cardinality of a set constrained variable is an integer constrained variable.

Parameters:
name -
min -
max -
Returns:
a new VarSet variable
Throws:
java.lang.Exception

variableSet

VarSet variableSet(java.lang.String name,
                   java.util.Set set)
                   throws java.lang.Exception
Creates a constrained set variable VarSet with the name "name" and which domain consists of integer values from the Set "set".

Parameters:
name -
Returns:
the VarSet variable created and added to the problem.
Throws:
java.lang.Exception

variableString

VarString variableString(java.lang.String name,
                         java.lang.String[] allStrings)