ALGAE

Programmierpraktikum II SS 2000

Clemens Bauer cbauer@cosy.sbg.ac.at Peter Eisenmann peisen@cosy.sbg.ac.at Thomas Frommwald tfromm@cosy.sbg.ac.at

Daniel Kadir dkadir@cosy.sbg.ac.at Michael Liedlgruber mliedl@cosy.sbg.ac.at

Project manager: Roland Schwaiger

July 28, 2000

Abstract

In our project for the course Programmierpraktikum II we simulate a multiple agent system. The agents are algaes which live in an aquarium. They are controlled via an artificial neural network that determines the actions of the agent based on the inputs it gets through the sensors an agent is equipped with. Agents may reproduce either sexually or a-sexually, and we got a certain mutation rate so the descendants are not exactly like their parent. Agents are able to spread pheromones to attract partners. Actions reduce the energy level of an agent, so it has to regain life force either through photo-synthesis or by consuming nutrition substrate. A light source resides on top of the aquarium and most of the substrate is at the bottom.

Contents

1 Introduction 4

2 Explanation of used symbols 5 2.1 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Algaes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2.1 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2.2 Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 World of ALGAE 7 3.1 The Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 Aquarium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.3 World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.4 Light and Substrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.5 Agents: Energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.6 Agents: Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.6.1 Light sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.6.2 Substrate sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.6.3 Pheromone sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.6.4 Bumper sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.7 Agents: Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.7.1 Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.7.2 Photo-synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.7.3 Substrate acommomdation . . . . . . . . . . . . . . . . . . . . . . . 11 3.7.4 Reproduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.8 Agents: Neural Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.9 Evolutionary Cycle and Reproduction . . . . . . . . . . . . . . . . . . . . . 13

4 ALGAE File Format Specifications 15

4.1 Configuration files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.1.2 Section Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.1.3 Section Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.4 Section ALGAES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.5 Section Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.6 Section Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.2 Statistic Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2.2 File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2.3 Section Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.2.4 Section Step i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.2.5 Section Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

5 Class Diagrams and Use Cases 23

5.1 Package GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.1.1 Class CostumDialog . . . . . . . . . . . . . . . . . . . . . . . . . . 24 5.1.2 Immutable Class SettingsDialog . . . . . . . . . . . . . . . . . . . 24 5.1.3 Class ImagePanel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.1.4 Immutable Class MainGUI . . . . . . . . . . . . . . . . . . . . . . . 27 5.1.5 Immutable Class SliderListener . . . . . . . . . . . . . . . . . . . 28 5.1.6 Immutable Class ContinueDlg . . . . . . . . . . . . . . . . . . . . . 28 5.1.7 Immutable Class HelpWin . . . . . . . . . . . . . . . . . . . . . . . 28 5.1.8 Immutable Class HtmlPanel . . . . . . . . . . . . . . . . . . . . . . 29 5.1.9 Immutable Class XMLFileFilter . . . . . . . . . . . . . . . . . . . 29 5.1.10 Immutable Class InfoWin . . . . . . . . . . . . . . . . . . . . . . . 29

5.2 Package Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.2.1 Class Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.2.2 Immutable Class GUIWC . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2.3 Class WC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2.4 Immutable Class BatchWC . . . . . . . . . . . . . . . . . . . . . . . 31 5.2.5 Class WorldState . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.2.6 Immutable Class SimulationStats . . . . . . . . . . . . . . . . . . 32

5.3 Package Agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.3.1 Immutable Class Agent . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.3.2 Immutable Class AgentSensor . . . . . . . . . . . . . . . . . . . . . 33 5.3.3 Immutable Class Phenotype . . . . . . . . . . . . . . . . . . . . . . 34 5.3.4 Immutable Class GenoType . . . . . . . . . . . . . . . . . . . . . . . 35 5.3.5 Immutable Class CubicSpline . . . . . . . . . . . . . . . . . . . . . 35

5.4 Package Worlds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.4.1 Class SubstrateWorld . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.4.2 Class LightWorld . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.4.3 Class PheromoneWorld . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.4.4 Class Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.4.5 Class Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.4.6 Class Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.4.7 Class Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.4.8 Class Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.4.9 Class World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 5.4.10 Immutable Class AgentWorld . . . . . . . . . . . . . . . . . . . . . 39

5.5 Package View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.5.1 Class ListElement . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.5.2 Class ViewListElement . . . . . . . . . . . . . . . . . . . . . . . . 40 5.5.3 Class ViewAgent . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.5.4 Class ViewLight . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.5.5 Class ViewSubstrate . . . . . . . . . . . . . . . . . . . . . . . . . . 41

5.5.6 Class ViewPheromone . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.6 Use Cases of the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

6 GUI Description 43

6.1 Configuration Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.1.1 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 6.1.2 Algaes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 6.1.3 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.1.4 Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

6.2 Main GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.2.1 Aquarium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.2.2 MenuBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.2.3 ToolBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.2.4 StatusBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

6.3 Agent Information Window . . . . . . . . . . . . . . . . . . . . . . . . . . 50

A Session logs 52 A.1 March 15, 1999 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 A.2 March 22, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 A.3 March 29, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 A.4 April 12, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 A.5 May 2, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 A.6 May 24, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 A.7 June 6, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 A.8 June 21, 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Chapter 1

Introduction

ALGAE is a followup system of elc (evolution, learning and communication), which is an implementation of a multi agent system (MAS) conceptualized and implemented by Roland Schwaiger and Konrad Lang. They investigate the evolution of wandering behavior of simple, reactive agents in a highly dynamic environment. Those simple agents wander based on the outcomes of feed forward ANNs (multi layer perceptrons). The world where our simulation will take place is an two-dimensional aquarium. On the top resides a uniform light source and at the bottom there is some nutrition substrate. Algae (agents) live in the world between. They move around consuming light and substrate (to regain energy), and may produce pheromones to find reproduction partners. The reproduction cycle takes place either sexual through meiosis or a-sexual through mitosis. There is a certain mutation rate when new agents are “produced”. All actions an agent can perform except photosynthesis and substrate accomodation reduce the agent’s energy level. Once it reaches zero, the agent dies.

The simulation may be configured in every detail by the user before it is started, and a huge amount of statistics is provided once a simulation ends.

Explanation of used symbols

2.1 Simulation

• d Duration of the simulation in time-steps

• worldx, worldy Horizontal and vertical dimensions of the aquarium

• state_{L} Light state - all the time, never, function.

• i_{L} Light intensity at light source position

• d_{L} Light distribution function

• c_{L} Light cycle function

• a_{S} Total initial substrate amount

• d_{S} Substrate distribution function

• ren_{S} Substrate renewal rate

• dec_{P} Amount of time a pheromone particle will exist

• t Timestep

2.2 Algaes

• ini_{a} Initial number of algaes

• ini_{e} Initial energy of an agent

• τ Transparency factor of algaes

• a An agent

• e Actual energy level of a

• x, y Position of a • C An agent’s chromosome

• m Modified Miller Matrix, used for the ANN

2.2.1 Sensors

• f_{P} Field of view of pheromone sensor (in degrees)

• r_{P} Range of pheromone sensor (in world units)

• f_{L} Field of view of light sensor

• r_{L} Range of light sensor

