|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjopt.csp.solution.SolutionScope
jopt.csp.solution.SolverSolution
Implementation of a solution that is produced by a solver
Constructor Summary | |
SolverSolution()
Creates a new solution with no variables defined within the scope. |
|
SolverSolution(SolutionScope scope)
Creates a new solution for the scope requested |
Method Summary | |
BooleanSolution |
add(CspBooleanVariable var)
Adds a boolean variable solution |
DoubleSolution |
add(CspDoubleVariable var)
Adds a double variable solution |
FloatSolution |
add(CspFloatVariable var)
Adds a float variable solution |
IntSolution |
add(CspIntVariable var)
Adds an integer variable solution |
LongSolution |
add(CspLongVariable var)
Adds a long variable solution |
SetSolution |
add(CspSetVariable var)
Adds a set variable solution |
void |
add(CspVariable var)
Adds a variable to record in a solution |
void |
clear(CspBooleanVariable var)
Clears the isTrue / isFalse flag and sets variable to an unbound state |
void |
copy(SolverSolution sol)
Copies all data in one solution over the data in this solution. |
static SolverSolution |
createNeighbor(SolverSolution initial,
SolverSolution result)
Creates a neighboring solution that will produce a resulting solution from an initial solution |
float |
getFloatObjectiveVal()
Returns objective value as an integer type |
int |
getIntObjectiveVal()
Returns objective value as an integer type |
long |
getLongObjectiveVal()
Returns objective value as a long type |
double |
getMax(CspDoubleVariable var)
Retrieves maximum value of solution for the specified variable |
float |
getMax(CspFloatVariable var)
Retrieves maximum value of solution for the specified variable |
int |
getMax(CspIntVariable var)
Retrieves maximum value of solution |
long |
getMax(CspLongVariable var)
Retrieves maximum value of solution for the specified variable |
double |
getMin(CspDoubleVariable var)
Retrieves minimum value of solution for the specified variable |
float |
getMin(CspFloatVariable var)
Retrieves minimum value of solution for the specified variable |
int |
getMin(CspIntVariable var)
Retrieves minimum value of solution |
long |
getMin(CspLongVariable var)
Retrieves minimum value of solution for the specified variable |
double |
getObjectiveVal()
Returns the value stored for this solution's objective expression |
java.util.Set |
getPossibleSet(CspSetVariable var)
Returns the set of possible values for the variable |
java.util.Set |
getRequiredSet(CspSetVariable var)
Returns the set of required values for the variable |
BooleanSolution |
getSolution(CspBooleanVariable var)
Returns a stored solution for a boolean variable |
DoubleSolution |
getSolution(CspDoubleVariable var)
Returns a stored solution for a double variable |
FloatSolution |
getSolution(CspFloatVariable var)
Returns a stored solution for a float variable |
IntSolution |
getSolution(CspIntVariable var)
Returns a stored solution for an integer variable |
LongSolution |
getSolution(CspLongVariable var)
Returns a stored solution for a long variable |
SetSolution |
getSolution(CspSetVariable var)
Returns a stored solution for a set variable |
VariableSolution |
getSolution(CspVariable var)
Returns a stored solution for a variable |
double |
getValue(CspDoubleVariable var)
Returns the value of the solution. |
float |
getValue(CspFloatVariable var)
Returns the value of the solution. |
int |
getValue(CspIntVariable var)
Returns the value of the solution for the specified variable. |
long |
getValue(CspLongVariable var)
Returns the value of the solution. |
boolean |
isBound(CspIntVariable var)
Returns true if variable is bound in this SolverSolution |
boolean |
isDifferent(SolverSolution neighbor)
Returns true if any of the variables in the specified SolverSolution differ from those contained in this SolverSolution object |
boolean |
isFalse(CspBooleanVariable var)
Returns true if boolean variable is NOT satisfied in solution |
boolean |
isRestorable(CspVariable var)
Returns true if the state of a variable contained within this solution will be restored when the solution is restored |
boolean |
isTrue(CspBooleanVariable var)
Returns true if boolean variable is satisfied in solution |
void |
recalcStatistics()
Recalculates any internal stats that are stored with the solution |
void |
remove(CspVariable var)
Removes a variable from the scope of a solution request |
void |
setFalse(CspBooleanVariable var)
Sets the value of the specified variable to false |
void |
setMax(CspDoubleVariable var,
double max)
Sets maximum value of solution for the specified variable |
void |
setMax(CspFloatVariable var,
float max)
Sets maximum value of solution for the specified variable |
void |
setMax(CspIntVariable var,
int max)
Sets maximum value of solution for the specified variable |
void |
setMax(CspLongVariable var,
long max)
Sets maximum value of solution for the specified variable |
void |
setMaximizeObjective(CspNumExpr expr)
Sets an objective to maximize the specified expression |
void |
setMin(CspDoubleVariable var,
double min)
Sets minimum value of solution for the specified variable |
void |
setMin(CspFloatVariable var,
float min)
Sets minimum value of solution for the specified variable |
void |
setMin(CspIntVariable var,
int min)
Sets minimum value of solution for the specified variable |
void |
setMin(CspLongVariable var,
long min)
Sets minimum value of solution for the specified variable |
void |
setMinimizeObjective(CspNumExpr expr)
Sets an objective to minimize the specified expression |
void |
setObjectiveVal(double num)
Sets the value stored for this solution's objective expression |
void |
setPossibleSet(CspSetVariable var,
java.util.Set possibleSet)
Sets the set of possible values for the variable |
void |
setRequiredSet(CspSetVariable var,
java.util.Set requiredSet)
Sets the set of required values for the variable |
void |
setRestorable(CspVariable var,
boolean restore)
True if a variable contained within this solution is to be restored when the solution is restored |
void |
setTrue(CspBooleanVariable var)
Sets the value of the specified variable to true |
void |
setValue(CspDoubleVariable var,
double val)
Sets both the min / max value of solution to a single value |
void |
setValue(CspFloatVariable var,
float val)
Sets both the min / max value of solution to a single value |
void |
setValue(CspIntVariable var,
int val)
Sets both the min / max value of solution to a single value |
void |
setValue(CspLongVariable var,
long val)
Sets both the min / max value of solution to a single value |
java.lang.String |
toString()
|
Methods inherited from class jopt.csp.solution.SolutionScope |
add, clearObjective, contains, getDoubleObjectiveExpression, getFloatObjectiveExpression, getIntObjectiveExpression, getLongObjectiveExpression, getObjectiveExpression, isMaximizeObjective, isMinimizeObjective, variables |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SolverSolution(SolutionScope scope)
scope
- Scope of variables to include within solutionpublic SolverSolution()
add
method.
Method Detail |
public void copy(SolverSolution sol)
public void add(CspVariable var)
SolutionScope
add
in class SolutionScope
public IntSolution add(CspIntVariable var)
public LongSolution add(CspLongVariable var)
public FloatSolution add(CspFloatVariable var)
public DoubleSolution add(CspDoubleVariable var)
public BooleanSolution add(CspBooleanVariable var)
public SetSolution add(CspSetVariable var)
public void remove(CspVariable var)
SolutionScope
remove
in class SolutionScope
public IntSolution getSolution(CspIntVariable var)
public LongSolution getSolution(CspLongVariable var)
public FloatSolution getSolution(CspFloatVariable var)
public DoubleSolution getSolution(CspDoubleVariable var)
public SetSolution getSolution(CspSetVariable var)
public BooleanSolution getSolution(CspBooleanVariable var)
public VariableSolution getSolution(CspVariable var)
public boolean isRestorable(CspVariable var)
public void setRestorable(CspVariable var, boolean restore)
public java.lang.String toString()
public boolean isBound(CspIntVariable var)
public int getMin(CspIntVariable var)
public int getMax(CspIntVariable var)
public int getValue(CspIntVariable var)
public void setMin(CspIntVariable var, int min)
public void setMax(CspIntVariable var, int max)
public void setValue(CspIntVariable var, int val)
public long getMin(CspLongVariable var)
public long getMax(CspLongVariable var)
public long getValue(CspLongVariable var)
public void setMin(CspLongVariable var, long min)
public void setMax(CspLongVariable var, long max)
public void setValue(CspLongVariable var, long val)
public float getMin(CspFloatVariable var)
public float getMax(CspFloatVariable var)
public float getValue(CspFloatVariable var)
public void setMin(CspFloatVariable var, float min)
public void setMax(CspFloatVariable var, float max)
public void setValue(CspFloatVariable var, float val)
public double getMin(CspDoubleVariable var)
public double getMax(CspDoubleVariable var)
public double getValue(CspDoubleVariable var)
public void setMin(CspDoubleVariable var, double min)
public void setMax(CspDoubleVariable var, double max)
public void setValue(CspDoubleVariable var, double val)
public boolean isFalse(CspBooleanVariable var)
public boolean isTrue(CspBooleanVariable var)
public void setTrue(CspBooleanVariable var)
public void setFalse(CspBooleanVariable var)
public void clear(CspBooleanVariable var)
public java.util.Set getPossibleSet(CspSetVariable var)
public java.util.Set getRequiredSet(CspSetVariable var)
public void setPossibleSet(CspSetVariable var, java.util.Set possibleSet)
public void setRequiredSet(CspSetVariable var, java.util.Set requiredSet)
public double getObjectiveVal()
public void setObjectiveVal(double num)
public int getIntObjectiveVal()
public long getLongObjectiveVal()
public float getFloatObjectiveVal()
public void setMinimizeObjective(CspNumExpr expr)
setMinimizeObjective
in class SolutionScope
expr
- Expression that is to be minimizedpublic void setMaximizeObjective(CspNumExpr expr)
setMaximizeObjective
in class SolutionScope
expr
- Expression that is to be maximizedpublic boolean isDifferent(SolverSolution neighbor)
SolverSolution
object
neighbor
- The SolverSolution to which this solution is compared
public static SolverSolution createNeighbor(SolverSolution initial, SolverSolution result)
initial
- Solution neighbor will be relative toresult
- Solution that will be produced when neighbor is applied to initial solution
initial
to result
public void recalcStatistics()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |