262 Agent-Based Modeling and Simulation with Swarm
(3) Either click the Random Point button or click on the drawing ar e a and
put city locations one by one.
(4) Click the Run button.
Parameters and execution conditions c an be changed through the following
procedure during runtime.
When in Running mode, you can change the Selection Method, Re-
placement Strategy, Delay Rate, Crossover Rate, Mutation Rate, and
Elitism.
When in Running mode, you can change the city location by clicking
the city point and dragging it to a new location.
You can just click the Stop button to stop running. You can rerun the
program by just clicking the Run button a fter clicking the Stop button or
after normal stopping. This can be done only when the Run button is enabled.
When the Reset button is enabled, you may click it and put the desired values
in the corresponding text boxes.
When in running mode, RED LINES and YELLOW LINES show the best-
ever tour found and the be st tour in the current g e neration, respectively.
The best-ever tour and the best tour in the current generation are dis-
played along with their distances in the textboxes next to the labels: Overall
Best, Current Generation, and Distance, respectively. The Current Generation
number is displayed in the textbox labeled Generation#.
A.4 Wall-following simulator by GP
A robot learns through genetic programming (GP) in this code such that
it is programmed to move along a wall in a room with obs tacles (Fig. 2.1 2).
A jar file is re leased, and a Java runtime environment is necessary to execute
this code.
Each individual (robot) is shown by a blue circle (the front side of the
robot is indicated with a line). The size indicates the fitness (Fig. 2.15), where
the fitness is the number of tiles adja c e nt to a wall that the robot passed, and
larger size means better fitness.
The robots evolve such that they follow walls better as the number of
generations increases . The rob ots bec ome larger, showing that performance
is improving. The behavior of all individuals in the popula tion is displayed
simultaneously, but there is no cooperation be tween them.
The three lines at the bottom show the following information.
Best Fitness: the fitness of the best individual in this generation
GUI Systems and Source Code 263
Best tree: the S-expression (a notation for tree-structured data) of the
best individual in this generation
A.5 CG synthesis of plants based on L-systems
This system draws trees based on an L-system using interactive evolution-
ary computation (IEC) (Fig. 2.17).
This can be executed by entering
java -jar treeIEC.jar
from a ter minal, or by double-clicking treeIEC.jar in Windows.
When you pick two tr e e s from eight trees and click a button, eight new
trees are generated that have the characteristics of the two trees. Repeating
this procedure by continuing to click on two trees generates a tree tha t you
like. The same tree can be clicked twice to generate next- generation trees that
reflect the characteris tics of this tree only.
A data file with the name data will be saved in the folder when the save
button is clicked. Tree data can be loaded from the data file when the load
button is clicked.
A.6 LGPC for art
This simulator designs abstract figures (wallpaper) based on IEC methods
(Fig. 2.18). The basic proce dure for using this simulator is as follows.
(1) Click Clear if you do not like the pictures shown in the 20 windows in
the View tab; all windows will be initialized.
(2) If you like any of the pictures, select by clicking o n it (its frame becomes
red). Any number of pictures can be selected.
(3) When you c lick OK, the selected pictures are used as parent candidates
to generate and show a population of next-generation genes.
(4) Repeat (1 ) to (3)ĄD
You can save genes that you like (Gene_Save command), or load a pictur e that
you had previously saved and r e place a displayed picture with it (Gene_Load
command). The 20 window s in the View tab are numbered to allow replace-
ment (the top-left picture is No. 1; the number increas e s from left to right,
top to bo ttom up to No. 20).
264 Agent-Based Modeling and Simulation with Swarm
The following parameter settings and items are shown on the GP Param-
eters screen.
co ordinate
This determines the orig in of the coordinates in showing the expressions.
Selecting the upper-left results in an origin at the top-left co rner o f the
frame, whereas selecting the center results in an origin at the center
(this makes the pattern mo re likely to make the top and bottom halves
and/or the right and left halves sy mmetric).
OK
This is possible when at least one figure is selected. Clicking this button
results in derivation of a new generation where genes o f selected pictures
are parent candidates, and a new generation is g e nerated and displayed.
Clear
This is possible when no figure is selected. Clicking this button initializes
the gene population.
The other parameters and status are as follows.
Results scr e e n (Fig. A.3(a)): Settings and display of GTYPE
Functions
This determines the functions used as non-terminal symbols in GP.
Functions to b e used should be checked.
Constants
This determines the constants used as terminal symbols in GP. The
range and interval to be used sho uld be entered.
Best Individual
The GTYPE of the best individual (in case of LGPC for Art, all
individuals) in the generation is displayed.
GP Parameters screen (Fig. A.3(b)): The pro blem is defined.
Number of Populations (not available in LGPC for Art)
This determines the number of populations. Each population can
evolve using differe nt parameters.
Population Size (not available in LGPC for Art)
This determines the number of individuals.
Generation (no t available in LGPC for Art)
This determines the number of generations.
Selection Method (not available in LGPC for Art)
The selection strategy is determined from proportional, tourna-
ment, or rando m. Whether to implement a n additional elitist strat-
egy is also determined.
GUI Systems and Source Code 265
(a) Results s c reen (b) GP Parameters screen
FIGURE A.3: LGPC for art.
266 Agent-Based Modeling and Simulation with Swarm
Restriction on Genes
This determines the largest size of a gene.
Rate of GP Operations
This determines the probabilities of crossover and mutation.
Initial Ratio of the Nodes
This determines the probability of assigning nodes in each i ndivid-
ual as function symbols or terminal symbols (constants or variables)
when generating the initial population.
Break Point (not available in LGPC for Art)
Searches can be stopped after the designated number of generations
elapses.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.252.126