• f_{S} Field of view of substrate sensor

• r_{S} Range of substrate sensor

• f_{B} Field of view of bumper sensor

• r_{B} Range of bumper sensor

2.2.2 Actions

• e_{M} Necessary energy for movement

• e_{I} Energylevel necessary for mitosis

• e_{E} Energylevel necessary for meiosis

• e_{P} Energy used for pheromone output

• e_{S} Amount of energy gathered by consuming substrate

• e_{L} Amount of energy gathered by photosynthesis (at standard light intensity)

World of ALGAE

3.1 The Simulation

Our task is to provide a simulation environment that sets the input to the ANN and performs the actions, shown by the graphical output. It also should take care of reproduction methods and the death of an agent when out of energy. At last the simulation should be visualized. At the beginning a certain amount of agents is randomly initialized. This includes the position and the heading as well as the neural network associated with each agent. This is the point, where the aquarium (the concrete matrix) gets initialized too. This includes the substrate distribution and the light, which are both set to a starting value. The pheromone level is set to zero at each point in the matrix. After this global initialization, the main simulation loop is started. In that loop each agent performs some actions, which result from influences of its neighborhood.

3.2 Aquarium

Figure 3.1: The world where our simulation takes place.

The aquarium has a two dimensional extension, specified by (worldx, worldy). The borders on the left and right have a transparency factor of zero, i.e. no light may shine through the borders.

3.3 World

Basically, the “world” is responsible for controlling the experiment, some of its tasks are:

1. Set the output of the experiment in the GUI, i.e. show the agent, light distribution, substrate distribution, show details of the agents, s.a. energy level, genotype, phenotype.

2. Perform all calculations from one time-step t_{i} to time-step t_{i+1}, new agent positions^{1}, set sensor values of the agents^{2}

3. Insert new agents in the world once reproduction has taken place.

4. Remove agents with e of zero (or below).

3.4 Light and Substrate

The light source is completely uniform, rays are sent from top to bottom in a straight line. The light source can be set to simulate a day/night cycle or another function, but may also be set to a specific value during the simulation, or even turned off completely by the user. Light has a higher intensity at the top of the aquarium than at the bottom. Per default,the intensity is modeled by the function 1/y, where y represents the vertical world axis, but an other function may be chosen by the user. Agents reduce the light intensity for every spot below them, but they do not block the light completely due to a certain transparency value. Similarly conditions apply for the substrate which diffuses into the water. We only have a certain amount of substrate particles which difuse into the water over time. The distribution of substrate is based on a mathematical function. If a substrate particle is consummated, it is rebuilt after a specific amount of time, until the supply is used up completely. At bottom, substrate is rebuilt faster than above because the source resides there.

Let us denote the light distribution by d_{L}(x) and the substrate distribution by d_{S}(x). An example for both distribution functions would be d(x) = \frac{1}{x}. im Aquarium In figure 3.2 the distribution of the substrate is given. In each location (x, y) the substrate has concentration 1 or 0. Once a substrate is consumed by an agent the substrate will be rebuilt according to the given d_{S}(x). In the given figure we have chosen d_{S}(x) = y^{2}, for Figure 3.2: The concentration and distribution of the substrate, according to d_{S}(x) = x^{2}.

1The agents perform their steps and request from the world their new positions, since only the world knows about the positions of the other agents. Furthermore, just the world knows about the concentrations (light, substrate, pheromone).

2This has to happen in the first phase of interval [t_{i}, t_{i+1}] since all further actions of the agents rely on the sensors values.

y = 3 we get d_{S}(3) = 9 which are the time-steps the system needs to rebuild the substrate concentration^{3}. Next let’s consider the light distribution d_{L}(x). Consider that an agent a_{i} in spot (x, y) blocks part of the light for all the agents a_{j} in locations (x, y′), y′ < y. The light intensity will degrade according to a certain transparency factor τ_{i} of agent a_{i}.

Figure 3.3: The concentration and distribution of the light, according to d_{L}(x) = 1/x.

In order to model day and night in the simulation d_{L}(x) may depend on the time. As an example consider the sin function, as seen in figure 3.3. Further the time dependent modeling of the substrate concentration may be considered. The light intensity can also be changed manually by the user during the simulation.

3.5 Agents: Energy

Every agent is “born” with the same amount of energy. Energy is used for every action the agent may perform. If the energy level e reaches zero, the algae dies. Energy may be regained through photo-synthesis or substrate accomondation. It should be stated out clearly that our agents do not have a fixed life span. They live as long as they got an amount of energy greater than zero.

3In a future release of the simulation the substrate concentration in (x, y) only may be rebuilt if there is a substrate concentration in locations {(x, y′)|∀y′ : y′ < y}

3.6 Agents: Sensors

Figure 3.4: The various sensors of agents a_{i}.

To enable the agents to get information about their environment, we equip them with several sensors. An agent got four different sensors, where each points into the main directions forward, right, left and backward. Therefore, the agent gets 16 different sensor input (4 sensors * 4 directions) every time-step. All sensors have a certain field of view (FOV) and a specific range. Due to the fact the strength of the input values from the various positions of the sensor directions differ, the agent should be able to detect where the source of signal is.

3.6.1 Light sensor

This sensor gets the summed light intensity of its FOV within its range.

3.6.2 Substrate sensor

This sensor gets the value of the substrate particles in its FOV. The value each particle adds to the sensor input depends on its distance.

3.6.3 Pheromone sensor

This sensor delivers the pheromon density in its FOV (Pheromons are released by the agents in order to find reproduction partners). The value each particle adds to the sensor input depends on its distance.

3.6.4 Bumper sensor

This sensor detects obstacles (other agents or the world’s border) around the algae.

3.7 Agents: Actions

An agent is able to perform an arbitrary amount of different actions every time-step of the simulation. All of these actions consume/produce a specific amount of energy. Of course, the agent won’t perform actions that would use a higher amount of energy than it currently has.

3.7.1 Movement

Figure 3.5: The possible moving directions of agent a_{i}.

Moving is probably the most important task an agent has to perform, in order to navigate to reproduction partners, towards substrate or higher light intensity. The agent may move one unit per time-step. The agent always turns towards the new direction if necessary - it cannot make some kind of sidestep.

3.7.2 Photo-synthesis

One way for an agent to regain energy is photo-synthesis. The agent directly converts the light intensity at its current location into life energy. Higher light intensity produces a higher amount of energy.

3.7.3 Substrate acommomdation

If an agent is at the same location as a substrate particle, it consumes the particle and regains a specific amount of energy. The substrate is rebuilt after a certain number of time-steps, depending on its y position.

3.7.4 Reproduction

If the energy level e of an algae reaches a certain amount the algae may reproduce either sexually through meiosis or a-sexually (mitosis).

• Meiosis, Pheromones Once an agent a_{i} has collected enough energy points it may reach a critical limit e_{E} for sexual reproduction. From that moment on the agent may produce pheromone in order to signal other agents its ability for sexual reproduction. The agent will release the pheromone in its actual location^{4}. The pheromone will be apparent in the spot for a given amount of time-steps, let’s denote the amount of time by dec_{P}.

For the case e of an agent is higher than e_{E} and therfore it may start producing pheromone, we discussed several possibilities:

1. To distinguish between the pheromones of different agents we may introduce two genders, male and female. The two genders release different kinds of pheromone. As can be seen easily, we reduce the probability of reproduction significantly.

2. Another way to consider pheromone of different agents we may intro two agent types. The first type just releases pheromone and the second agent type just senses pheromone. Apply the argument above.

3. If one agent releases pheromone and meets another agent it will force the agent to reproduce, no matter if the other agent has an energy level greater than e_{E}. There is no way for an agent to distingiush between its own or other pheromone.

4. Finally, we introduce a flag for pheromone for each agent. With this method we get the possibility to differentiate between the pheromone of the various agents. Unfortunately not a biological plausible proposal.

In our simulation we will use on the third possibility: If one agent is willing to reproduce and meets another agent it will force the other one to reproduce, without taking care for the other’s current energy level.

• Mitosis If an agent reaches an energy level e_{I} before it finds a partner for meiosis, it can reproduce itself a-sexually through the way of mitosis. This means the agent parts itself so we get two nearly identical individuals (they do not have exactly the same genotype because there is a certain mutation rate).

Figure 3.6: Reproduction of the agents a_{i} and a_{j} .

Figure 3.7: The ANN of agent a_{i} .

3.8 Agents: Neural Network

The various actions of an agent are partially determined by its mapping from input of the environment to output, i.e. reactions. This type of agent may be called reactive agent or stimulus/response agent. In our multi agent system we model this stimulus/response relationship by means of an artificial neural network – multi layer perceptron – (ANN). The input to the ANN consists of the sensor inputs and the e of the agent. Various hidden layers are used to perform transformations of the signals. Finally at the output level the calculated moving directions are shown.

Figure 3.8: The detail view of one neuron in the ANN.

3.9 Evolutionary Cycle and Reproduction

As pointed out above we want to build our system based on the steady state approach, i.e. no generations are built and definite end is proposed but reproduction occurs on the fly. Basically all relevant information has to be encoded into various chromosomes (bit-strings). In our simulation we want to use three chromosomes per agent. The first chromosome C_{1} encodes the topology (neurons and connections) of the ANN in a Modified Miller Matrix (MMM) manner. Basically the main diagonal of the connectivity matrix where an entry m_{ii} = 1 states that the neuron is present. Whereas entry m_{ii} = 0 states that the neuron is not present. If the entry is not in the main diagonal m_{ij}, where i <> j, then the entry states the existence of the connection from neuron i to neuron j. The second chromosome C_{2} encodes the weights of the connections and the biases of the neurons, two Bytes are used for encoding. The third chromosome C_{3} encodes the cubic splines, where each point of the spline is encoded with its x and y coordinate, two Bytes respectively.

4In future releases of the simulation we may consider some distribution function for pheromone release in the neighborhood of the agent

Figure 3.9: The details for crossing over between chromosome C_{1} of agent a_{i} and a_{j}.

In order to reproduce we have to consider two different cases, meiosis and mitosis. In figure 3.9 we give an example for meiosis. In the mitosis case we duplicate the chromosomes and perform the same steps as in the meiosis case.

ALGAE File Format Specifications

The formats in which information in ALGAE will be saved to disk.

4.1 Configuration files

4.1.1 Introduction

The ALGAE-settings for different simulation environment presets are saved using the XML file-format. This format was chosen because of the flexibility and the fact, that one doesn’t have to read or edit any binary file-format. Therefore the files can easily be created or modified with any text editor. The restrictions within the creation or modification process of such a settings file are donated in the file ElementDefinitions.DTD. This file holds some simple guidelines for creating or modifying the ALGAE-settings and shouldn’t be changed unless the format is to be extended or modified.

4.1.2 Section Settings

The settings-block is the main section and holds all subsections with information about the initial simulation environment. This time only one Settings-block per file is used, but it is also possible for future development of the file-format to extend the format in such a way, that more than one settings-block could be stored in one file. This time, for each preset (or initial ALGAE-settings) a separate file is created.

The Settings-block has the following attributes:

• Version - this attribute stores the file-format version

• Creator - the program (editor) which created this file (in most cases this would be ALGAE itself)

• Name - the name of the settings-file

• Date - date and time of file-creation (or file-modification) in the format DD.MM.YY HH:MM:SS

4.1.3 Section Simulation

This section holds some general information about the initial state of a simulation. • Duration d

• Width worldx

• Height worldy

• Light enabled state_{L}, may be

     all the time
     never
     function

• Light intensity i_{L}

• Light distribution func d_{L}

• Light cycle func c_{L}

• Substrate amount a_{S}

• Substrate renew rate ren_{S}

• Pheromone dec rate dec_{P}

4.1.4 Section ALGAES

This section stores information about the algaes and their initial states. • Initial algaes ini_{a}

• Initial energy ini_{e}

4.1.5 Section Sensors

This section stores information about the algaes’ sensors and their initial states. • Pheromone fov f_{P}

• Pheromone range r_{P}

• Substrate fov f_{S}

• Substrate range r_{S}

• Light fov f_{L}

• Light range r_{L}

• Bumper fov f_{B}

• Bumper range r_{B}

4.1.6 Section Action

The attributes of this section store information about the amount of energy which is used respective collected by specific actions.

• Energy movement e_{M}

• Energy mitose e_{I}

• Energy meiose e_{E}

• Energy pheromone output e_{P}

• Energy substrate e_{S}

• Energy light e_{L}

4.2 Statistic Files

4.2.1 Introduction

An ALGAE statistics file stores very detailed informations about a simulation process. NOTE: Statistics are only written if the program was started in Batch-Mode.

4.2.2 File Structure

• Section Setting

Subsection Simulation

Subsection Agent #0 Subsection Agent #1 . . Subsection Agent #n

• Section Step 1

Subsection General Stats

Subsection Agent #1 Subsection Agent #2 . . Subsection Agent #n • Section Step 2

Subsection General Stats

Subsection Agent #1 Subsection Agent #2 . . Subsection Agent #n

• Section Step n

Subsection General Stats

Subsection Agent #1 Subsection Agent #2 . . Subsection Agent #n

• Section Summary

Subsection General Stats

Subsection Agent #0 Subsection Agent #1 . . Subsection Agent #n

Following: The different sections described more detailed

4.2.3 Section Settings

This section stores most of the information defined in the settingsfile used for the simulation which generated this statistics file. These settings are stored in the following subsection:

Subsection Simulation

• steps d(Integer value)

• random seed (Integer value) - This is the number which is used as an initialization value for the random number generator. Since this number is used forthroughout the whole simulation, the simulation may be repeated again and again, with the same results every time)

• world width worldx (Integer value)

• world height worldy (Integer value)

• neurons used (integer value) - Total number of neurons used in the ANNs of the agents

• input neurons used (integer value) - Number of input neurons used for an ANN of an agent (this time the input values for an ANN of an agent are his energylevel and the 16 values of his sensors).

• output neurons used (integer value) - Number of output neurons used for an ANN of an agent.

• initial agents ini_{a} (integer value)

• initial energy ini_{e} (float value)

• substrate a_{S} (integer value)

• substrate renew rate ren_{S} (float value)

• pheromone decrease rate dec_{P} (float value)

