public final class DoubleVectorSolution extends java.lang.Object implements Solution<io.vavr.collection.Array<java.lang.Double>>
Solution optimized for a vector of doubles.
Modifier and Type | Field and Description |
---|---|
private double |
fitness |
private static long |
serialVersionUID |
private double[] |
values |
Constructor and Description |
---|
DoubleVectorSolution(double[] values) |
DoubleVectorSolution(double[] values,
double fitness) |
Modifier and Type | Method and Description |
---|---|
double |
fitnessValue()
Returns the fitness of this solution.
|
int |
length() |
java.lang.String |
toString() |
io.vavr.collection.Array<java.lang.Double> |
unwrap()
Returns the real value of this solution.
|
double[] |
values() |
DoubleVectorSolution |
withFitness(double newFitness)
Updates the fitness of this solution.
|
private static final long serialVersionUID
private final double[] values
private final double fitness
public DoubleVectorSolution(double[] values, double fitness)
public DoubleVectorSolution(double[] values)
public double[] values()
public int length()
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<io.vavr.collection.Array<java.lang.Double>>
public DoubleVectorSolution withFitness(double newFitness)
Solution
Updates the fitness of this solution.
This function returns a new instance.
withFitness
in interface Solution<io.vavr.collection.Array<java.lang.Double>>
newFitness
- new fitness valuepublic io.vavr.collection.Array<java.lang.Double> unwrap()
Solution
Returns the real value of this solution.
public java.lang.String toString()
toString
in class java.lang.Object