javax.constraints
Interface Solution

All Known Implementing Classes:
BasicSolution

public interface Solution

This interface defines a solution of a Problem. It includes values for all constrained variables that were added to the problem and were instantiated using a Solver.


Method Summary
 int getAt(java.lang.String name)
          A synonym for getValue(name).
 int getMax(int i)
          Returns the maximum value in the domain of the solution variable with index i.
 int getMax(java.lang.String name)
          Returns the maximum value in the domain of the solution variable with the given name.
 int getMin(int i)
          Returns the minimum value in the domain of the solution variable with the index i.
 int getMin(java.lang.String name)
          Returns the minimum value in the domain of the solution variable with the given name.
 int getNumberOfVarReals()
          Returns the number of decision real variables in the solution
 int getNumberOfVars()
          Returns the number of decision integer variables in the solution
 int getNumberOfVarSets()
          Returns the number of decision set variables in the solution
 Problem getProblem()
          Returns the problem that this Solution is a solution to.
 double getRealValue(int i)
          Returns the value of the solution real variable with the index i, throws a RuntimeException if the real variable is not bound.
 double getRealValue(java.lang.String name)
          Returns the value of the solution real variable with the given name, throws a RuntimeException if the real variable is not bound.
 int getSolutionNumber()
          Returns the number identifying this Solution.
 Solver getSolver()
          Returns the solver that created this Solution.
 int getValue(int i)
          Returns the value of the solution variable with the index i, throws a RuntimeException if the variable is not bound.
 int getValue(java.lang.String name)
          Returns the value of the solution variable with the given name, throws a RuntimeException if the variable is not bound.
 boolean isBound()
          Returns true if all the solution variables are bound, i.e.
 boolean isBound(int i)
          Returns true if the domain of the solution variable with the index i is a single value, i.e.
 boolean isBound(java.lang.String name)
          Returns true if the domain of the solution variable with the given name is a single value, i.e.
 void log()
          Logs the solution in the information log
 void log(int varPerLine)
          Logs the solution in the information log.
 void setSolutionNumber(int number)
          Sets the number identifying this Solution.
 

Method Detail

getAt

int getAt(java.lang.String name)
A synonym for getValue(name). Used by Groovy to overload the operator solution["Name"]

Parameters:
name -
Returns:
the value of solution variable with the given name, assuming that the variable is bound.
Throws:
java.lang.RuntimeException - if the solution variable is not bound.

getMax

int getMax(int i)
Returns the maximum value in the domain of the solution variable with index i.

Parameters:
i - the index of the desired solution variable.
Returns:
maximum value of the solution variable with the given name.

getMax

int getMax(java.lang.String name)
Returns the maximum value in the domain of the solution variable with the given name.

Parameters:
name - the name of the desired solution variable.
Returns:
maximum value of the solution variable with the given name.

getMin

int getMin(int i)
Returns the minimum value in the domain of the solution variable with the index i.

Parameters:
i - the index of the desired solution variable.
Returns:
minimum value of the solution variable with the given name.

getMin

int getMin(java.lang.String name)
Returns the minimum value in the domain of the solution variable with the given name.

Parameters:
name - the name of the desired solution variable.
Returns:
minimum value of the solution variable with the given name.

getNumberOfVarReals

int getNumberOfVarReals()
Returns the number of decision real variables in the solution

Returns:
the number of decision real variables in the solution

getNumberOfVars

int getNumberOfVars()
Returns the number of decision integer variables in the solution

Returns:
the number of decision integer variables in the solution

getNumberOfVarSets

int getNumberOfVarSets()
Returns the number of decision set variables in the solution

Returns:
the number of decision set variables in the solution

getProblem

Problem getProblem()
Returns the problem that this Solution is a solution to.

Returns:
the problem that this Solution is a solution to.

getRealValue

double getRealValue(int i)
Returns the value of the solution real variable with the index i, throws a RuntimeException if the real variable is not bound.

Parameters:
i - the index of the desired solution real variable .
Returns:
the value of solution real variable with the given name, assuming that the real variable is bound.
Throws:
java.lang.RuntimeException - if the solution real variable is not bound.

getRealValue

double getRealValue(java.lang.String name)
Returns the value of the solution real variable with the given name, throws a RuntimeException if the real variable is not bound.

Parameters:
name - the name of the desired solution real variable .
Returns:
the value of solution real variable with the given name, assuming that the real variable is bound.
Throws:
java.lang.RuntimeException - if the solution real variable is not bound.

getSolutionNumber

int getSolutionNumber()
Returns the number identifying this Solution.

Returns:
the number identifying this Solution.

getSolver

Solver getSolver()
Returns the solver that created this Solution.

Returns:
the solver that created this Solution.

getValue

int getValue(int i)
Returns the value of the solution variable with the index i, throws a RuntimeException if the variable is not bound.

Parameters:
i - the index of the desired solution variable .
Returns:
the value of solution variable with the given name, assuming that the variable is bound.
Throws:
java.lang.RuntimeException - if the solution variable is not bound.

getValue

int getValue(java.lang.String name)
Returns the value of the solution variable with the given name, throws a RuntimeException if the variable is not bound.

Parameters:
name - the name of the desired solution variable .
Returns:
the value of solution variable with the given name, assuming that the variable is bound.
Throws:
java.lang.RuntimeException - if the solution variable is not bound.

isBound

boolean isBound()
Returns true if all the solution variables are bound, i.e. if isBound(name) returns true for all solution variables.

Returns:
true if all the solutions variables are bound.
See Also:
isBound(String)

isBound

boolean isBound(int i)
Returns true if the domain of the solution variable with the index i is a single value, i.e. getMin(name) == getMax(name).

Parameters:
i - the index of the desired solution variable.
Returns:
true if the domain of the solution variable with the given name is a single value.

isBound

boolean isBound(java.lang.String name)
Returns true if the domain of the solution variable with the given name is a single value, i.e. getMin(name) == getMax(name).

Parameters:
name - the name of the desired solution variable.
Returns:
true if the domain of the solution variable with the given name is a single value.

log

void log()
Logs the solution in the information log


log

void log(int varPerLine)
Logs the solution in the information log. Logs only "varPerLine" variables per line. By default varPerLine = 8.


setSolutionNumber

void setSolutionNumber(int number)
Sets the number identifying this Solution.

Parameters:
number - the number identifying this Solution.