• pheromone sensor fov f_{P} (integer value)

• pheromone sensor range r_{P} (integer value)

• substrate sensor fov f_{S} (integer value)

• substrate sensor range r_{S} (integer value)

• light sensor fov f_{L} (integer value)

• light sensor range r_{L} (integer value)

• bumper sensor range r_{B} (integer value) Additionally this section includes information for each agent, initialized at the startup of the simulation. As a consequence this section stores n subsections of the following type (where n is the number of initial agents) Subsection Agent #i

• agent index (integer value) - This is the index of the index in the list of all agents in the simulation.

• position x x (integer value)

• position y y (integer value)

• energy level e (float value) - This is the energy-level of an agent. In this section it’s always the same value as initial energy ini_{e} in the SUBSECTION SIMULATION since we see the initial state of an agent here

4.2.4 Section Step i

A section of this type is stored for each step of the simulation. The following subsection is stored once per step and stores some general information of step i.

Subsection General Stats

• agents alive (integer value)- How many agents were alive at the current step

• agents died (integer value) - How many agents died at this step

• mitosis count (integer value) - How often mitose occured at this step (indicates the number of new born agents in this step, too, when taken in addition with meiosis count)

• meiosis count (integer value) - How often did meiose occur in this step (indicates the number of new born agents in this step, too, when taken in addition with mitosis count)

• light intensity i_{L} (float value)

• substrate amount a_{S} (float value)

• substrate consumed (integer value) - How much substrate was consumed by the agents during this step

• substrate renewed (integer value) - How much substrate was renewed in this step

• pheromone dissolved (integer value)- How many pheromone particles dissolved in this step

• pheromone renewed (integer value) - How much pheromone was renewed in this step.

• light consumed (integer value) - How much light was consumed by the agents during this step.

The following n sections of the following type store informations about the agents and their state in step i. NOTE: Only information of living agents is stored here.

Subsection Agent #a

• agent index (integer value) - Same as in subsection Subsection Agent #i in Section

  Settings

• heading (integer value) - This value stores the direction, the agent is currently heading towards

• position x x (integer value), position y y (integer value) - Same as in subsection Agent #i in section Settings, but updated during actions made by the agent

• energy level e (integer value) - Same as in subsection Agent #i in Section Settings, but updated during actions made by the agent.

• ann output (integer value) - This value is the numer of the “winner” (e.g. the one with the highest value) neuron of the ANN. Respectively it’s in most cases the same value as then heading (except for zero: the agent stands still, but shows into a direction not equal zero.

• mitosis (boolean value) - Did the agent do mitosis during this step?

• meiosis (boolean value) - Was the agent involved into meiose during this step?

• used light (boolean value) - Did the agent consume light in this step?

• used substrate (boolean value) - Did the agent consume substrate in this step?

• birth (boolean value) - Was this the “birthdate” of the agent?

• sensors values - These are the values for the agent’s sensors in step i. They are stored in a single line. The values are stored in the following order:

bumper sensor values - one float value per sensor (4 values)

pheromone sensor values - one float value per sensor (4 values)

substrate sensor values - one float value per sensor (4 values)

light sensor values - one float value per sensor (4 values)

4.2.5 Section Summary

This section is a short summarization of the agents who lived and died during the simulation. The first subsection stores some general information about the ALGAE population.

Subsection General Stats

• dead agents (integer value) - How many agents of the entire population died?

• living agents (integer value) - How many agents of the entire population are still alive at the end of the simulation?

Then a short summary for each agent follows (it doesn’t matter wether an agent is dead or alive, this list contains the whole population). The list consists of n subsections, where n is the total number of agents born during the simulation.

Subsection Agent #i

• alive (boolean value) - Indication whether the agent is dead or if he survived the whole simulation

• birth step (integer value) - During which timestep the agent was born

• alife steps (integer value) - This is the time the agent was alive • mitosis count (integer value) - This counter stores how often the agent initiated a

mitose

• meiosis count integer value) - This counter stores how often the agent was involved into a meiose

• used light (float value) - How much light did the agent consume?

• used substrate (float value) - How much substrate did the agent consume?

• number of parents (integer value) - If the agent was initialized at the beginning of the simulation, this value is 0. Otherwise, if the agent was born during mitosis/meiosis this value is 1/2

• parent 1 (integer value) - This parameter is only stored, if the agent has at least one parent. In that case it specifies the first parent (in case of mitosis the one and only parent)

• parent 2 (integer value) - This parameter is only stored, if the agent has two parents. In that case it specifies the second parent (only used in case of meiosis)

• number of children (integer value) - This value stores the number of children of agent i. If the agent never was involved into mitosis or meiosis, this number is zero

• children list - This is a list of number of children integer values. It stores the index for each child of agent a_{i}. This list is only stored if number of children is greater than zer

• phenotype miller matrix (2-dimensional array of integer values) - This is a 2-dimensional with a size of n*n, where n is the number of total neurons used in an ANN of an agent. Ir is stored in n lines with n values (1 or 0) per line

• phenotype weight matrix (2-dimensional array of float values) - This is a 2-dimensional with a size of n*n, where n is the number of total neurons used in the ANN of an agent. It is stored in n lines with n values per line

• phenotype spline matrix (2-dimensional array of float values) - This is a 2-dimensional with a size of 2*n, where n is the number of x/y-pairs used for the cubic splines in the ANNs

Class Diagrams and Use Cases

We will discuss the classes and use cases our project will based upon in this chapter.

5.1 Package GUI

This package represents every function that the program’s user interface provides.

5.1.1 Class CostumDialog

• Private Attribute magicWord:String

• Private Attribute retVal:Integer

• Private Attribute typedText:String

• Method actionPerformed(e:ActionEvent):Void
• Method customDialog(aFrame:Frame,steps:Integer,parent:ContinueDlg)
• Method getResult():integer
• Method getValidatedText():String
• Method propertyChange(e:PropertyChangeEvent):Void
• Method windowClosing(we:WindowEvent):Void

5.1.2 Immutable Class SettingsDialog

• Attribute iAmReady:Boolean = false
• Package-Attribute presets:String[] = {"-----"}
• Method actionPerformed(e:ActionEvent):Void
• Method addASFFilesToCombo():Void
• Method AreYouReady():Boolean
• Method dialogImportSettingsFile():Void
• Method dm(s:String):Void
• Method exportActionSettings(xmldoc:XmlDocument,XML>ElementNode):Void
• Method exportAlgaesSettings(xmldoc:XmlDocument,XML:ElementNode):Void
• Method exportSensorSettings (xmldoc:XmlDocument,XML: :ElementNode):Void
• Method exportSimulationSettings(xmlDoc:XmlDocument,XML:ElementNode):Void
• Method exportSettingsFile():Void
• Method getAqua():ImagePanel
• Method getSettingsVar():Settings
• Method importActionsSettings(xn:org.w3c.dom.Node):Void
• Method importAlgaesSettings(xn:org.w3c.dom.Node):Void
• Method importSensorSettings(xn:org.w3c.dom.Node):Void

