\documentclass[12pt,fleqn,a4paper]{report}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{xspace}
\usepackage{epsfig}
\usepackage{graphicx}

\textheight     680pt
\textwidth      460pt
\topmargin      -40pt
\oddsidemargin    5pt
\evensidemargin   5pt
\parindent        0pt

\begin{titlepage}

\title{\textbf{ALGAE}\\Programmierpraktikum II SS 2000}

\author{\textbf{Clemens Bauer}\\\textit{cbauer@cosy.sbg.ac.at}
\\\textbf{Peter Eisenmann}\\\textit{peisen@cosy.sbg.ac.at}
\\\textbf{Thomas Frommwald}\\\textit{tfromm@cosy.sbg.ac.at}
\\\textbf{Daniel Kadir}\\\textit{dkadir@cosy.sbg.ac.at}
\\\textbf{Michael Liedlgruber}\\\textit{mliedl@cosy.sbg.ac.at}
\\
\\
\\Project manager: Roland Schwaiger}


\end{titlepage}

\begin{document}
\maketitle
\tableofcontents

\chapter{Introduction}
\textbf{We will give an overview of all relevant aspects of the project \texttt{Algae} without going into too much detail. Take a look at the following chapter for further and more detailed information.}

\section{What is ALGAE}
ALGAE is a followup system of elc (evolution, learning and communication), which is an implementation of a multi agent svstem (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).  This system is implemented basing on the algae \textit{Logopodium.}\\

\subsection{Parameters}
As a basic rule, each single parameter used for the simulation, the world or the agents, can be set by the user himself.

\section{World of Algae}

\begin{figure}[hbt]
\centerline{\epsfxsize=10cm   
\epsfbox{./aquarium.xfig.eps}}   
\caption{The world where our simulation takes place.}
\label{}
\end{figure}

Our world where the simulation takes 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. 

\subsection{Light source}
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, 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 modelled by the function 1/y, where y represents the vertical world axis, but an other function may be defined by the user. \\
Agents reduce the light intensity for every spot below them, but they do not block the light completely due to a transparency value.

\subsection{Substrate}
Similarly conditions apply for the substrate which diffuses into the water. The distribution of substrate is based on a mathematical function. If a substrate particle is consumated, it is rebuilt after a specific amount of time. At bottom, substrate is rebuilt faster than above, because the source resides there.


\section{Agents}

Our agents, the algae, do not have a fixed life span. They live as long as they got an amount of energy greater than zero.

\subsection{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 reaches zero, the algae dies. Energy may be regained through photosynthesis or substrate accomondation.

\subsection{Sensors}

\begin{figure}[hbt]
\centerline{\epsfxsize=10cm   
\epsfbox{./sensors.xfig.eps}}   
\caption{The various sensors of agents $a_i$.}
\label{}
\end{figure}

To enable the agents to get information about their environment, we equip them with several sensors. An agent got four different sensors, each divided into four parts which point to the main directions forward, right, left and backward. Therefore, the agent gets 16 different sensor inputs every timestep.\\
All sensor parts 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 parts differ, the agent should be able to detect where the source of signal is.


\subsubsection{Light sensor}
This sensor gets the summed light intensity of its FOV within its range.

\subsubsection{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.

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

\subsubsection{Bumper sensor}
This sensor detects any obstacle (other agents or the world's border) around the algae.


\subsection{Actions}
An agent is able to perform an arbitrary amount of \textit{different} actions every timestep of the simulation. All of these actions consume a different amount of energy. Of course, the agent won't perform actions that would use a higher amount of energy than it currently has. 

\subsubsection{Movement}

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./moving.xfig.eps}}   
\caption{The possible moving directions of agent $a_i$.}
\label{}
\end{figure}

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 once per timestep, with abritrary speed (up to its maximum speed). Movement with higher speed consumes much more energy than slow movement.


The agent always turns towards the direction it is moving - it cannot make some kind of sidestep.

\subsubsection{Photosynthesis}
One way for an agent to get energy is photosynthesis. The agent directly converts the light intensity at its current location into life energy. Higher light intensity produces a higher amount of energy.

\subsubsection{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 timestep, depending on the y position.

\subsubsection{Reproduction}
If the energy level of an algae reaches a certain amount the algae may reproduce either sexually (meiosis) or asexually (mitosis).

\begin{itemize}

\item{Meiosis, Pheromones}\\
Once an agent has collected enough energy it may reach a critical limit 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. The pheromone will be apparent in the spot for given amount of timesteps.\\
If one agent releases pheromone and meets another agent it will force the other one to reproduce, without taking care for the other's current energy level.

\item{Mitosis}\\
If an agent reaches a certain energy level before it finds a partner for meiosis, it reproduces itself asexually 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).

\end{itemize}

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./reproduction.xfig.eps}}   
\caption{Reproduction of the agents $a_i$ and $a_j$ .}
\label{}
\end{figure}


