public class DoubleChromosome extends AbstractChromosome<G> implements NumericChromosome<Double,DoubleGene>, Serializable
_genes, _valid
Modifier | Constructor and Description |
---|---|
|
DoubleChromosome(Double min,
Double max)
Create a new random
DoubleChromosome of length one. |
|
DoubleChromosome(Double min,
Double max,
int length)
Create a new random
DoubleChromosome . |
protected |
DoubleChromosome(ISeq<DoubleGene> genes)
Create a new chromosome from the given genes array.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
A |
getMax()
Return the maximum value of this
BoundedChromosome . |
A |
getMin()
Return the minimum value of this
BoundedChromosome . |
int |
hashCode() |
DoubleChromosome |
newInstance()
Create a new instance of type T.
|
DoubleChromosome |
newInstance(ISeq<DoubleGene> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes . |
static DoubleChromosome |
of(double min,
double max)
Create a new random
DoubleChromosome of length one. |
static DoubleChromosome |
of(double min,
double max,
int length)
Create a new random
DoubleChromosome . |
static DoubleChromosome |
of(DoubleGene... genes)
Create a new
DoubleChromosome with the given genes. |
static DoubleChromosome |
of(DoubleRange range)
Create a new random
DoubleChromosome of length one. |
static DoubleChromosome |
of(DoubleRange range,
int length)
Create a new random
DoubleChromosome . |
double[] |
toArray()
Returns an double array containing all of the elements in this chromosome
in proper sequence.
|
double[] |
toArray(double[] array)
Returns an double array containing all of the elements in this chromosome
in proper sequence.
|
getGene, isValid, iterator, length, toSeq, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
byteValue, byteValue, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, shortValue, shortValue
getMax, getMin
as, getGene, getGene, length, stream, toSeq
isValid
forEach, iterator, spliterator
protected DoubleChromosome(ISeq<DoubleGene> genes)
genes
- the genes of the new chromosome.IllegalArgumentException
- if the gene sequence is emptyNullPointerException
- if the genes
are null
.public DoubleChromosome(Double min, Double max, int length)
DoubleChromosome
.min
- the min value of the DoubleGene
s (inclusively).max
- the max value of the DoubleGene
s (exclusively).length
- the length of the chromosome.NullPointerException
- if one of the arguments is null
.IllegalArgumentException
- if the length is smaller than onepublic DoubleChromosome(Double min, Double max)
DoubleChromosome
of length one.min
- the minimal value of this chromosome (inclusively).max
- the maximal value of this chromosome (exclusively).NullPointerException
- if one of the arguments is null
.public double[] toArray(double[] array)
array
- the array into which the elements of this chromosomes are to
be stored, if it is big enough; otherwise, a new array is
allocated for this purpose.NullPointerException
- if the given array
is null
public double[] toArray()
public static DoubleChromosome of(DoubleGene... genes)
DoubleChromosome
with the given genes.genes
- the genes of the chromosome.IllegalArgumentException
- if the length of the genes array is
empty.public static DoubleChromosome of(double min, double max, int length)
DoubleChromosome
.min
- the min value of the DoubleGene
s (inclusively).max
- the max value of the DoubleGene
s (exclusively).length
- the length of the chromosome.DoubleChromosome
with the given parameterIllegalArgumentException
- if the length
is smaller than
one.public static DoubleChromosome of(DoubleRange range, int length)
DoubleChromosome
.range
- the integer range of the chromosome.length
- the length of the chromosome.DoubleChromosome
NullPointerException
- if the given range
is null
IllegalArgumentException
- if the length
is smaller than
one.public static DoubleChromosome of(double min, double max)
DoubleChromosome
of length one.min
- the minimal value of this chromosome (inclusively).max
- the maximal value of this chromosome (exclusively).DoubleChromosome
with the given parameterpublic static DoubleChromosome of(DoubleRange range)
DoubleChromosome
of length one.range
- the double range of the chromosome.DoubleChromosome
of length oneNullPointerException
- if the given range
is null
public DoubleChromosome newInstance(ISeq<DoubleGene> genes)
Chromosome
Chromosome
of specific type
and the given genes
.newInstance
in interface Chromosome<DoubleGene>
genes
- the genes of the new chromosome. The given genes array is
not copied.Chromosome
of the same type with the given genes.public DoubleChromosome newInstance()
Factory
newInstance
in interface Factory<Chromosome<DoubleGene>>
public int hashCode()
public A getMin()
BoundedChromosome
BoundedChromosome
.getMin
in interface BoundedChromosome<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
BoundedChromosome
.public A getMax()
BoundedChromosome
BoundedChromosome
.getMax
in interface BoundedChromosome<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
BoundedChromosome
.© 2007-2017 Franz Wilhelmstötter (2017-08-22 19:30)