• Method importSimulationSettings(xn:org.w3c.dom.Node):Void
• Method importSettingsFile(s:String):Void
• Method isPreset(s:String):Boolean
• Method makeActionsPanel():void
• Method makeAlgaesPanel():Void
• Method makeSensorsPanel():Void
• Method makeSimulationPanel():Void
• Method msgErr(S:String):Boolean
• Method settingsDialog()
• Method storeSettingsToVar():Settings
• Method verifySettings():Boolean
• Method windowClosing(e:WindowEvent):Void
5.1.3 Class ImagePanel
• Package-Attribute algeaPos:Integer = null
• Package-Attribute doubleBuffer:Boolean = true
• Package-Attribute drawGrid:Boolean = true
• Package-Attribute firstTime:Boolean = true

• Package-Attribute height:Integer

• Package-Attribute lightPos:Integer = null
• Package-Attribute pheroPos:Integer = null
• Package-Attribute subsbstratePos:Integer = null

• Package-Attribute mouseX:Integer = -1

• Package-Attribute mouseY:Integer = -1

• Static Package-Attribute scale:Float = 0.0f

• Static Package-Attribute scaleHalf:Float = 0.0f

• Package-Attribute selX:Integer = -1

• Package-Attribute selY:Integer = -1

• Package-Attribute selected:Integer = -1

• Package-Attribute width:Integer

• Package-Attribute x:Integer

• Package-Attribute y:Integer

• Method clearAList():Void
• Method clearLList():Void
• Method clearPList():Void
• Method clearSList():Void
• Method getGridX():Integer
• Method getGridY():Integer
• Method imagePanel(par:MainGUI)
• Method mouseClicked(e:MouseEvent):Void
• Method mouseDragged(e:MouseEvent):Void
• Method mouseEntered(e:MouseEvent):Void
• Method mouseExited(e:MouseEvent):Void
• Method mouseMoved(e:MouseEvent):Void
• Method mousePressed(e:MouseEvent):Void
• Method mousePressed(e:MouseEvent):Void
• Method mouseRealeased(e:MouseEvent):Void
• Method paintAlgae(marked:Integer,pos:Integer):Void
• Method paintAll():Void
• Method paintComponent(g:graphics):Void
• Method paintGrid():Void
• Method paintLight(pos:Integer):Void
• Method paintPheromone(pos:Integer):Void
• Method paintSubstrate(pos:Integer):Void
• Method paintRefresh():Void
• Method setAlgae(sel:Integer,pos:Integer):Void
• Method setLight(pos:Integer):Void

• Method setPheromones(pos:Integer):Void
• Method setSubstrates(pos:Integer):Void
• Method turnOnOffDB(dbswitch:Boolean):Void
• Method turnOnOffGrid(gSwitch:Boolean):Void
• Method update(g:Graphics):Void

5.1.4 Immutable Class MainGUI

• Package-Attribute alreadyDrawing:Boolean = false
• Package-Attribute aquaScale:Float = 1.0f
• Package-Attribute dispAlgaes:Boolean = true
• Package-Attribute dispPhero:Boolean = true
• Package-Attribute dispSubstrate:Boolean = true
• Package-Attribute drawGrid:Boolean = true
• Package-Attribute drawing:Boolean = true
• Package-Attribute first:Boolean = true
• Package-Attribute running:Boolean = false
• Attribute selection:Integer = -1
• Package-Attribute simuPaused:Boolean = false
• Package-Attribute simulationDelay:Integer = stepping-1
• Package-Attribute stepCount:Integer = 1
• Package-Attribute stepping:Integer = 1

• Package-Attribute x:Integer = 0

• Package-Attribute y:Integer = 0

• Method actionPerformed(e:ActionEven):Void
• Method addCBS():Void
• Method addCanvas():Void
• Method addMenuItems:Void
• Method addSliders():Void

• Method addToolBar():Void
• Method addToolBarButtons():Void
• Method likeToContinue(doneSteps:Integer):Integer
• Method mainGUI(set:Settings)
• Method paintAll(w:WorldState,onlyStatus:Boolean):Void
• Method paused():Boolean
• Method selected():Integer
• Method setNewAreaDimensions():Void
• Method setState(stat:String):Void
• Method setStatus(stat:String,light:Float,subAm:Float,numAlg:Integer,step:Integer,stepsToDo:Integer):Void
• Method setupGUI():Void
• Method stopped():Boolean
• Method viewAlgae():Boolean
• Method viewPheromone():Boolean
• Method viewSubstrate():Boolean
• Method windowClosing(e:WindowEvent):Void

5.1.5 Immutable Class SliderListener

• Method stateChanged(e:ChangeEvent):Void

5.1.6 Immutable Class ContinueDlg

• Method continueDlg(frame:JFrame,donwSteps:Integer)
• Method getEnteredValue():Integer

5.1.7 Immutable Class HelpWin

• Method actionPerformed(e:ActionEvent):Void
• Method helpWin(s:String)
• Method windowClosing(e:WindowEvent):Void

5.1.8 Immutable Class HtmlPanel

• Method htmlPanel(fileName:String)
• Method hyperLinkUpdate(e:HyperlinkEvent):Void
• Protected Method linkActivated(u:URL):Void

5.1.9 Immutable Class XMLFileFilter

• Method accept(f:File):Boolean
• Method getDescription():String

5.1.10 Immutable Class InfoWin

• Method actionPerformed(e:ActionEvent):Void
• Method clearValues():Void
• Method infoWin()
• Method setValues(val:Float,sel:Integer):Void
• Method windowClosing(e:WindowEvent):Void

5.2 Package Simulation

5.2.1 Class Settings

• Attribute duration:Integer
• Attribute width:Integer
• Attribute height:Integer
• Attribute initial algaes:Integer
• Attribute initial energy:Float
• Attribute light cycle function:Integer
• Attribute light enabled:Integer
• Attribute light function:Integer
• Attribute light intensity:Integer
• Attribute pheromone dec rate:integer
• Attribute substrate amount:Integer
• Attribute substrate renew rate:Float
• Attribute energy light:Float
• Attribute energy mitose:Float
• Attribute energy meiose:Float
• Attribute energy movement:Float
• Attribute energy pheromone output:Float
• Attribute energy substrate:Float
• Attribute light fov:Integer
• Attribute light range:Integer
• Attribute pheromone fov:Integer
• Attribute pheromone range:Integer
• Attribute substrate fov:Integer
• Attribute substrate range:Integer
• Attribute bumper range:Integer
• Attribute randSeed:Integer

5.2.2 Immutable Class GUIWC

• Method gUIWC(simulationSettings:Settings,p:MainGUI)
• Method getAgentAt(px:Integer,py:Integer):Integer
• Method getAgentInfos(n:Integer):Float[]
• Method getLightAt(px:Integer,py:Integer):Float
• Method getPheromoneAt(px:Integer,py:Integer):Float
• Method getState():WorldState
• Method getSubstrateAt(px:Integer,py:Integer):Float
• Method run():WorldState

5.2.3 Class WC

• Attribute stepsRunning:Integer = 0
• Attribute stepsToRun:Integer = 0
• Method finish():Void
• Method step():Void
• Method WC(set:Settings)

5.2.4 Immutable Class BatchWC

