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