V - VariableT - Valuepublic class Solution<V extends Variable<V,T>,T extends Value<V,T>> extends Object
Model,
Solver| Constructor and Description |
|---|
Solution(Model<V,T> model)
Deprecated.
|
Solution(Model<V,T> model,
Assignment<V,T> assignment)
Constructor
|
Solution(Model<V,T> model,
Assignment<V,T> assignment,
long iteration,
double time)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSolutionListener(SolutionListener<V,T> listener)
Adds solution listener
|
void |
clearBest()
Clear the best ever found solution
|
Assignment<V,T> |
getAssignment()
The assignment associated with this solution
|
long |
getBestFailedIterations()
Number of failed iterations (i.e., number of calls
update(double, boolean) with false success) in the best solution |
int |
getBestIndex()
Index of the best assignment.
|
Map<String,String> |
getBestInfo()
Info of the best ever found solution
|
long |
getBestIteration()
Iteration when the best ever found solution was found
|
double |
getBestPerturbationsPenalty()
Perturbation penalty of the best ever found solution (see
PerturbationsCounter) |
double |
getBestTime()
Solution time when the best ever found solution was found
|
double |
getBestValue()
Total value of the best ever found solution -- sum of all assigned values
(see
Value.toDouble(Assignment)). |
Map<String,String> |
getExtendedInfo()
Extended solution information.
|
long |
getFailedIterations()
Number of failed iterations (i.e., number of calls
update(double, boolean) with false success) |
Map<String,String> |
getInfo()
Solution information.
|
Map<String,String> |
getInfo(Collection<V> variables)
Solution information.
|
long |
getIteration()
Current iteration
|
ReadWriteLock |
getLock()
Return solution lock
|
Model<V,T> |
getModel()
The model associated with the solution
|
PerturbationsCounter<V,T> |
getPerturbationsCounter()
Returns perturbation counter
|
List<SolutionListener<V,T>> |
getSolutionListeners()
Registered of solution listeners
|
double |
getTime()
Current solution time (time in seconds from the start of the solver)
|
void |
init(Solver<V,T> solver)
Initialization
|
boolean |
isBestComplete()
Returns true, if all variables of the best ever solution found are
assigned
|
boolean |
isComplete()
True if the solution is complete, i.e., all the variables are assigned
|
void |
removeSolutionListener(SolutionListener<V,T> listener)
Removes solution listener
|
void |
restoreBest()
Restore the best ever found solution into the current solution (it also
calls
Model.restoreBest(Assignment)) |
void |
saveBest()
Save the current solution as the best ever found solution (it also calls
Model.saveBest(Assignment)) |
void |
saveBest(Solution<V,T> master)
Save the current solution as the best ever found solution (it also calls
Model.saveBest(Assignment)) |
boolean |
saveBestIfImproving(Solution<V,T> master,
SolutionComparator<V,T> comparator) |
void |
setAssignment(Assignment<V,T> assignment)
Set a new assignment
|
void |
setBestValue(double bestValue)
Set total value of the best ever found solution
|
String |
toString()
String representation -- returns a list of values of objective criteria
|
void |
update(double time)
Update time, increment current iteration
|
void |
update(double time,
boolean success)
Update time, increment current iteration
|
void |
update(double time,
boolean success,
Solution<V,T> master)
Update time, increment current iteration
|
void |
update(double time,
Solution<V,T> master)
Update time, increment current iteration
|
@Deprecated public Solution(Model<V,T> model)
model - problem modelpublic Solution(Model<V,T> model, Assignment<V,T> assignment)
model - problem modelassignment - current assignmentpublic long getIteration()
public long getFailedIterations()
update(double, boolean) with false success)public long getBestFailedIterations()
update(double, boolean) with false success) in the best solutionpublic Assignment<V,T> getAssignment()
public void setAssignment(Assignment<V,T> assignment)
assignment - current assignmentpublic double getTime()
public void update(double time, boolean success, Solution<V,T> master)
time - updated solver timesuccess - true if the last iteration was successfulmaster - master solutionpublic void update(double time, boolean success)
time - updated solver timesuccess - true if the last iteration was successfulpublic void update(double time, Solution<V,T> master)
time - updated solver timemaster - master solutionpublic void update(double time)
time - updated solver timepublic String toString()
toString in class ObjectAbstractCriterion.toString(Assignment)public Map<String,String> getInfo()
public Map<String,String> getExtendedInfo()
getInfo(), but
some more information (that is more expensive to compute) might be added.
Also extended model information is added (see
Model.getExtendedInfo(Assignment)) into the resultant table.public Map<String,String> getInfo(Collection<V> variables)
variables - sub-problempublic Map<String,String> getBestInfo()
public long getBestIteration()
public double getBestTime()
public boolean isBestComplete()
public int getBestIndex()
Assignment.getIndex() of the best saved solutionpublic double getBestValue()
Value.toDouble(Assignment)).public void setBestValue(double bestValue)
bestValue - value of the best solutionpublic double getBestPerturbationsPenalty()
PerturbationsCounter)public PerturbationsCounter<V,T> getPerturbationsCounter()
public void clearBest()
public boolean isComplete()
public void saveBest(Solution<V,T> master)
Model.saveBest(Assignment))master - master solution into which information about the best solution are to be copied as wellpublic boolean saveBestIfImproving(Solution<V,T> master, SolutionComparator<V,T> comparator)
public void saveBest()
Model.saveBest(Assignment))public void restoreBest()
Model.restoreBest(Assignment))public void addSolutionListener(SolutionListener<V,T> listener)
listener - a solution listenerpublic void removeSolutionListener(SolutionListener<V,T> listener)
listener - a solution listenerpublic List<SolutionListener<V,T>> getSolutionListeners()
public ReadWriteLock getLock()