\subsection{Neural Network}

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./ann.xfig.eps}}   
\caption{The ANN of agent $a_i$ .}
\label{}
\end{figure}

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 energy level 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.


\chapter{Deeper view to the problem}

\textbf{In this chapter, we want to deepen the understanding of the given task and concentrate on relevant parameters and notations of the problem under discussion.}

\section{The Simulation}
Our task is to provide a simulation environment that sets the input to the ANN and performs the actions, shown by the output. This 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 neighbourhood.\\

\section{World}
Basically, the world is responsible for controlling the experiment, some of its tasks are:
\begin{enumerate}
\item 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.
\item Perform all calculations from one timestep $t_i$ to timestep $t_{i+1}$, new agent positions\footnote{The 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).}, set sensor values of the agents\footnote{This has to happen in the first phase of intervall $[t_i,t_{i+1}]$ since all further actions of the agents rely on the sensors values.}   
\item Insert new agents in the world once reproduction has taken place.
\item Remove agents with an energy level of zero (or below).
\end{enumerate}

\section{Aquarium}
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.

\section{Light and Substrate}
Let us denote the light distribution by $d_L(x)$ and the substrate distribution by $d_S(x)$. In the discussion above we have given an example for the distributions, namely $d(x) = \frac{1}{x}$. This is just one example and may be set by the user out of a given set of functions. 

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./substrate_distribution.xfig.eps}}   
\caption{The concentration and distribution of the substrate, according to $d_S(x) = x^2$.}
\label{ds}
\end{figure}

In figure~\ref{ds} 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) = x^2$, for $y = 3$ we get $d_S(3) = 9$ which are the timesteps the system needs to rebuild the substrate concentration\footnote{In 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') | \forall y': y' < y\}$}. 

Next let's consider the light distribution $d_L(x)$. Consider that an agent $a_i$ in spot $(x,y)$ blocks 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 $\tau_i$ of agent $a_i$.  

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./light_distribution.xfig.eps}}   
\caption{The concentration and distribution of the light, according to $d_L(x) = 1/x$.}
\label{dl}
\end{figure}

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~\ref{dl}. Further the time dependend modeling of the substrate concentration may be considered. The light intensity can also be changed manually by the user during the simulation.


\section{Pheromone and Meiosis}
How stated before, once an agent $a_i$ has collected enough energy points it may reach a critical limit for sexual reproduction $E_s$. From that moment on the agent may produce pheromone in order to signal other agents its ability for sexual reproduction. Of course, producing pheromomes will reduce the energy level of the agent, let's denote the reduction $\Delta E_s$. The agent will release the pheromone in its actual location\footnote{In future releases of the simulation we may consider some distribution function for pheromone release in the neighborhood of the agent}. The pheromone will be apparent in the spot for a given amount of timesteps, let's denote the amount of time by $\pi_t$.

For the case an agent has an energy level greater then $E_s$ and it meets another agent we discussed various ways to consider meiosis.

\begin{enumerate}
\item 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.
\item 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.
\item 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_s$.
\item 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 agetns and just agents with energy level greater than $E_s$ may reproduce. Unfortunately not a biological plausible proposal.
\end{enumerate}
In our simulation we will focus on the third possibility. 


\newpage

\section{Artificial Neural Network}

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./ann_detail.xfig.eps}}   
\caption{The detail view of one neuron in the ANN.}
\label{ad}
\end{figure}

