Virtual Environment for an Ants-like Model

In this paper we introduce an integrated virtual environment of ants-like agents based on ants' behavior. Our system can simulate the behavior of ants-like agents under various conditions and environment changes. In our model the ants are moving in random on an environment that contains a randomly distributed source of food. Ants move with some simple rules and can change direction according to environmental information. We test this model with various situations and conditions of the environment to study how the system works with the pheromone information. In the aim of realizing the practical implication of our model, a web-based computer simulation is given. This simulation enables the study and test for the model under different circumstances of the environmental conditions.


INTRODUCTION
Ant colonies attracted scientists because of their ability to collectively achieve complex tasks through self-organization processes based on simple rules.It is believed that such collectively technique is the main reason for the survival of such small insects through millions of years on earth despite the drastic changes in environment and living conditions through history.Imitating this behavior, computer scientists and engineers are interested in building ants-like agents (e.g.ants-robots, see [11]) that has limited sensing and computational capabilities, but are simple to design, easy to program, and cheap to build.This makes it feasible to deploy groups of such agents, in places inaccessible otherwise, and take advantage of the resulting fault tolerance, parallelism, and collectively achievement of a certain goal.One of the most interesting ants' behaviors is the highly optimized path that ants follow, in their foraging, between the source of food and the colony's nest.The ants' decision is controlled by imitating and following of trails of a chemical substance, called pheromone.When there is a choice among several alternative paths, ants choose a path in a probabilistic way, based on the pheromone concentration over the possible paths.This mechanism allows the selection of the shortest path among several ones [7].Hence, the pheromone concentration on those paths increase more rapidly and they attract more ants.This process of indirect communication relies on a positive feedback mechanism and depends on the environment characteristics, e.g.colony size [10], food type [13], number of food sources [12] and the nature of the environment on which the ants are moving [4].Such optimized behavior inspired several applications, for example: traveling salesman problem [5], the quadratic assignment problem [6], the job shop scheduling problem [2], the graph coloring problem [3], the vehicle routing problem [1], and network routing algorithm with digital pheromone which used by British Telecommunications PLC in London to solve routing problem and to find the shortest path [9].
In this paper we introduce an integrated environment for ants-like agents based on such ants' behavior.Our system can simulate the behavior of such agents under various conditions and environment changes.In our model the ants are moving in random on an environment that contains a randomly distributed source of food.Ants move with some simple rules and can change direction according to environmental information.We test this model with various situations and conditions of the environment to study how the system works with the pheromone information.In the aim of realizing the practical implication of our model, a web-based computer simulation is given.This simulation enables the study and test for the model under different circumstances of the environmental conditions.
The paper is organized as follows.Section two contains a description of our model.In Section three we introduce the design of a web-based simulation of our model.Section four contains an analysis and study of our model and simulation.Finally we conclude our work and discuss further research in Section five.

II. THE MODEL
Our model can be described as follows.At a time t, the environment has one colony, At ants, and Ft food.All are randomly distributed in the environment.The ants' objectives are to collect food to colony and to spread pheromone, with different levels, to attract other ants' attention.The environment has changeable conditions: ants follow the birth/death property according to its life cycle, more food may be created if necessary, and the pheromone amount can be change accordingly.The flowchart in Fig. 1 (a) describes the birth/death property of ants, and in Fig. 1 (b) describes the food creation process.

