Replace genetic algorithm ASCII-art with a real figure
authorAlvaro Herrera
Mon, 19 Aug 2019 16:05:38 +0000 (12:05 -0400)
committerAlvaro Herrera
Mon, 19 Aug 2019 16:05:38 +0000 (12:05 -0400)
Author: Jürgen Purtz
Discussion: https://postgr.es/m/c6027f7a-78ea-8453-0837-09903ba5fd9b@purtz.de

doc/src/sgml/geqo.sgml
doc/src/sgml/images/Makefile
doc/src/sgml/images/genetic-algorithm.gv [new file with mode: 0644]
doc/src/sgml/images/genetic-algorithm.svg [new file with mode: 0644]

index 5120dfbb4246b2755af7b984c0cb4fdc54d42c7f..39d2163d160c2f44489ad7ead7a34a52a90aa420 100644 (file)
     Through simulation of the evolutionary operations recombination,
     mutation, and
     selection new generations of search points are found
-    that show a higher average fitness than their ancestors.
+    that show a higher average fitness than their ancestors. 
+    illustrates these steps.
    
 
+   
+    Structure of a Genetic Algorithm
+    
+     
+      
+     
+    
+   
+
    
     According to the comp.ai.genetic FAQ it cannot be stressed too
     strongly that a GA is not a pure random search for a solution to a
     non-random (better than random).
    
 
-   
-    Structured Diagram of a Genetic Algorithm
-
-    
-     
-      
-       
-        P(t)
-        generation of ancestors at a time t
-       
-
-       
-        P''(t)
-        generation of descendants at a time t
-       
-      
-     
-    
-
-
-+=========================================+
-|>>>>>>>>>>>  Algorithm GA  <<<<<<<<<<<<<<|
-+=========================================+
-| INITIALIZE t := 0                       |
-+=========================================+
-| INITIALIZE P(t)                         |
-+=========================================+
-| evaluate FITNESS of P(t)                |
-+=========================================+
-| while not STOPPING CRITERION do         |
-|   +-------------------------------------+
-|   | P'(t)  := RECOMBINATION{P(t)}       |
-|   +-------------------------------------+
-|   | P''(t) := MUTATION{P'(t)}           |
-|   +-------------------------------------+
-|   | P(t+1) := SELECTION{P''(t) + P(t)}  |
-|   +-------------------------------------+
-|   | evaluate FITNESS of P''(t)          |
-|   +-------------------------------------+
-|   | t := t + 1                          |
-+===+=====================================+
-
-   
   
 
   
index 1e7993020b523b83e392e260a0516ceddc1a386f..f9e356348b24a05cd06e1aa77af7d7245a985162 100644 (file)
@@ -3,6 +3,7 @@
 # see README in this directory about image handling
 
 ALL_IMAGES = \
+   genetic-algorithm.svg \
    gin.svg \
    pagelayout.svg
 
diff --git a/doc/src/sgml/images/genetic-algorithm.gv b/doc/src/sgml/images/genetic-algorithm.gv
new file mode 100644 (file)
index 0000000..80c354c
--- /dev/null
@@ -0,0 +1,48 @@
+digraph {
+   layout=dot;
+
+   // default values
+   node  [shape=box, label="", fontname="sans-serif", style=filled, fillcolor=white, fontsize=8];
+   graph [fontname="sans-serif"]; // must be specified separately
+   edge  [fontname="sans-serif"]; // must be specified separately
+
+   // an unobtrusive background color
+   pad="1.0, 0.5";
+   bgcolor=whitesmoke;
+
+   // layout of edges and nodes
+   splines=ortho;
+   nodesep=0.3;
+   ranksep=0.3;
+
+   // nodes
+   a1[label="INITIALIZE t := 0"];
+   a2[label="INITIALIZE P(t)"];
+   a3[label="evaluate FITNESS of P(t)"];
+   a4[shape="diamond", label="STOPPING CRITERION"; width=4];
+
+   // connect 'end' node with 'a9' node (bottom of figure)
+   {
+     rank=same;
+     a9[label="t := t + 1"];
+     // end-symbol similar to UML notation
+     end[shape=doublecircle, label="end", width=0.5];
+   }
+
+   a5[label="P'(t) := RECOMBINATION{P(t)}"];
+   a6[label="P''(t) := MUTATION{P'(t)}"];
+   a7[label="P(t+1) := SELECTION{P''(t) + P(t)}"];
+   a8[label="evaluate FITNESS of P''(t)"];
+
+   // edges
+   a1 -> a2 -> a3 -> a4;
+   a4 -> a5[xlabel="false   ", fontsize=10];
+   a4 -> end[xlabel="true  ",  fontsize=10];
+   a5 -> a6 -> a7 -> a8 -> a9;
+   a4 -> a9 [dir=back];
+
+   // explain the notation
+   expl [shape=plaintext, fontsize=10, width=3.2, fillcolor=whitesmoke,
+         label="P(t): generation of ancestors at a time t\lP''(t): generation of descendants at a time t\l"];
+
+}
diff --git a/doc/src/sgml/images/genetic-algorithm.svg b/doc/src/sgml/images/genetic-algorithm.svg
new file mode 100644 (file)
index 0000000..fb9fdd1
--- /dev/null
@@ -0,0 +1,140 @@
+
+
+
+
+
+%3
+
+
+
+a1
+
+INITIALIZE t := 0
+
+
+
+a2
+
+INITIALIZE P(t)
+
+
+
+a1->a2
+
+
+
+
+
+a3
+
+evaluate FITNESS of P(t)
+
+
+
+a2->a3
+
+
+
+
+
+a4
+
+STOPPING CRITERION
+
+
+
+a3->a4
+
+
+
+
+
+a9
+
+t := t + 1
+
+
+
+a4->a9
+
+
+
+
+
+end
+
+
+end
+
+
+
+a4->end
+
+
+true  
+
+
+
+a5
+
+P'(t) := RECOMBINATION{P(t)}
+
+
+
+a4->a5
+
+
+false   
+
+
+
+a6
+
+P''(t) := MUTATION{P'(t)}
+
+
+
+a5->a6
+
+
+
+
+
+a7
+
+P(t+1) := SELECTION{P''(t) + P(t)}
+
+
+
+a6->a7
+
+
+
+
+
+a8
+
+evaluate FITNESS of P''(t)
+
+
+
+a7->a8
+
+
+
+
+
+a8->a9
+
+
+
+
+
+expl
+
+P(t): generation of ancestors at a time t
+P''(t): generation of descendants at a time t
+
+
+