\section{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 (bitstrings). 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 existance 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. 

\begin{figure}[hbt]
\centerline{\epsfxsize=7cm   
\epsfbox{./reproduction_detail.xfig.eps}}   
\caption{The details for crossing over between chromosome $C_1$ of agent $a_i$ and $a_j$.}
\label{rd}
\end{figure}

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



\chapter{Class Diagrams and Use Cases}

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

\section{Package GUI}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{packagegui.eps}
\end{center}

\textbf{This package represents every function that the program's user interface provides. \textit{For further explanation of the functionality of the GUI, see the next chapter.}}

\subsection{Class MainGUI}

\begin{itemize}
	\item Attribute \texttt{zoomfactor} (public float) \textit{The zoomfactor of the aquarium output is held in this variable.}
	\item Attribute \texttt{statusbarcontents} (public string) \textit{The string which is currently present at the bottom of the GUI.}
  	\item Operation \texttt{changestatusbarcontents} (public void, parameters: string \texttt{newcontents}) \textit{The statusbar text is changed via this methode.}
	\item Operation \texttt{opennewagentinfowindow} (public void, parameters: int \texttt{whichagent}) \textit{Opens another window with agent-related information. This methode is called whenever a specific agent is selected.} 
\end{itemize}

\subsection{Class MenuBar}

This is an abstract class without any attributes or operations. It consists of several sub-classes:

\subsubsection{Subclass FileMenu}

\begin{itemize}
	\item Operation \texttt{loadstate} (public void) \textit{This Operation loads a previously saved simulation state. A Dialog box opens to determine the filename.}
	\item Operation \texttt{savestate} (public void) \textit{The status is saved, using the actual filename. If the simulation wasn't saved before, a dialog asks for the filename.} 
	\item Operation \texttt{savestateas} (public void) \textit{The simulation is saved; the user has to provide a filename first.}
	\item Operation \texttt{reset} (public void) \textit{The currently running simualation is aborted, and the configuration window opens again, so the user may enter new starting values for the sim.}
	\item Operation \texttt{quit} (public void) \textit{This operation stops the program}
\end{itemize}

\subsubsection{Subclass WindowsMenu}

\begin{itemize}
	\item Attribute \texttt{windowtitle} (public string) \textit{We identify the different windows currently open using its caption/title (each window gets an unique caption).}
	\item Operation \texttt{changewindows} (public void) \textit{Makes another window the currently active.}
	\item Operation \texttt{showorhidesimulationinfowindow} (public void) \textit{Opens the statistic window if it is not visible and closes it otherwise.}
\end{itemize}
	
\subsubsection{Subclass HelpMenu}

\begin{itemize}
	\item Operation \texttt{callhelp} (public void) \textit{Shows the online-help.}
	\item Operation \texttt{callinfo} (public void) \textit{Shows the program credits.}
\end{itemize}


\subsection{Class Tool Panel}

\begin{itemize}
	\item Operation \texttt{start} (public void) \textit{Starts/resumes the simulation.}
	\item Operation \texttt{pause} (public void) \textit{Pauses the running simulation.}
	\item Operation \texttt{restart} (public void) \textit{Restarts the simulation using the same parameters as before.}
	\item Operation \texttt{step} (public void) \textit{Advances the simulation one timestep.}
	\item Operation \texttt{changedelay} (public void, parameters: float \texttt{delayvalue}) \textit{Changes the speed, respective the delay factor of the sim.}
	\item Operation \texttt{switchgfx} (public void, parameters: boolean \texttt{onoroff}) \textit{Turns the complete graphical output on or off.}
	\item Operation \texttt{changelight} (public void, parameters: float \texttt{lightvalue}) \textit{This operation is called when the user wishes to change the light intensity during simulation runtime.}
	\item Operation \texttt{changezoom} (public void) \textit{Changes the zoom factor of the aquarium/world output.}
\end{itemize}


\subsection{Class SettingsDialog}

\begin{itemize}
	\item Operation \texttt{loadpreset} (public void, parameters: string \texttt{presetname}) \textit{If a preset is selected from the dropdown list, this methode is called to apply a pre-saved configuration.}
	\item Operation \texttt{savepreset} (public void) \textit{The user specifies a filename where the actual parameters are saved in.}
	\item Operation \texttt{applysettings} (public void) \textit{Closes the configuration window and uses the actual parameters for the simulation}
\end{itemize}


\subsection{Class AgentInfoWindow}

\begin{itemize}
	\item Operation \texttt{getagentenergy} (public float, parameters: int \texttt{whichagent}) \textit{Gets the energy level of a specific agent.}
	\item Operation \texttt{getagentx} (public int, parameters: int \texttt{whichagent}) \textit{Gets the vertical position of an agent.}
	\item Operation \texttt{getagenty} (public int, parameters: int \texttt{whichagent}) \textit{Gets the horizontal position.}
\end{itemize}


\subsection{Class SimulationInfoWindow}

\begin{itemize}
	\item Operation \texttt{calculate} (public void) \textit{In this function, all statistics given to the user are calculated and output.}
\end{itemize}


\section{Package Agents}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{packageagents.eps}
\end{center}

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


\subsection{Class AgentPopulation}

This is a superclass of the following classes.

\begin{itemize}
	\item Attribute \texttt{numberofagents} (public int) \textit{This variable holds how many agents live in the world at the moment.}
\end{itemize}


\subsection{Class Agent}

\begin{itemize}
	\item Attribute \texttt{energylevel} (public float, default = 0) \textit{The energy level of the agent.}
	\item Attribute \texttt{agentx} (public int) \textit{The horizontal position of the agent.}
	\item Attribute \texttt{agenty} (public int) \textit{The vertical position.}
	\item Operation \texttt{ann} (public void) \textit{This operation sets the input values for the agent's neural network and takes the output from the ANN too.}
	\item Operation \texttt{changeenergy} (public void, parameters: float \texttt{change}) \textit{The methode raises or lowers the energy level of the agent by the given amount.}
	\item Operation \texttt{reproduct} (public void) \textit{Starts reproduction. If there is another algae at the same location then meiosis is started, otherwise mitosis. Calls the \texttt{newagent} operation of the class \texttt{WorldController}.}
\end{itemize}


\subsection{Class Genotype}

\begin{itemize}
	\item Attribute \texttt{neuronchromosom} (public long) \textit{The coded neuron data of the agent's ANN is saved in this variable.}
	\item Attribute \texttt{weightchromsom} (public long) \textit{The weight matrix is coded in this bit-string.}
	\item Attribute \texttt{splinechromosom} (public long) \textit{The spline matrix is coded in this attribute.}
\end{itemize}


\subsection{Class Phenotype}

\begin{itemize}
	\item Attribute \texttt{fov} (public float) \textit{The maximum field of view of the agent's sensors.}
	\item Attribute \texttt{lightusability} (public float) \textit{The amount of energy that can be gained through photosynthesis.}
	\item Attribute \texttt{substrateusability} (public float) \textit{How much energy can be gained through substrate accomondation.}
\end{itemize}


\subsection{Class Ann}

\begin{itemize}
	\item Attribute \texttt{neuronmatrix} (public boolean matrix) \textit{The neuron values are held in this matrix.}
	\item Attribute \texttt{weightmatrix} (public float matrix) \textit{The weights of the connections between neurons are saved in this matrix.}
	\item Attribute \texttt{splinematrix} (public floatm atrix) \textit{The anchor points of the cubic splines are saved here.}
\end{itemize}


\section{Package Worlds}
 
\textbf{The world where our simulation takes place is built with these classes.}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{packageworlds.eps}
\end{center}

\subsection{Class AgentWorld}

\begin{itemize}
	\item Attribute \texttt{xdim} (public int) \textit{The width of the aquarium.}
	\item Attribute \texttt{ydim} (public int) \textit{The height of the aquarium.}
	\item Attribute \texttt{lightvalue} (public float) \textit{The current light intensity at the top of our world.}
	\item Attribute \texttt{substrate} (public int matrix) \textit{The number of timesteps since a substrate particle was consumated. We have to keep track of this number to know when the particle will be rebuilt. The operation \texttt{substrate} makes use of this matrix.}
	\item Attribute \texttt{pheromone} (public int matrix) \textit{The number of timesteps since a phermone particle has been discharged. Used by the operation \texttt{pheromone}.}
	\item Operation \texttt{setagentsensors} (public void) \textit{This methode calculates all sensor values for every agent and therefore sets new input values for its ANN.}	
	\item Operation \texttt{getagenenergy} (public float) \textit{Reads the current energy level of an agent.}
	\item Operation \texttt{getagentx} (public int) \textit{Gets the vertical position of an agent.}
	\item Operation \texttt{getagenty} (public int) \textit{Gets the horizontal position.}
	\item Operation \texttt{getlightintensity} (public float matrix) \textit{Calculates the light value for every position of our world matrix, based on the variable \texttt{lightvalue} and all agents (which cast shadows).}
	\item Operation \texttt{getpheromone} (public boolean matrix) \textit{Checks every position in the aquarium for present pheromone parts. Uses the \texttt{pheromone} matrix to check if a pheromone is still active.}
	\item Operation \texttt{getsubstrate} (public boolean matrix) \textit{Checks every position for present substrate particles. Uses the \texttt{substrate} matrix to check if a particle should be renewed.}
\end{itemize}


\subsection{Class WorldController}

\begin{itemize}

	\item Operation \texttt{newalgae} (public void, parameters: int \texttt{x}, int \texttt{y}) \textit{Sets a new agent in the world after reproduction has taken place.}
	\item Operation \texttt{killalgae} (public void) \textit{Eliminates an agent which is out of energy.}
\end{itemize}


\subsection{UseCases Experiment}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{experiment.eps}
\end{center}

\begin{itemize}
	\item Actor \texttt{OnlineUser} \textit{This actor represents the ''normal'' user who defines an experiment, afterwards starts it and is present most of the time to watch and manipulate the running simulation.}
	\item Actor \texttt{BatchUser} \textit{This user defines one or more experiments and starts them. (S)he doesn't want to watch the whole simulation, so no graphical output is needed. After all experiments ended, the BatchUser analyses the results.} 
	\item Actor \texttt{RemoteUser} \textit{The remote user cannot define or start experiments by himself. Normally, (s)he just watches the simulations's output (or a non-graphical variation of it) and gets the results after the program ended. Normally, the remote user's connection to the simulation will be via the WWW.} 
	\item UseCase \texttt{defineexperiment} (accessible for online- and batch-users) \textit{The user sets the configuration for one or a number of experiments.}
	\item UseCase \texttt{executeexperiment} (accessible for online- and batch-users) \textit{Starts the defined experiment(s). If more than one experiment has been specified, they are processed one after another.}
	\item UseCase \texttt{viewexperiment} (accessible for online- and remote-users) \textit{This use case represents the output of the graphical simulation or eventually a textual variant (for the remote-user).}
	\item UseCase \texttt{analyseresults} (accessible for all users) \textit{All actors may analyse the results of the simulation(s) once they are finished. These results have the form of several statistics calculated during/at the end of each simulation.}
	\item UseCase \texttt{switchusermode} (accessible for online- and batch-users) \textit{The online user may leave the simulation and therefore he wishes to turn off the output of the sim to optimize run speed. This action action is represented by this use case.\\
Otherwise, a batch user can switch mode to become an online user, so he is able to watch the experiment in real-time.}
\end{itemize}


\chapter{GUI Description}

In this chapter, we explain how the program is controlled and how it outputs the information. We use a \textbf{G}raphical \textbf{U}ser \textbf{I}nterface for input and output.

\section{Configuration Window}

The program starts with the configuration window, where all parameters relevant for the simulation are adjusted.\\
With the \texttt{OK} button the user accepts the adjustment; the configuration window is closed and the Simulation window opens.\\
With the \texttt{Abort} button the user may abort the program.\\
The user can choose between several pre-defined configurations using the \texttt{Default} dropdown list. 
Every adjustment can be saved in an own preset.\\
\\
There are four tabstrips:
\begin{enumerate}
	\item Simulation
	\item Algaes
	\item Sensors
	\item Actions
\end{enumerate}

\subsection{Simulation}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{SettingsSimulation.eps}
\end{center}

\begin{itemize}
	\item The text field labeled \texttt{Duration} determines the duration of the simulation.
	\item The text fields labeled \texttt{Dimension Width} and \texttt{Dimension Height} determine the size of the aquarium.
	\item The three text fields at the end determine:
		\subitem the amount of substrate. \texttt{(Substrate amount)}
		\subitem after how many timesteps the substrate particles are renewed \texttt{(Substrate renewal rate)}
		\subitem after how many steps a pheromone disapears \texttt{(Pheromone decrease rate)} 
	\item In the frame \texttt{Light settings} there are
	\begin{itemize}
		\item radio buttons labeled \texttt{Enabled} with the following possibilities:
		\subitem \texttt{All the time}, which means the light shines the whole simulation 
		\subitem \texttt{Never}, which means the light doesn't shine at any time of the simulation
		\subitem \texttt{Function}, the light intensity is determined by a function.
		\item a text field labeled \texttt{Intensity}, which determines the light intensity on the top of the aquarium.
		\item and a button labeled \texttt{Select distribution function...}, where the user can select one of several light distribution functions
	\end{itemize}

\end{itemize}

\subsection{Algaes}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{algae.eps}
\end{center}

In this tabstrip there are two textfieldes.
\begin{itemize}
	\item The first field labeled \texttt{\# of initial Algaes} determines the number of algae the simulation should begin with..
	\item The second textfield labeled \texttt{Initial Energylevel} determines the energylevel which the algae have at the beginning of the simulation.
\end{itemize}

\subsection{Sensors}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{sensors.eps}
\end{center}

In this tabstrip the user determines the adjustment of the three sensors \texttt{(Peromone, Substrate and Light)}.
\begin{itemize}
	\item \texttt{FOV} Field of View, this is the angle that the sensor field covers
	\item \texttt{Range} the range of the sensor
\end{itemize}

\subsection{Actions}

\begin{center}
\includegraphics[width=15.0cm, height=10.0cm]{actions.eps}
\end{center}

In this tabstrip are two frames:
\begin{itemize}
	\item In the first frame labeled \texttt{Energy consumption} the user can determine
	\subitem How much energy an agent needs to move around \texttt{(Movement)}.
	\subitem How much energy an agent needs to reproduce by Mitose \texttt{(Mitose)}.
	\subitem How much energy an agent uses to reproduce by Meiose \texttt{(Meiose)}.
	\subitem How much energy an agent uses to discharge pheromone \texttt{(Peromone output)}.
	\item and in the second frame labeled \texttt{(Energy collecting)} the user determines
	\subitem how much energy an agent gets from \texttt{(Substrate)}
	\subitem and how much energy can an agent can take from \texttt{(Light)}
\end{itemize}

\newpage

\section{Main GUI}

\begin{center}
\includegraphics[width=16.0cm, height=16.0cm]{main.eps}
\end{center}

\subsection{Aquarium}
This is the world where our simulation takes place. It shows the agents, pheromon tracks and substrate parts.\\
\\ \\
When the sim is paused, it is easy to select a specific agent; a new agent information window is opened then (see below)


\subsection{MenuBar}

\subsubsection{File}
\begin{enumerate}
\item \texttt{New} (starts a new simulation and resets the parameters)
\item \texttt{Load configuration} (loads another configuration)
\item \texttt{Save configuration}  (saves the current configuration)
\item \texttt{Save sim status} (saves everything concerning the world and its agents)
\item \texttt{Load sim status} (opens a previously saved status)
\item \texttt{Quit} Ends the application after a safety query..
\end{enumerate}

\subsubsection{Windows}
\begin{enumerate}
\item \texttt{A list of all open windows - when one label is clicked, that window becomes the active one}
\item \texttt{Show/hide simulation info window} (see below)
\end{enumerate}

\subsubsection{Help}
\begin{enumerate}
\item \texttt{Help content} (shows the online help)
\item \texttt{About} (displays the program's credits)
\end{enumerate}


\subsection{ToolBar}
The important (e.g. the most used) parts of the user interface can be handled with the toolbar.\\
\\
\subsubsection{Buttons}
\begin{itemize}
	\item The first button restarts the simulation and reuses the actual configuration\\
	\item The second button loads a previously saved simulation state\\
		(this corresponds with \texttt{Menu, File, Load sim status}
	\item The third button saves the actual state of the simulation\\
		(this corresponds with \texttt{Menu, File, Save sim status}
	\item The fourth button starts the simulation or resumes if the simulation is paused.
	\item The fifth button pauses the simulation.
	\item The sixth button is used to run the simulation step by step..
	\item With the seventh button it is possible to raise the zoom factor of the aquarium
	\item and with the ninth button is used to lower the zoom factor
	\subitem (The possible zoom factor should be, from 1 pixel for each algae to a 10*10-pixel-per-agent view.)\\

\subsubsection{Sliders}
There are two sliders in the main GUI:
\begin{itemize}
	\item The first slider controls the intensity of the light source\\ 
		(from \texttt{Dark}, no light to \texttt{Bright}, much light).
	\item The speed of the simulation is controlled by the second delay slider\\
		(from \texttt{Fast} to \texttt{Slow}).
\end{itemize}

\subsubsection{Check buttons}
With the check buttons labeled \texttt{Options}:
\begin{itemize}
	\item the graphic output can completely be turned of with the \texttt{Display ON/OFF} switch.
	\item To simulate the day/night cycle, the delay slider \texttt{Dark Bright} can be disabled with the \texttt{Day/Night cycle}
		 switch. However, the actual light intensity can still be seen by the value of this slider.
	\item The \texttt{dummy} switch is only a substitute symbol at the moment.
\end{itemize}

\subsection{StatusBar}
By default, it shows the current number of agents and the elapsed time. When a specific point in our world is selected, we get the following information:
\end{itemize}
\begin{itemize}

	\item Is there substrat at this place ?
	\item Are any phermomon tracks here ?
	\item Light intensity at this place
	\item The XY Position

\end{itemize}
 

\section{Agent Information Window}

\begin{itemize}

\item Current sensor values
\item The neural network
\item The agent's genotype (bitstring)
\item The speed, direction and action (i.e. eating) of the algae
\item The energy level, age and current position
\item Other information ?

\end{itemize}

\section{Simulation Information Window}

Here we get several statistics about the status of our population and the simulation itself.


\begin{appendix}
\chapter{Session logs}

\section{March 15, 1999}

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

\textbf{Treated points:}

\begin{itemize}
\item Formalities   
\item General introduction to the problem
\end{itemize}

\textbf{Tasks to perform until March 22,2000}
\begin{itemize}
\item Get photos for the project-homepage
\item Have a careful look at the document
\item Have a look on JAVA
\end{itemize}


\section{March 22, 2000}

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

\textbf{Treated points:}

\begin{itemize}

\item We have a concret matrix where the simulation should take place


\item Substrate
	\subitem Distribution of substrate is based on a mathematical function 
	\subitem There is a specific amount of the substrate at every point in our matrix
	\subitem The regeneration of the substrate depends on the distribution function and a basic time period (determined by some parameters) 

\item Sensors
	\subitem The sensors of our agents have a specific range and an angle of 'sight'. These things are variabel.
            \subitem We got a new sensor that can detect contact (with the wall or other agents)

\item Pheromons disintegrate after a while

\item Possible agent actions: Power consumption, movement, pheromon output, reproduction
 	\subitem All actions consume different amounts of energy

\item Energy consumption through photosynthesis or substrat accomondation

\item Movement
		\subitem Speed ?
		\subitem Agents may move one unit in one time unit

\item Reproduction
	\subitem Meiose / Mitose
	\subitem 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.

\item Pheromon output
 	\subitem During movement 
	\subitem The agent should not follow his own pheromon track

\item Simulation steps
	\subitem The current status of the sim is displayed after each simulation step  
	\subitem During one step the agents may perform an arbitrary amount of actions (exception: movement !)

\end{itemize}

\textbf{Tasks to fullfill until March 29, 2000}
\begin{itemize}
\item Prepare further questions
\end{itemize}

\newpage
\section{March 29, 2000}

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

\textbf{Treated points:}

\begin{itemize}

\item Agent input
	\subitem We need another input for our neural network: the current energy level of the agent
 	\subitem It is probably necessary that agents know whether the detected pheromon is their own or not


\item The neural network
	\subitem There are units in the ANN which are connected through weighted lines
	\subitem The more important the connection of two unit becomes, the thicker the connecting line.
	\subitem Output consists of the movement direction and everything concerning reproduction


\item The light
	\subitem Probably there will be some sort of 'fight' for the positions that are near the light
	\subitem Agents that are not on top level will get less light (shadows) 
	\subitem For this reason they may try to consume more of the substrate - the according connecting line of the ANN gets thicker

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

\end{itemize}

\textbf{Tasks to fullfill until April 12, 2000:}

\begin{itemize}

\item Revise the paper:
	\subitem Exact problem definition
	\subitem Session logs
	\subitem Discussions

\end{itemize}


\section{April 12, 2000}
 
\textbf{Time:} 17:00 - 17:30\\
\textbf{Location:} Room 202.2, Institute for Computer Sciences,
University of Salzburg\\  \textbf{Present persons:} R. Schwaiger, P.
Eisenmann, T. Frommwald, M. Liedlgruber and D. Kadir\\
   
\textbf{Treated points: \\
        (document revised:)} 
 
\begin{itemize} 
 
\item Light/Substrate: 
	\subitem Diffusion: Substrate regenerates faster at the bottom than above.
	\subitem Agent has transparency factor.
\item Pheromon, Mitose, Meiose:
	\subitem Pheromon is placed only at the point, were agent is situated;
	\subitem time-delayed pheromon reduction.
	\subitem 4 various ways to
consider meiosis \ - we choose the 3rd one: forced reproduction.

\item World(object):
	\subitem Output over all partial aspects.
\\

\item ANN: 
	\subitem Processing of signals with 'Cubic Splines-Methode'(set points
to calculate a function)
 	\subitem In the ANN 'the winner takes all' \ - the maximum evaluated
response is selected
	 
\end{itemize} 
 
\textbf{Tasks until Mai 2, 2000} 
\begin{itemize}
\item first GUI (/World)-prototype
\item create UML-model
\item ev. other questions 
\end{itemize}

\section{May 2, 2000}
\textbf{Time:} 17:00 - 17:30\\
\textbf{Location:} Room 202.2, Institute for Computer Science, University of Salzburg\\ 
\textbf{Present persons:} R. Schwaiger, C. Bauer, P. Einsenmann, T. Frommwald and D. Kadir\\ 

\textbf{Treated points:}\\

\textbf{GUI Interface}
\begin{itemize}
	\item Saving
		\subitem Possibility of saving from intermediate stages
		\subitem To draft on a particular step of the simulation
	\item Buttons, menu bar and tabstrip
		\subitem "Settings" in the menu bar is problematic
		\subitem Button for gradual running
		\subitem Rename "Main" by "Aquarium"
		\subitem New tabstrip which shows a list of all algae and the possibility to select one of them
		\subitem Move the "ANN Sensors" tabstrip into the algae tab writer
		\subitem A new menu point "Windows" which shows the details of the agents.
	\item{others}
		\subitem Show light and substrate in the aquarium.
		\subitem Possibility to hold back indication for a certain amount of steps
\end{itemize}
\textbf{Tasks until May 24, 2000}  
\begin{itemize}
	\item Description of the GUI Interface
	\item Some agents should move in the aquarium
	\item Think about in which information we would be interested
	\item Make treated changes of the GUI
\end{itemize}

\section{May 24, 2000}
\textbf{Time:} 17:00 - 17:30\\
\textbf{Location:} Room 202.2, Institute for Computer Science, University of Salzburg\\ 
\textbf{Present persons:} R. Schwaiger, C. Bauer, P. Einsenmann, T. Frommwald and D. Kadir\\ 

\textbf{Treated points:}\\

\begin{itemize}
	\item Document
		\subitem The document has to contain the class diagrams and use cases
		\subitem The source code should not be included
	\item GUI
		\subitem We will include the agent selection list discussed in a former session	
	\item ANN
		\subitem The ANN is initialized randomly
		\subitem Visualization of the ANN is done by another project group, so we can omit that part

	\item We should use the same random seed for each start
	\item The maximum number of neurons may be entered
 	\item Our agents ``learn through reproduction''
	\item We save information using the XML format
	
\end{itemize}
\textbf{Tasks until June 6, 2000}  
\begin{itemize}
	\item Revise the paper, insert case diagrams and use cases
	\item Finish the GUI
	\item Make multiple agents move around in the world
\end{itemize}

\end{appendix}

\end{document}