Mohamed Hamada
Language Processing Lab, The Univ. of Aizu, Japan After the colony is initialized randomly at some position in the environment, the process of creating new ants starts.At a time t, if the number of ants At is less than the maximum amount of ants Amax then, if there is enough amount of food, a new ant is created at some random position in the environment, see the flowchart in Fig. 1 (a).New food can also be created in the environment.After initializing the food, at a certain time t, if the amount of food Ft is less than the maximum amount of food Fmax then, a new food is created at some random position in the environment, see the flowchart in Fig. 1(b).
An ant anti has a life cycle Li, when Li = 0, anti dies.An ant at a position p can find food in some of the surrounding four positions and can fell and affected by the pheromone in the surrounding twelve positions as shown in Fig. 2.
Pheromone is the most important simple way of ants' communication.Pheromone is spread by ants and fades away rapidly with time.Ants always spread week pheromone and if they find food, a stronger pheromone is spread to attract other ants' attention.At a time t, the amount of pheromone at position p=(x,y) will be denoted by ℎ  ,  , when no confusion, we simply use Pheromone(p).We define ℎ  ,  recursively as follows: Here D own% and D neighbor% denote the pheromone decrease percent in the position p=(x,y) and the neighboring area respectively.This decrease percentage is natural due to external factors in the environment (in nature, for example wind).The Direction set is the set of surrounding areas from the four directions around the position p, i.e.Direction= {North, East, South, West}.
Pheromone at a certain position can affect the amount of pheromone in its neighboring positions.Positions are initialized with a small amount of pheromone (may be zero).If the pheromone amount in a position is greater than zero, this position spreads pheromone to the neighbor positions in the environment.Then the amount of pheromone is decreased in that position.Finally, a new pheromone is calculated based on the decreased amount of pheromone in the position and the amount of pheromone from the neighboring positions in the environment and from other ants.The flowchart of this process is shown in Fig. 3.
In our model, such pheromone information is used to help ants to decide how to select the next step.At a time t, the pheromone information It, in a rectangular area X*Y of the environment, is calculated using the formula: At a time t, the amount of food carried to the colony by an anti is denoted by F(anti).In our model we assume some dependency among ants.An initial dependency percentage (Dep%) can be initialized in the model.If Dep% is initialized to zero, then no dependency among components.The dependency Dep(p) at some position p is calculated by the percentage of the pheromone at p, Pheromone(p), multiplied by the initial dependency percentage Dep%, i.e.

𝐷𝐷𝑒𝑒𝑝𝑝(𝑝𝑝) = 𝑝𝑝ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒(𝑝𝑝) 100 * 𝐷𝐷𝑒𝑒𝑝𝑝%
A unique behavior in our model is the property of ant's trait homing instinct.When ants' life is near its end, ants want to go home colony or rest some time.Also if ants have many food, they want to take back home quickly.At any moment, the anti desires to go back home to the colony can be measured by the Here D(anti, colony) is the distance between the anti and the colony, and w and u are some arbitrary values.When testing our model in our simulation with different values of w and u, we found that our ants-like agents work as near as real ants when the value of w=20 and the value of u=8.
In our model, ants move on a random walk.There is a set of five basic actions; Actions={move one step forward, turn right, turn left, rest in same place, pick up food}.Every action is initialized with a base probability, Pbase (i) for all i in the set of Actions.At a time t, if anti is at position (x,y), the probability of action of anti is calculated as follows.Here F(x,y) and Pheromone(x,y), represent the amount of food and the amount of pheromone at the position (x,y), i.e. the anti 's position, respectively.While m and n represent some arbitrary values.Experimentally, we found that our ants-like agents works as near as real ants when the value of m=120 and the value of n=20.
The ants' actions in our model are described in the flowchart of Fig. 4.
Ants are randomly created in the environment.If the ant is in colony, then if it holds food, release that food, decrease the life cycle of the ant and check the ant's new situation.If not in colony or in colony but holds no food, then calculate the current pheromone, check for food, and calculate the action probability.According to the value of the action probability, the ant can: move one step forward, turn right, turn left, reset in its position, or pick food.If food is picked, then spread some amount of pheromone.If not, then if the ant already holds food, then spread some amount of pheromone.Otherwise spread normal (small) amount of pheromone.Next decrease the ant's life cycle and repeat the same process till the end of the ant's life.This process is shown in the flowchart in Fig. 4.

