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.
|
ISeq<Genotype<G>> |
getGenotypes()
Return the current list of genotypes of this evolution result.
|
int |
getInvalidCount()
Return the number of invalid individuals.
|
int |
getKillCount()
Return the number of killed individuals.
|
Optimize |
getOptimize()
Return the optimization strategy used.
|
ISeq<Phenotype<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() |
EvolutionStart<G,C> |
next()
Return the next evolution start object with the current population and
the incremented generation.
|
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
of(Optimize optimize,
ISeq<Phenotype<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,
ISeq<Phenotype<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).
|
EvolutionStart<G,C> |
toEvolutionStart()
Return the current evolution result object as an
EvolutionStart
object with the current population and current total generation. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toUniquePopulation()
Return a mapping function, which removes duplicate individuals from the
population and replaces it with newly created one by the existing
genotype factory.
|
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toUniquePopulation(Factory<Genotype<G>> factory)
Return a mapping function, which removes duplicate individuals from the
population and replaces it with newly created one by the given genotype
factory. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toUniquePopulation(Factory<Genotype<G>> factory,
int maxRetries)
Return a mapping function, which removes duplicate individuals from the
population and replaces it with newly created one by the given genotype
factory. |
static <G extends Gene<?,G>,C extends Comparable<? super C>> |
toUniquePopulation(int maxRetries)
Return a mapping function, which removes duplicate individuals from the
population and replaces it with newly created one by the existing
genotype factory.
|
public Optimize getOptimize()
public ISeq<Phenotype<G,C>> getPopulation()
public ISeq<Genotype<G>> getGenotypes()
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 EvolutionStart<G,C> next()
public EvolutionStart<G,C> toEvolutionStart()
EvolutionStart
object with the current population and current total generation.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>> UnaryOperator<EvolutionResult<G,C>> toUniquePopulation(Factory<Genotype<G>> factory, int maxRetries)
factory.
final Problem<Double, DoubleGene, Integer> problem = ...;
final Engine<DoubleGene, Integer> engine = Engine.builder(problem)
.mapping(EvolutionResult.toUniquePopulation(problem.codec().encoding(), 100))
.build();
final Genotype<DoubleGene> best = engine.stream()
.limit(100);
.collect(EvolutionResult.toBestGenotype());G - the gene typeC - the fitness function result typefactory - the genotype factory which create new individualsmaxRetries - the maximal number of genotype creation triesNullPointerException - if the given genotype factory is
nullEngine.Builder.mapping(Function)public static <G extends Gene<?,G>,C extends Comparable<? super C>> UnaryOperator<EvolutionResult<G,C>> toUniquePopulation(Factory<Genotype<G>> factory)
factory.
final Problem<Double, DoubleGene, Integer> problem = ...;
final Engine<DoubleGene, Integer> engine = Engine.builder(problem)
.mapping(EvolutionResult.toUniquePopulation(problem.codec().encoding()))
.build();
final Genotype<DoubleGene> best = engine.stream()
.limit(100);
.collect(EvolutionResult.toBestGenotype());G - the gene typeC - the fitness function result typefactory - the genotype factory which create new individualsNullPointerException - if the given genotype factory is
nullEngine.Builder.mapping(Function)public static <G extends Gene<?,G>,C extends Comparable<? super C>> UnaryOperator<EvolutionResult<G,C>> toUniquePopulation(int maxRetries)
final Problem<Double, DoubleGene, Integer> problem = ...;
final Engine<DoubleGene, Integer> engine = Engine.builder(problem)
.mapping(EvolutionResult.toUniquePopulation(10))
.build();
final Genotype<DoubleGene> best = engine.stream()
.limit(100);
.collect(EvolutionResult.toBestGenotype(5));G - the gene typeC - the fitness function result typemaxRetries - the maximal number of genotype creation triesNullPointerException - if the given genotype factory is
nullEngine.Builder.mapping(Function)public static <G extends Gene<?,G>,C extends Comparable<? super C>> UnaryOperator<EvolutionResult<G,C>> toUniquePopulation()
final Problem<Double, DoubleGene, Integer> problem = ...;
final Engine<DoubleGene, Integer> engine = Engine.builder(problem)
.mapping(EvolutionResult.toUniquePopulation())
.build();
final Genotype<DoubleGene> best = engine.stream()
.limit(100);
.collect(EvolutionResult.toBestGenotype());G - the gene typeC - the fitness function result typeNullPointerException - if the given genotype factory is
nullEngine.Builder.mapping(Function)public static <G extends Gene<?,G>,C extends Comparable<? super C>> EvolutionResult<G,C> of(Optimize optimize, ISeq<Phenotype<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, ISeq<Phenotype<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-2019 Franz Wilhelmstötter (2019-11-18 20:30)