public final class LabsSolution extends java.lang.Object implements Solution<io.vavr.collection.Array<java.lang.Boolean>>
Modifier and Type | Field and Description |
---|---|
private double |
fitness |
static boolean |
RUN_LENGTH_DISPLAY_FORMAT |
private boolean[] |
sequenceRepresentation |
private static long |
serialVersionUID |
Constructor and Description |
---|
LabsSolution(boolean[] sequenceRepresentation)
Instantiates a new LABS solution.
|
LabsSolution(int[] sequenceRepresentation)
Instantiates a new LABS solution.
|
LabsSolution(int[] runLengthSequenceRepresentation,
boolean firstSign)
Instantiates a new LABS solution.
|
Modifier and Type | Method and Description |
---|---|
double |
fitnessValue()
Returns the fitness of this solution.
|
int |
length() |
boolean[] |
sequenceRepresentation() |
java.lang.String |
toString() |
io.vavr.collection.Array<java.lang.Boolean> |
unwrap()
Returns the real value of this solution.
|
LabsSolution |
withFitness(double fitnessValue)
Updates the fitness of this solution.
|
public static final boolean RUN_LENGTH_DISPLAY_FORMAT
private static final long serialVersionUID
private final boolean[] sequenceRepresentation
private double fitness
public LabsSolution(boolean[] sequenceRepresentation)
Instantiates a new LABS solution.
sequenceRepresentation
- the boolean sequence representation array, where true
represents “1” value and false
represents “-1”public LabsSolution(int[] sequenceRepresentation)
Instantiates a new LABS solution.
sequenceRepresentation
- the sequence integer representation array, in which each each value is either “-1” or “1”public LabsSolution(int[] runLengthSequenceRepresentation, boolean firstSign)
Instantiates a new LABS solution.
runLengthSequenceRepresentation
- the run length sequence representationfirstSign
- the first sign (positive or negative)public boolean[] sequenceRepresentation()
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.Boolean>>
public LabsSolution withFitness(double fitnessValue)
Solution
Updates the fitness of this solution.
This function returns a new instance.
withFitness
in interface Solution<io.vavr.collection.Array<java.lang.Boolean>>
fitnessValue
- new fitness valuepublic java.lang.String toString()
toString
in class java.lang.Object