public final class SimpleSolution<T extends java.io.Serializable> extends java.lang.Object implements Solution<T>
Basic implementation of the Solution
interface. Stores any serializable object.
Modifier and Type | Field and Description |
---|---|
private double |
evaluation |
private static long |
serialVersionUID |
private T |
value |
Constructor and Description |
---|
SimpleSolution(T value) |
SimpleSolution(T value,
double evaluation) |
Modifier and Type | Method and Description |
---|---|
SimpleSolution<T> |
cloneWithNewValue(T newValue) |
double |
evaluationValue()
Returns the fitness of this solution.
|
java.lang.String |
toString() |
T |
unwrap()
Returns the real value of this solution.
|
SimpleSolution<T> |
withEvaluation(double evaluation)
Updates the evaluation of this solution.
|
private static final long serialVersionUID
private final T extends java.io.Serializable value
private final double evaluation
public SimpleSolution(T value, double evaluation)
public SimpleSolution(T value)
public double evaluationValue()
Solution
Returns the fitness of this solution. If the fitness was not computed, the returned value will be Double#NaN
.
evaluationValue
in interface Solution<T extends java.io.Serializable>
public SimpleSolution<T> withEvaluation(double evaluation)
Solution
Updates the evaluation of this solution.
This function returns a new instance.
withEvaluation
in interface Solution<T extends java.io.Serializable>
evaluation
- new evaluation valuepublic T unwrap()
Solution
Returns the real value of this solution.
public SimpleSolution<T> cloneWithNewValue(T newValue)
cloneWithNewValue
in interface Solution<T extends java.io.Serializable>
public java.lang.String toString()
toString
in class java.lang.Object