• Attribute fileName:String
• Package-Attribute Initialized:Boolean = false
• Method batchWC(set:Settings,fn:String)
• Method run():Void
5.2.5 Class WorldState
• Attribute dimx:Integer
• Attribute dimy:Integer
• Attribute lightIntensity:Float
• Attribute pList:ViewPheromone[]
• Attribute steps:Integer
• Attribute stepsToRun:Integer
• Attribute substrateAmount:Float
• Method worldState(wc:WC)

5.2.6 Immutable Class SimulationStats

• Package-Attribute fileName:String

• Attribute openStream(set:Settings,agw:AgentWorld):Boolean
• Attribute closeStream():Boolean
• Attribute simulationStats(s:String)
• Attribute writeStats(stepNo:Integer):Boolean

5.3 Package Agents

With this package, the core of the program is built: The agents and their neural networks.

5.3.1 Immutable Class Agent

• Attribute ann output:integer = 0
• Attribute born:Boolean = false
• Attribute dead:Boolean = false
• Attribute died:Boolean = false
• Attribute dir:integer
• Attribute energy level:Float = 0.0
• Attribute madeMeiosis:Boolean = false
• Attribute madeMitosis:Boolean = false
• Attribute sensor values:Float[] = new float[SENSORCOUNT]
• Attribute usedLight:Boolean = false
• Attribute usedSubstrate:Boolean = false

• Attribute x:Integer

• Attribute y:Integer

• Method agent(a:Agent,b:Agent,crossOverRate:Float,mutationRate:Float,
  c:Settings,rand:Random)
• Method agent(a:Agent,mutationRate;Float,c:settings,rand:Random)
• Method agent( sx:Integer,sy;Integer,c:Settings,rand:Random,aw:AgentWorld,
  sw:SubstrateWorld,pw:PheromonWorld,lw;LightWorld)
• Method calcStep():Integer
• Method getInfos():Float[]
• Method isAlive():Boolean

5.3.2 Immutable Class AgentSensor

• Attribute fov:Integer
• Attribute range:Integer
• Method agentSensor(c:Settings,iRange:Integer,iFov:Integer)
• Method getValuesA(x:Integer,y:Integer,w:AgentWorld):float[]
• Method getValuesL(x:Integer,y:Integer,w:LightWorld):float[]
• Method getValuesP(x:Integer,y:Integer,w:PheromoneWorldWorld):float[]

• Method getValuesS(x:Integer,y:Integer,w:SubstrateWorld):float[]
• Method inBounds(x:Integer,y:Integer):Boolean

5.3.3 Immutable Class Phenotype

• Package-Attribute hiddenCount:Integer
• Package-Attribute inOutCount:Integer
• Attribute inCount:Integer
• Attribute nCount:Integer
• Attribute neuronOutput:Float
• Attribute neuron matrix:Integer
• Attribute outCount:Integer
• Attribute spline matrix:Float
• Attribute visited:Boolean
• Attribute weight matrix:Float
• Method calculateNeuron(n:Integer):Float
• Method connected(i:integer,j:integer):Boolean
• Method getPrev(n:Integer):Integer
• Method getPrevNum(n:Integer):Integer
• Method phenotype(g:Genotype)
• Method printNeuronMatrix():Void
• Method printoutput():Void
• Method printWeightMatrix():Void
• Method processNet(inVec:Float):Integer
• Method transferFunc(funcSel:Integer,val:Float):Float

5.3.4 Immutable Class GenoType

• Package-Attribute crippled:Integer

• Package-Attribute randSeed:Integer

• Method crippleness():Integer
• Method crossOver(a:GenoType,b:Genotype,corssOverRate:Float,
  mutationRate:Float):Void
• Method float2IEEE(f:Float):Bitset
• Method iEEE2float(f:BitSet):Float
• Method genoType(rs:Integer)
• Method genoType(rs:Integer,a;GenoType,b:genotype,crossOverRate:Float,
  mutationRate:Float)
• Method genoType(rs:Integer,a:GenoType,mutationRate:Float)
• Method getFloatOuttaSm(idx:Integer):Float
• Method getFloatOuttaWm(idx:Integer):Float
• Method initRandomNm():Void
• Method initRandomSm():Void
• Method initRandomWm():Void
• Method isCrippled():Boolean
• Method mutate(mutationRate:Float):Void
• Method putFloatIntoSm(idx:Integer,f:Float):Void
• Method putFloatIntoWm(idx:Integer,f:Float):Void
• Method showIEEE(f:BitSet):Void
• Method showIEEE32(b:BitSet):Void

5.3.5 Immutable Class CubicSpline

• Package-Attribute nPoints:Integer

• Protected Method cubicSpline(n:Integer,px:Vector,py:Vector)
• Method getValue(px:Double):Double

5.4 Package Worlds

The world where our simulation takes place is built with these classes.

5.4.1 Class SubstrateWorld
• Attribute amount:Double
• Method getList():ViewSubstrate[]
• Method getSubstrateAmount():Double
• Method step(step:Integer):Void
• Method substrateWorld(set:Settings)
5.4.2 Class LightWorld
• Attribute intensity:Double
• Method consume(x:Integer,y:integer):Double
• Method getList():ViewLight[]
• Method lightWorld(set:Settings)
• Method setAgentWorld(aWorld:AgentWorld):Void
• Method step(step:Integer):Void

• Method update(fromX:Integer,fromY:Integer):Void
• Method update (fromX:Integer,fromY:Integer,toX:Integer,toY:Integer):Void
5.4.3 Class PheromoneWorld
• Method getList():ViewPheromone[]
• Method pheromoneWorld(set:Settings)
• Method set(x:integer,y:Integer)
• Method step(step:Integer):Void

5.4.4 Class Element

• Attribute x:Integer

• Attribute y:Integer

• Method add(s:Integer):Boolean
• Method element(x:Integer,y:Integer)
• Method exists():Boolean
• Method remove(s:Integer):Boolean
• Protected Method update():Boolean

5.4.5 Class Element

• Attribute stepsToResolve:Integer
• Method add(steps:Integer):Boolean
• Method element()
• Method element(amount;Double,dec:Integer)
• Method exists():Boolean
• Method remove(steps:Integer):Boolean
• Protected Method update():Boolean

5.4.6 Class Element

• Attribute stepsToGo:Integer
• Attribute stepsToRegenerate:Integer
• Method add(steps:Integer):Boolean
• Method element()
• Method element(amount;Double,dec:Integer)
• Method exists():Boolean
• Method remove(steps:Integer):Boolean
• Protected Method update():Boolean

5.4.7 Class Element

• Method add(steps:Integer):Boolean
• Method element()
• Method exists():Boolean
• Method remove(steps:Integer):Boolean
• Protected Method update():Boolean

5.4.8 Class Element

• Attribute amount:Double
• Private Method add(step:Integer):Boolean
• Method element()

• Private Method element()

• Private Method exists():Boolean
• Protected Method update():Boolean
• Method value():Double
• Method value(x:Integer,y:Integer):Double

5.4.9 Class World

• Static Attribute OUTOFWORLD:Double = 0.0
• Attribute renew:Integer = 0
• Attribute used:Integer = 0
• Abstract Method step(step:Integer):Void
• Method world()
• Method world(y:Integer,x:Integer)

5.4.10 Immutable Class AgentWorld