III. SIMULATION
In this section we introduce a computer simulation of our ants' model described in section 2. The purpose of this simulation is to visualize the model elements such as ants, food and pheromone.It also enables us to test the model under different environmental conditions.In this simulation, we use n x n square lattice with absolute boundary conditions to represent the environment.All components such as colony, ants, and food are distributed randomly on the lattice cells.The simulation is designed as a web-based Java applet to enable its use over the internet.An overview of the main menu in our simulator is shown in Fig. 5.
Environment is the most important component in our simulation.The environment cellular automaton is used to spread pheromone.Each cell holds an integer value between 0 and 255 to represent the amount of pheromone in it.The simulator allows a set of pheromone preconditions.Preconditions are preserved by the environment and are used to check the behavior of ants in different situations.Five preconditions are provided; normal, line, frame, two box and squares.These preconditions represent the waves of pheromone in the environment, for example framed precondition causes the pheromone waves to be shaped as a frame.All preconditions keep the present value of pheromone.Normal condition has no preset value.The cellular automaton, that represents the environment, is determined by the values of X and Y.The simulator has three major parts: visualization components, operations, and menu.The visualization components show the simulator; which visualize and simulate the model components (colony, ants, food, and pheromone) and the graph which graphically shows the relationship between the model components.We can trace a specific ant by initializing its ID number (from 1 to Amax).Then we can follow up the random walk of that ant by using the random walk button.The information part shows much information about the simulation and the traced ant.For example we can show the mean square end to end distance of all the ants' random walks and the mean square radius of gyration.We can also see the amount of pheromone as a function of time, and many more information.The second part of the simulator is the operations.The operations that controls the simulation are simple, it is to start running the simulator as a whole or as step by step, or to clear the initialization so we can try another run with new values.The menu part of the simulator has many options to control the simulation process.We can set the initial values of ants and food, the position of the colony, and we can control the creation of food and ant through changing the parameters (as defined in the previous section).The pheromone can be controlled and initialized.The spread conditions can be modified.Finally the dependence values can

IV. ANALYSIS
To analyze our model we test it with two different conditions: when food is randomly distributed in a limited area of the environment and when food is randomly distributed in the entire environment.Within each condition five cases are considered for the pheromone dependency conditions.Then we compare the results to see how the model behaves.In this experiment we consider the cellular automaton environment with 50x50 cells, 40 ants, and 200 foods.We compare the values of average pheromone amount It/a, food in colony Ct, current food amount Ft, and number of ants At, in a time period t up to 1000.The five pheromone dependency conditions are: a.No dependency i.e. the value of initial dependency Dep% = 0% b.Dependency is Dep% = 30%, pheromone stay longer, and ants attracted to pheromone c.Dependency is Dep% = 30%, pheromone stay shorter, and ants attracted to pheromone d.Dependency is Dep% = 30%, pheromone stay longer, and ants disperse from pheromone e. Dependency is Dep% = 30%, pheromone stay shorter, and ants disperse from pheromone Cases b and c are testing the closing ants' behavior: ants spread strong pheromone when find food.Cases d and e are testing the avoiding ants' behavior: ants spread strong pheromone when they bring food to colony.The ants' action is pheromone dependent, so it is interesting to see how such pheromone conditions can affect the ants' behavior.The following tables summarize the experiment results.Table 1 summarizes the results of the five cases with respect to condition one, i.e. food is randomly distributed in a limited area of the environment.Table 2 summarizes the results for the second condition, i.e. when food is randomly distributed in the entire area of the environment.
Since the mission of ants-like agents in our model is to collect food in colony, the results show that agents work better   with condition one than condition two since the average collected food with condition one is 133.2, and the average collected food with condition two is 106.8.This result coincides with our intuition, since food in limited area can be collected faster than food in a large area.Within condition one, we found that case d is better since more food is collected.This shows that sometime too much pheromone can cause ants' confusion.Within condition two case "a" shows a better result since more food is collected.

V. CONCLUSION
In this work we introduced a model for ants-like agents based on ants' behavior.We also introduced a visual simulation of the model as a web-based java applet.Then we tested and analyzed our model through the web-based simulation.We figure out the conditions in which our model can behave like real ants in nature.However our model is more general, it can cover many more situations.This makes it a suitable model for ants-like agents (such as ants-robots).Like real ants, ants-like agents in our model rely on the pheromone as a mean method of communication and interaction with the environment.This kind of model may not be suitable in some situations in real life, where agents should be able to learn from the environment and deal with changeable environmental conditions more intelligently.For this purpose we plan to introduce intelligent ants: ants that can learn from its environment and change its behavior accordingly.We can utilize one of the neural networks techniques (such as back-propagation) or genetic algorithms for that purpose.Our system is temporarily available at [8].

Fig. 4 .
Fig. 4. The possible actions of ants in our model

Fig. 5 .
Fig. 5.The main menu of our simulator Fig. 6.The simulation components

TABLE 1 :
EXPERIMENTAL RESULTS FOR CONDITION 1

TABLE 2 :
EXPERIMENTAL RESULTS FOR CONDITION 2