public final class DoubleSolution extends java.lang.Object implements Solution<java.lang.Double>
Solution optimized for a single double number.
Modifier and Type | Field and Description |
---|---|
private double |
fitness |
private static long |
serialVersionUID |
private double |
value |
Constructor and Description |
---|
DoubleSolution(double value) |
DoubleSolution(double value,
double fitness) |
Modifier and Type | Method and Description |
---|---|
double |
fitnessValue()
Returns the fitness of this solution.
|
java.lang.String |
toString() |
java.lang.Double |
unwrap()
Returns the real value of this solution.
|
double |
value() |
DoubleSolution |
withFitness(double newFitness)
Updates the fitness of this solution.
|
private static final long serialVersionUID
private final double value
private final double fitness
public DoubleSolution(double value, double fitness)
public DoubleSolution(double value)
public double value()
public double fitnessValue()
Solution
Returns the fitness of this solution. If the fitness was not computed, the returned value will be Double#NaN
.
fitnessValue
in interface Solution<java.lang.Double>
public DoubleSolution withFitness(double newFitness)
Solution
Updates the fitness of this solution.
This function returns a new instance.
withFitness
in interface Solution<java.lang.Double>
newFitness
- new fitness valuepublic java.lang.Double unwrap()
Solution
Returns the real value of this solution.
public java.lang.String toString()
toString
in class java.lang.Object