• Attribute agentcount:Integer
• Attribute mAX AGENTS:integer
• Attribute stepDeadCount:Integer = 0
• Attribute stepLightUsed:integer = 0
• Attribute setpMeiosisCount:Integer = 0
• Attribute stepMitosisCount:Integer = 0
• Attribute stepPheromoneNew:integer = 0
• Attribute stepPheromoneUsed:Integer = 0
• Attribute stepSubstrateNew:Integer = 0
• Attribute setpSubstrateUsed:Integer = 0
• Method agentWorld(set:Settings,s:SubstrateWorld,p:PheromoneWorld,l:LightWorld):Boolean
• Method aliveAgents():Integer
• Method doPheromoneOutput(tmp:Agent):Integer
• Protected Method findNeighbour(nOf:Integer,a:Agentempty:Boolean):Integer
• Method getList():ViewAgent[]
• Method initAgents():Void
• Method move(tmp:Agent,sel:integer):Integer
• Method step(steps:Integer):Void

5.5 Package View

5.5.1 Class ListElement

• Attribute x:Integer

• Attribute y:Integer

• Method listElement(x:Integer,y:Integer)
5.5.2 Class ViewListElement

• Attribute x:Integer

• Attribute y:Integer

• Method viewListElement(x:Integer,y:Integer)

5.5.3 Class ViewAgent

• Attribute direction:Integer
• Attribute indexOf:Integer
• Method viewAgent(x:Integer,y:Integer)

5.5.4 Class ViewLight

• Attribute amount:Float
• Method viewLight(x:Integer,y:Integer,amount:Float)

5.5.5 Class ViewSubstrate
• Attribute amount:Double
• Method viewSubstrate(x:Integer,y:Integer,amount:Double)
5.5.6 Class ViewPheromone
• Attribute amount:Double
• Method viewPheromone(x:Integer,y:Integer,amount:Double)

5.6 Use Cases of the Program

These are the possibilities that a user of ALGAE has during the simulation. The first decision is wether (s)he wants to act as a batch- or an online-user.

• A Batch User starts Algae providing a filename of a pre-defined settingsfile as parameter. The simulation starts without any further inputs. The batch user doesn’t see the graphical output or any part of the GUI of the program.

Once the simulation ran for a certain number of timesteps (defined in the settingsfile), it ends and the user may view the statistical output the simulation produced.

• The Online User is able to watch the whole simulation in real-time. (S)he can enter any settings and may load or save a configuration file. Once the simulation is started, the main GUI is visible and the user can manipulate the sim in various ways - see the graph above and the next chapter.

Of course, when the simulation ended, the online user may view the statistical output of the simulation too.

GUI Description

In this chapter, we explain how the program is controlled and how it outputs the information. We use a Graphical User Interface for input and output.

6.1 Configuration Window

The program starts with the configuration window, where all parameters relevant for the simulation are adjusted. With the OK button the user accepts the adjustment; the Simulation window opens. With the Quit button the user may abort the program When the button Save is clicked, a dialog asking for a filename pops up. The current configuration is saved to this file All saved configuration files with the appendix .asf are shown when the user clicks the dropdown list. When one of the filenames is selected, the configuration is loaded from this file. There are four tabstrips in the configuration window:

1. Simulation

2. Algaes

3. Sensors

4. Actions

6.1.1 Simulation

• The text field labeled Duration determines the duration d of the simulation. If the entered time is exceeded, the user may enter any number of additional timesteps, and the simulation is resumed; otherwise, the simulation finally stops.

• The text fields labeled Width, worldx and Height, worldy determine the size of the aquarium.

• The four text fields on the bottom determine:

the amount of substrate a_{S} at the beginning of the simulation. (Substrate

amount)

after how many time-steps ren_{S} the substrate particles are renewed on bottom

of the aquarium(Substrate renewal rate)

after how many steps dec_{P} a pheromone disapears (Pheromone decrease rate)

the random seed that the program uses. To eliminate any differences based on coincidence, the user can enter the same random seed for every simulation.

• In the frame Light settings, state_{L} there are

– radio buttons labeled Enabled with the following possibilities: All the time, which means the light shines the whole simulation Never, which means the light doesn’t shine at any time of the simulation Function, the light intensity is determined by a function. Remark: this is not fully implemented yet. At this stage, the light always shines based on a function.

– a text field labeled Intensity, which determines the light intensity i_{L} on the top of the aquarium.

– a button labeled Select distribution function, where the user can select one function d_{S} of several light distribution functions Remark: Not implemented, the distribution uses a fixed function at this stage.

– a button Select light cycle function, which determines how the light intensity changes over time. Remark: Now, this is always a sinus function to simulate a day/night cycle.

6.1.2 Algaes

In this tabstrip there are two textfieldes.

• The first field labeled # of initial Algaes determines the number of algae ini_{a} the simulation should begin with..

• The second textfield labeled Initial Energylevel determines the energylevel ini_{e} which all algaes have at the beginning of the simulation.

6.1.3 Sensors

In this tabstrip the user determines the adjustment of the four sensors (Pheromone P,

Substrate S,Light L,Bumper B)

• FOV Field of View f , this is the angle that the sensor field covers in degrees. Note that the bumper sensor always has a f of 1. It only detects obstacles in a straight line.

• Range the range r of the sensor in world units

6.1.4 Actions

In this tabstrip, there are two frames:

• In the first frame labeled Energy consumption the user can determine How much energy e_{M} an agent needs to move around (Movement). How much energy e_{I} an agent needs to reproduce via mitoses (Mitoses). How much energy e_{E} an agent uses to reproduce via meiose (Meioses). How much energy e_{P} an agent uses to discharge one pheromone prticle (Peromone

output).

• in the second frame labeled (Energy collecting) the user determines how much energy e_{S} an agent gets by consuming one (Substrate) particle and how much energy e_{L} can an agent can take from (Light) (this is a

relative value, because the amount of energy is also based on the light
intensity)

6.2 Main GUI

6.2.1 Aquarium

This is the world where our simulation takes place. It shows the agents, pheromon tracks and substrate parts.

• Agents are shwon in black

• Selected agents are red

• Pheromone tracks are blue and cover substrate particles on the same position

• Substrate is green If an agent is selected via a click of the left mouse button, it changes its color and information about this agent is shown in the Agent Info Window(see below) in the case it is visible.

6.2.2 MenuBar

File

• Quit Ends the application after a safety query

Windows

• Show/hide agent info window (see below)

Help

• Topics (shows the online help)

• About ALGAE (displays the program’s credits)

6.2.3 ToolBar

The most important controls of the program art contained in the toolbar.

Buttons

• The first button starts or resumes the simulation

• The second button pauses the simulation

• The third button is used to proceed one step

• The fourth button restarts the simulation, using the current parameters

• With the sixth button it is possible to raise the zoom factor of the aquarium so the details can be watched more easiely.

• The ninth button is used to lower the zoom factor to improve the overview over the sim

(The possible zoom factors reach from 1 pixel for each algae to a 10*10-pixel-per-agent view.)

• Set stepping: If a number s is entered into the text field besides this button and Set Stepping is clicked, the output of the aquarium is updated every s steps instead of after every step (default)

Slider There is one slider in the program window:

