G - the gene typeC - the fitness typepublic final class EvolutionResult<G extends Gene<?,G>,C extends Comparable<? super C>> extends Object implements Comparable<EvolutionResult<G,C>>, Serializable
final Problem<ISeq<Point>, EnumGene<Point>, Double> tsm = ...;
final EvolutionResult<EnumGene<Point>, Double> result = Engine.builder(tsm)
.optimize(Optimize.MINIMUM).build()
.stream()
.limit(100)
.collect(EvolutionResult.toBestEvolutionResult());EvolutionStart,
Engine,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(EvolutionResult<G,C> other)
Compare
this evolution result with another one, according the
populations best individual. |
boolean |
equals(Object obj) |
int |
getAlterCount()
The number of altered individuals.
|
C |
getBestFitness()
Return the best population fitness.
|
Phenotype<G,C> |
getBestPhenotype()
Return the best
Phenotype of the result population. |
EvolutionDurations |
getDurations()
Return the timing (meta) information of the evolution step.
|
long |
getGeneration()
The current generation.
|
int |
getInvalidCount()
Return the number of invalid individuals.
|
int |
getKillCount()
Return the number of killed individuals.
|
Optimize |
getOptimize()
Return the optimization strategy used.
|
Population<G,C> |
getPopulation()
Return the population after the evolution step.
|
long |
getTotalGenerations()
Return the generation count evaluated so far.
|
C |
getWorstFitness()
Return the worst population fitness.
|
Phenotype<G,C> |
getWorstPhenotype()
Return the worst
Phenotype of the result population. |
int |
hashCode() |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
of(Optimize optimize,
Population<G,C> population,
long generation,
EvolutionDurations durations,
int killCount,
int invalidCount,
int alterCount)
Return an new
EvolutionResult object with the given values. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
of(Optimize optimize,
Population<G,C> population,
long generation,
long totalGenerations,
EvolutionDurations durations,
int killCount,
int invalidCount,
int alterCount)
Return an new
EvolutionResult object with the given values. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toBestEvolutionResult()
Return a collector which collects the best result of an evolution stream.
|
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toBestGenotype()
Return a collector which collects the best genotype of an evolution
stream.
|
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toBestPhenotype()
Return a collector which collects the best phenotype of an evolution
stream.
|
static <G extends Gene<?,G>,C extends Comparable<? super C>,T> |
toBestResult(Codec<T,G> codec)
Return a collector which collects the best result (in the native
problem space).
|
static <G extends Gene<?,G>,C extends Comparable<? super C>,T> |
toBestResult(Function<Genotype<G>,T> decoder)
Return a collector which collects the best result (in the native
problem space).
|
public Optimize getOptimize()
public Population<G,C> getPopulation()
public long getGeneration()
public long getTotalGenerations()
public EvolutionDurations getDurations()
public int getKillCount()
public int getInvalidCount()
public int getAlterCount()
public Phenotype<G,C> getBestPhenotype()
Phenotype of the result population.Phenotype of the result populationpublic Phenotype<G,C> getWorstPhenotype()
Phenotype of the result population.Phenotype of the result populationpublic C getBestFitness()
public C getWorstFitness()
public int compareTo(EvolutionResult<G,C> other)
this evolution result with another one, according the
populations best individual.compareTo in interface Comparable<EvolutionResult<G extends Gene<?,G>,C extends Comparable<? super C>>>other - the other evolution result to comparepublic static <G extends Gene<?,G>,C extends Comparable<? super C>> Collector<EvolutionResult<G,C>,?,EvolutionResult<G,C>> toBestEvolutionResult()
final Problem<ISeq<Point>, EnumGene<Point>, Double> tsm = ...;
final EvolutionResult<EnumGene<Point>, Double> result = Engine.builder(tsm)
.optimize(Optimize.MINIMUM).build()
.stream()
.limit(100)
.collect(EvolutionResult.toBestEvolutionResult());EvolutionStream is empty, the collector returns
null.G - the gene typeC - the fitness typepublic static <G extends Gene<?,G>,C extends Comparable<? super C>> Collector<EvolutionResult<G,C>,?,Phenotype<G,C>> toBestPhenotype()
final Problem<ISeq<Point>, EnumGene<Point>, Double> tsm = ...;
final Phenotype<EnumGene<Point>, Double> result = Engine.builder(tsm)
.optimize(Optimize.MINIMUM).build()
.stream()
.limit(100)
.collect(EvolutionResult.toBestPhenotype());EvolutionStream is empty, the collector returns
null.G - the gene typeC - the fitness typepublic static <G extends Gene<?,G>,C extends Comparable<? super C>> Collector<EvolutionResult<G,C>,?,Genotype<G>> toBestGenotype()
final Problem<ISeq<Point>, EnumGene<Point>, Double> tsm = ...;
final Genotype<EnumGene<Point>> result = Engine.builder(tsm)
.optimize(Optimize.MINIMUM).build()
.stream()
.limit(100)
.collect(EvolutionResult.toBestGenotype());EvolutionStream is empty, the collector returns
null.G - the gene typeC - the fitness typepublic static <G extends Gene<?,G>,C extends Comparable<? super C>,T> Collector<EvolutionResult<G,C>,?,T> toBestResult(Function<Genotype<G>,T> decoder)
final Problem<ISeq<Point>, EnumGene<Point>, Double> tsm = ...;
final ISeq<Point> route = Engine.builder(tsm)
.optimize(Optimize.MINIMUM).build()
.stream()
.limit(100)
.collect(EvolutionResult.toBestResult(tsm.codec().decoder()));EvolutionStream is empty, the collector returns
null.T - the native problem result typeG - the gene typeC - the fitness result typedecoder - the decoder which converts the Genotype into the
result of the problem space.NullPointerException - if the given decoder is nullpublic static <G extends Gene<?,G>,C extends Comparable<? super C>,T> Collector<EvolutionResult<G,C>,?,T> toBestResult(Codec<T,G> codec)
final Problem<ISeq<Point>, EnumGene<Point>, Double> tsm = ...;
final ISeq<Point> route = Engine.builder(tsm)
.optimize(Optimize.MINIMUM).build()
.stream()
.limit(100)
.collect(EvolutionResult.toBestResult(tsm.codec()));EvolutionStream is empty, the collector returns
null.T - the native problem result typeG - the gene typeC - the fitness result typecodec - the problem decoderNullPointerException - if the given codec is nullpublic static <G extends Gene<?,G>,C extends Comparable<? super C>> EvolutionResult<G,C> of(Optimize optimize, Population<G,C> population, long generation, long totalGenerations, EvolutionDurations durations, int killCount, int invalidCount, int alterCount)
EvolutionResult object with the given values.G - the gene typeC - the fitness typeoptimize - the optimization strategy usedpopulation - the population after the evolution stepgeneration - the current generationtotalGenerations - the overall number of generationsdurations - the timing (meta) informationkillCount - the number of individuals which has been killedinvalidCount - the number of individuals which has been removed as
invalidalterCount - the number of individuals which has been alteredNullPointerException - if one of the parameters is
nullpublic static <G extends Gene<?,G>,C extends Comparable<? super C>> EvolutionResult<G,C> of(Optimize optimize, Population<G,C> population, long generation, EvolutionDurations durations, int killCount, int invalidCount, int alterCount)
EvolutionResult object with the given values.G - the gene typeC - the fitness typeoptimize - the optimization strategy usedpopulation - the population after the evolution stepgeneration - the current generationdurations - the timing (meta) informationkillCount - the number of individuals which has been killedinvalidCount - the number of individuals which has been removed as
invalidalterCount - the number of individuals which has been alteredNullPointerException - if one of the parameters is
null© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)