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