• The speed sp_{S}im of the simulation, e.g. the delay is controlled by the second slider

(from Fast to Slow). Check buttons (Options)

• Draw algaes/pheromone/substrate/grid: The visible objects in the aquarium

may be shown or hidden using this four check buttons

6.2.4 StatusBar

By default, it shows the following information (from left to right):

• The simulation status (running, stopped, etc)

• The light intensity on top of the aquarium

• The current agent count

• The current and total number of timesteps If the mouse pointer resides at a specific top in the aquarium, the second line of the statusbar shows the following information:

• The vertical and horizontal positions

• Light intensity at this place

• Is there substrat at this place?

• How many phermomon particles, if any, reside at this place?

• If an agent is at the position, what’s its number?

6.3 Agent Information Window

If the menu point Windows/Info Window is chosen in the Main GUI, this window opens. It can be closed with the Okay button. The following information about the selected agent is given:

• Current energy level e

• Moving direction of the agent • Sensor values of all four sensors

Appendix A

Session logs

A.1 March 15, 1999

Time: 17:00 - 17:30 Place: Room 202.2, Institute for Computer Sciences, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Eisenmann, T. Frommwald, M. Liedlgruber and D. Kadir

Treated points:

• Formalities

• General introduction to the problem

Tasks to perform until March 22,2000

• Get photos for the project-homepage

• Have a careful look at the document

• Have a look on JAVA

A.2 March 22, 2000

Time: 17:00 - 17:30 Place: Room 202.2, Institute for Computer Science, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Eisenmann, T. Frommwald, M. Liedlgruber and D. Kadir

Treated points:

• We have a concret matrix where the simulation should take place

• Substrate

Distribution of substrate is based on a mathematical function

There is a specific amount of the substrate at every point in our matrix

The regeneration of the substrate depends on the distribution function and a basic time period (determined by some parameters)

• Sensors

The sensors of our agents have a specific range and an angle of ’sight’. These things are variabel.

We got a new sensor that can detect contact (with the wall or other agents)

• Pheromons disintegrate after a while

• Possible agent actions: Power consumption, movement, pheromon output, reproduc-

tion

All actions consume different amounts of energy

• Energy consumption through photosynthesis or substrat accomondation

• Movement Speed ? Agents may move one unit in one time unit

• Reproduction Meiose / Mitose If the agent wants to reproduce through meiose he has to have a certain amount

of energy. The agent follows the pheromon tracks of other agents and puts out pheromons himself.

• Pheromon output During movement The agent should not follow his own pheromon track

• Simulation steps The current status of the sim is displayed after each simulation step During one step the agents may perform an arbitrary amount of actions (excep-

tion: movement !)

Tasks to fullfill until March 29, 2000 • Prepare further questions

A.3 March 29, 2000

Time: 17:00 - 17:30 Place: Room 202.2, Institute for Computer Science, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Eisenmann, T. Frommwald and D. Kadir

Treated points:

• Agent input

We need another input for our neural network: the current energy level of the agent

It is probably necessary that agents know whether the detected pheromon is their own or not

• The neural network

There are units in the ANN which are connected through weighted lines

The more important the connection of two unit becomes, the thicker the connecting line.

Output consists of the movement direction and everything concerning reproduction

• The light

Probably there will be some sort of ’fight’ for the positions that are near the light

Agents that are not on top level will get less light (shadows)

For this reason they may try to consume more of the substrate - the according connecting line of the ANN gets thicker

• How could the agent learn that sexual reproduction is better than the mitose ?

Tasks to fullfill until April 12, 2000:

• Revise the paper:

Exact problem definition

Session logs

Discussions

A.4 April 12, 2000

Time: 17:00 - 17:30 Location: Room 202.2, Institute for Computer Sciences, University of Salzburg Present persons: R. Schwaiger, P. Eisenmann, T. Frommwald, M. Liedlgruber and D. Kadir

Treated points: (document revised:)

• Light/Substrate:

Diffusion: Substrate regenerates faster at the bottom than above. Agent has transparency factor.

• Pheromon, Mitose, Meiose: Pheromon is placed only at the point, were agent is situated; time-delayed pheromon reduction. 4 various ways to consider meiosis - we choose the 3rd one: forced reproduction.

• World(object):

Output over all partial aspects.

• ANN:

Processing of signals with ’Cubic Splines-Methode’(set points to calculate a function)

In the ANN ’the winner takes all’ - the maximum evaluated response is selected

Tasks until Mai 2, 2000 • first GUI (/World)-prototype

• create UML-model

• ev. other questions

A.5 May 2, 2000

Time: 17:00 - 17:30 Location: Room 202.2, Institute for Computer Science, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Einsenmann, T. Frommwald and D. Kadir

Treated points:

GUI Interface

• Saving Possibility of saving from intermediate stages To draft on a particular step of the simulation

• Buttons, menu bar and tabstrip ”Settings” in the menu bar is problematic Button for gradual running Rename ”Main” by ”Aquarium”

New tabstrip which shows a list of all algae and the possibility to select one of them

Move the ”ANN Sensors” tabstrip into the algae tab writer

A new menu point ”Windows” which shows the details of the agents.

• others Show light and substrate in the aquarium. Possibility to hold back indication for a certain amount of steps

Tasks until May 24, 2000 • Description of the GUI Interface

• Some agents should move in the aquarium

• Think about in which information we would be interested

• Make treated changes of the GUI

A.6 May 24, 2000

Time: 17:00 - 17:30 Location: Room 202.2, Institute for Computer Science, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Einsenmann, T. Frommwald and D. Kadir Treated points:

• Document The document has to contain the class diagrams and use cases The source code should not be included

• GUI We will include the agent selection list discussed in a former session

• ANN The ANN is initialized randomly Visualization of the ANN is done by another project group, so we can omit that

part

• We should use the same random seed for each start

• The maximum number of neurons may be entered

• Our agents “learn through reproduction”

• We save information using the XML format Tasks until June 6, 2000

• Revise the paper, insert case diagrams and use cases

• Finish the GUI

• Make multiple agents move around in the world

A.7 June 6, 2000

Time: 17:00 - 17:30 Location: Room 0.09, Institute for Computer Science, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Einsenmann, T. Frommwald and D. Kadir

Treated points:

• GUI - Settingsdialog

Simulation: change substrate-settings to be similar to light-settings (with function)

Sensors: add bumper-sensor

add button to save settings

• Simulation:

output the sim state only every x-steps (definable)

make the duration of simulation (number of timesteps) changeable during runtime

Statistics: protocol the simulation state on harddisk and make sure functionality can be added later easily

• There should also be a slider to change the amount of substrate (similar to light)

• Colored agents: color depends on their amount of energy

Next meeting: June 21, 2000

A.8 June 21, 2000

Time: 17:00 -17:30 Location: Room 0.09, Institute for Computer Science, University of Salzburg Present persons: R. Schwaiger, C. Bauer, P. Eisenmann, T. Frommwald and D. Kadir

Treated points:

• Progress of implementation

• Improvement of paper Write the section ”abstract” (150 words) Extend and revise the Introduction Add new (latest) screenshots to the paper Formalize and generalize the whole paper.

Next meeting: July 5, 2000 14:15 (Presentation)