Skip to content

Commit

Permalink
#169: Fix ES description.
Browse files Browse the repository at this point in the history
  • Loading branch information
jenetics committed Apr 16, 2017
1 parent ce7a110 commit be3fcdc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
22 changes: 12 additions & 10 deletions org.jenetics.doc/src/main/lyx/manual.lyx
Expand Up @@ -20044,12 +20044,12 @@ final Engine<DoubleGene, Double> engine =

\begin_layout Plain Layout

.survivorsSize(mu)
.survivorsSize(0)
\end_layout

\begin_layout Plain Layout

.selector(new TruncationSelector<>(mu))
.offspringSelector(new TruncationSelector<>(mu))
\end_layout

\begin_layout Plain Layout
Expand Down Expand Up @@ -20112,13 +20112,11 @@ reference "lis:mu-lambda-Engine-configuration"
\end_inset

and the survivors size to
\begin_inset Formula $\mu$
\begin_inset Formula $0$
\end_inset

.
This corresponds to first two steps of the ES.
Step three is configured by setting the survivors- and offspring selectors
to the
, since the best parents are not part of the final population.
Step three is configured by setting the offspring selector to the
\family typewriter
Truncation\SpecialChar softhyphen
Selector
Expand All @@ -20134,12 +20132,16 @@ Selector
\end_inset

.
This parameterization prevents the selector from selecting individuals
with a rank lower than
This lets the
\family typewriter
Truncation\SpecialChar softhyphen
Selector
\family default
only select the
\begin_inset Formula $\mu$
\end_inset

.
best individuals, which corresponds to step two of the ES.
\end_layout

\begin_layout Standard
Expand Down
Expand Up @@ -5,6 +5,7 @@
import org.jenetics.TruncationSelector;
import org.jenetics.engine.Codec;
import org.jenetics.engine.Engine;
import org.jenetics.engine.EvolutionResult;
import org.jenetics.engine.codecs;
import org.jenetics.util.DoubleRange;

Expand Down Expand Up @@ -37,10 +38,18 @@ public static void main(final String[] args) {
final Engine<DoubleGene, Double> engine = Engine
.builder(MLStrategy::fitness, codec)
.populationSize(λ)
.survivorsSize(μ)
.selector(new TruncationSelector<>(μ))
.survivorsSize(0)
.offspringSelector(new TruncationSelector<>(μ))
.alterers(new Mutator<>(p))
.build();

System.out.println(
codec.decode(
engine.stream()
.limit(100)
.collect(EvolutionResult.toBestGenotype())
)
);
}

}

0 comments on commit be3fcdc

Please sign in to comment.