Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 28b6ec1

Browse files
committed
Replace genetic algorithm ASCII-art with a real figure
Author: Jürgen Purtz Discussion: https://postgr.es/m/c6027f7a-78ea-8453-0837-09903ba5fd9b@purtz.de
1 parent a407012 commit 28b6ec1

File tree

4 files changed

+200
-44
lines changed

4 files changed

+200
-44
lines changed

doc/src/sgml/geqo.sgml

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -84,59 +84,26 @@
8484
Through simulation of the evolutionary operations <firstterm>recombination</firstterm>,
8585
<firstterm>mutation</firstterm>, and
8686
<firstterm>selection</firstterm> new generations of search points are found
87-
that show a higher average fitness than their ancestors.
87+
that show a higher average fitness than their ancestors. <xref linkend="geqo-figure"/>
88+
illustrates these steps.
8889
</para>
8990

91+
<figure id="geqo-figure">
92+
<title>Structure of a Genetic Algorithm</title>
93+
<mediaobject>
94+
<imageobject>
95+
<imagedata fileref="images/genetic-algorithm.svg" format="SVG" width="100%"/>
96+
</imageobject>
97+
</mediaobject>
98+
</figure>
99+
90100
<para>
91101
According to the <systemitem class="resource">comp.ai.genetic</systemitem> <acronym>FAQ</acronym> it cannot be stressed too
92102
strongly that a <acronym>GA</acronym> is not a pure random search for a solution to a
93103
problem. A <acronym>GA</acronym> uses stochastic processes, but the result is distinctly
94104
non-random (better than random).
95105
</para>
96106

97-
<figure id="geqo-diagram">
98-
<title>Structured Diagram of a Genetic Algorithm</title>
99-
100-
<informaltable frame="none">
101-
<tgroup cols="2">
102-
<tbody>
103-
<row>
104-
<entry>P(t)</entry>
105-
<entry>generation of ancestors at a time t</entry>
106-
</row>
107-
108-
<row>
109-
<entry>P''(t)</entry>
110-
<entry>generation of descendants at a time t</entry>
111-
</row>
112-
</tbody>
113-
</tgroup>
114-
</informaltable>
115-
116-
<literallayout class="monospaced">
117-
+=========================================+
118-
|&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Algorithm GA &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;|
119-
+=========================================+
120-
| INITIALIZE t := 0 |
121-
+=========================================+
122-
| INITIALIZE P(t) |
123-
+=========================================+
124-
| evaluate FITNESS of P(t) |
125-
+=========================================+
126-
| while not STOPPING CRITERION do |
127-
| +-------------------------------------+
128-
| | P'(t) := RECOMBINATION{P(t)} |
129-
| +-------------------------------------+
130-
| | P''(t) := MUTATION{P'(t)} |
131-
| +-------------------------------------+
132-
| | P(t+1) := SELECTION{P''(t) + P(t)} |
133-
| +-------------------------------------+
134-
| | evaluate FITNESS of P''(t) |
135-
| +-------------------------------------+
136-
| | t := t + 1 |
137-
+===+=====================================+
138-
</literallayout>
139-
</figure>
140107
</sect1>
141108

142109
<sect1 id="geqo-pg-intro">

doc/src/sgml/images/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# see README in this directory about image handling
44

55
ALL_IMAGES = \
6+
genetic-algorithm.svg \
67
gin.svg \
78
pagelayout.svg
89

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
digraph {
2+
layout=dot;
3+
4+
// default values
5+
node [shape=box, label="", fontname="sans-serif", style=filled, fillcolor=white, fontsize=8];
6+
graph [fontname="sans-serif"]; // must be specified separately
7+
edge [fontname="sans-serif"]; // must be specified separately
8+
9+
// an unobtrusive background color
10+
pad="1.0, 0.5";
11+
bgcolor=whitesmoke;
12+
13+
// layout of edges and nodes
14+
splines=ortho;
15+
nodesep=0.3;
16+
ranksep=0.3;
17+
18+
// nodes
19+
a1[label="INITIALIZE t := 0"];
20+
a2[label="INITIALIZE P(t)"];
21+
a3[label="evaluate FITNESS of P(t)"];
22+
a4[shape="diamond", label="STOPPING CRITERION"; width=4];
23+
24+
// connect 'end' node with 'a9' node (bottom of figure)
25+
{
26+
rank=same;
27+
a9[label="t := t + 1"];
28+
// end-symbol similar to UML notation
29+
end[shape=doublecircle, label="end", width=0.5];
30+
}
31+
32+
a5[label="P'(t) := RECOMBINATION{P(t)}"];
33+
a6[label="P''(t) := MUTATION{P'(t)}"];
34+
a7[label="P(t+1) := SELECTION{P''(t) + P(t)}"];
35+
a8[label="evaluate FITNESS of P''(t)"];
36+
37+
// edges
38+
a1 -> a2 -> a3 -> a4;
39+
a4 -> a5[xlabel="false ", fontsize=10];
40+
a4 -> end[xlabel="true ", fontsize=10];
41+
a5 -> a6 -> a7 -> a8 -> a9;
42+
a4 -> a9 [dir=back];
43+
44+
// explain the notation
45+
expl [shape=plaintext, fontsize=10, width=3.2, fillcolor=whitesmoke,
46+
label="P(t): generation of ancestors at a time t\lP''(t): generation of descendants at a time t\l"];
47+
48+
}
Lines changed: 140 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)