### Ant Food Collection Genetic ProgramSolutions

These are the canned programs that are already loaded in the Ant Genetic Program. You can execute these solutions by running the program, going to the 3rd tab, and selecting one of these ant programs under Load Solution.

• Simple Scattered Food Collection Problem: In this problem the food is scattered. Only a single ant is required to pick up food. There is no water or obstacles in the environment. The solution is to simply have the ant move around randomly until it finds food, and then bring it back to the nest.
• ```IF ( CARRYING FOOD ) THEN
MOVE TO NEST
ELSE
IF ( FOOD HERE ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO ADJACENT FOOD ) THEN
PICK UP FOOD
ELSE
MOVE RANDOM```
• Simple Grouped Food Collection Problem: In this problem the food is grouped in piles. Only a single ant is required to pick up food. There is no water or obstacles in the environment. The solution here is to have all of the ants move around, looking for food. When an ant finds food, it brings it back to the nest, leaving a pheromone trail behind it. Other ants that smell the trail will follow it back to the pile of food.
• ```IF ( CARRYING FOOD ) THEN
RELEASE PHEROMONE
MOVE TO NEST
ELSE
IF ( MOVE TO ADJACENT FOOD ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO AWAY PHEROMONE ) THEN
PICK UP FOOD
ELSE
MOVE RANDOM```
• Scattered Food Collection Problem with a Lake: In this problem the food is scattered behind water. The food CAN be reached by going around the water. Only a single ant is required to pick up food. There are no obstacles in the environment. To solve this problem, the ants move randomly to find the food. When the food is found, the ant does a "drunken walk" back to the nest to avoid the water.
• ```IF ( CARRYING FOOD ) THEN
MOVE RANDOM
MOVE TO NEST
ELSE
IF ( FOOD HERE ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO ADJACENT FOOD ) THEN
PICK UP FOOD
ELSE
MOVE RANDOM```
• Grouped Food Collection Problem with a Lake: In this problem the food is grouped behind water. The food CAN be reached by going around the water. Only a single ant is required to pick up food. There are no obstacles in the environment. To solve this problem, the ants move randomly to find the food. When the food is found, the ant moves in the direction to the nest, through water, releasing pheromones as it goes. Other ants will find the food, and do the same, or smell the pheromone, and continue the bridge from the other side of the water. Eventually, there will be a bridge crossing the water, and a pheromone trail will connect the nest and the food.
• ```IF ( CARRYING FOOD ) THEN
RELEASE PHEROMONE
MOVE TO NEST THROUGH WATER
ELSE
IF ( FOOD HERE ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO ADJACENT FOOD ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO AWAY PHEROMONE ) THEN
MOVE INTO WATER
ELSE
MOVE RANDOM```
• Grouped Food Collection Problem with a Stream: In this problem the food is grouped behind water. The food CANNOT be reached by going around the water. Only a single ant is required to pick up food. There are no obstacles in the environment. To solve this problem, the ants move randomly until they find the stream. Each ant at the stream will release pheromones. Other ants will follow the smell, and move to the position of another ant at the stream. When two ants are at the same position, one will move into the water. The other will move to the spot of the not dead ant, and release more pheromones. This is done, until the water is crossed. The ants then find the food on the other side of the stream, and bring it back to the nest, through water, releasing pheromones as the move. Other ants will find the food, and do the same, or smell the pheromone, and continue the bridge from the other side of the water. Eventually, there will be a bridge crossing the water, and a pheromone trail will connect the nest and the food. I have not been able to get the GP to solve this problem, except by having many ants, and having most of the ants move into the water, until there is no water left. The remaining ants solve the problem as a non-water problem. Although this solution is complicated, half of it is the same as the previous solution. A solution to this problem can be found by building on the solutions from the previous problem by using the RESTORE parameters.
• ```IF ( CARRYING FOOD ) THEN
RELEASE PHEROMONE
MOVE TO NEST THROUGH WATER
ELSE
IF ( FOOD HERE ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO ADJACENT FOOD ) THEN
PICK UP FOOD
ELSE
IF ( WATER AHEAD ) THEN
IF ( ANOTHER ANT HERE ) THEN
MOVE INTO WATER
ELSE
IF ( MOVE TO DEAD ANT ) THEN
RELEASE PHEROMONE
ELSE
RELEASE PHEROMONE
MOVE FORWARD
ELSE
IF ( MOVE TO AWAY PHEROMONE ) THEN
MOVE FORWARD
ELSE
MOVE RANDOM```
• Heavy Scattered Food Collection Problem: In this problem the food is scattered. Multiple ants are required to pick up each piece of food. There are no obstacles in the environment. To solve this problem, the ants move randomly until they find food. When an ant finds a piece of food, it will release pheromones, until enough other ants come to help lift the food. Due to the fact that all other ants might be waiting for help, the ant might decide to abandon its piece of food, and look for another ant to help. When there are enough ants to lift the food, they all lift the food and carry it back to the nest.
• ```IF ( FOOD HERE ) THEN
PICK UP FOOD
IF ( CANT LIFT FOOD ) THEN
IF ( TIRED OF WAITING )
ESCAPE PHEROMONE
ELSE
RELEASE PHEROMONE
ELSE
MOVE TO NEST
ELSE
IF ( MOVE TO ADJACENT FOOD ) THEN
PICK UP FOOD
ELSE
IF ( MOVE TO ADJACENT PHEROMONE ) THEN
PICK UP FOOD
ELSE
MOVE RANDOM```