Finding the shortest path using Ant Colony Optimization

advertisement

Finding the shortest path using Ant Colony Optimization

T he project aims to find the shortest path between two objects. We solve this by simulating the behavior of Ants in finding food. When an ant returns to its colony after finding food, it lays down a trail of chemical called pheromone along its path which attracts other ants to follow the trail. The pheromone evaporates over time and eventually, the trails along all paths except the shortest path (may not be the global minimum) evaporates. This causes almost all ants to follow the current shortest path until another ant found an even shorter path (by wandering randomly). The simulation reports the length of the shortest path found after a fixed number of iterations.

In our simulation, the GUI displays ants as black dots, food as blue rectangular block, pheromone trails change their color as it evaporates, where red trails imply highest intensity which fades away as it evaporates.

1

Following table lists some of the parameters (and their description) used in this application.

Parameters

World related parameters:

WORLD_WIDTH, WORLD_HEIGHT,

FOOD_X, FOOD_Y, FOOD_WIDTH,

FOOD_HEIGHT

Ant colony related parameters:

TOTAL_ANTS

TOTAL_ITERATIONS

REINFORCE_SHORTEST_PATH

EVAPORATION_STEPS_PER_ITERAI

ON

Ant related parameters:

STATE_TRANSITION_RULE_NUMBER

STEPS_PER_ITERATION

ANTS_MAX_DIR

PROB_CUR_DIR_LOWER

PROB_CUR_DIR_HIGHER

PROB_PHEROMONE_NODE

Description

The location and the size of the food

TOTAL_ANTS represents the total number of ants.

TOTAL_ITERATIONS indicates how long to run the simulation before exiting.

REINFORCE_SHORTEST_PATH the global shortest path with pheromone will be updated after each iteration. This helps the ants find better paths.

EVAPORATION_STEPS_PER_ITERAION

This is basically the evaporation rate, and ideally it should be = STEPS_PER_ITER but doing so, may result in very fast evaporation of the pheromone and might confuse the ants

STATE_TRANSITION_RULE_NUMBER

Choice-1: There are 3 directions (N,NE,E) and each direction have max_dir probabilities. Choice-2: enables ants to select nodes more randomly

STEPS_PER_ITERATION This is the number of steps the ants take before reporting to the observer. The higher the value, the faster will be the simulation.

ANTS_MAX_DIR There are 3 possible directions an ant can take and in each of these can have max_dir possible directions. 9 has been found to be a reasonable value.

Basically each ant will randomly choose one of the 3 directions (N, NE, E) and can have max_dir different probabilities within this direction.

PROB_CUR_DIR_LOWER This is the minimum probability of selecting the node in in the curDir direction.

PROB_CUR_DIR_HIGHER This is the maximum probability of selecting the node.

The probability of selecting cur direction varies from lower to upper value, generally between lower and (lower + higher).

2

Node related parameters:

LOWEST_PHEROMONE_INDEX

PROB_PHEROMONE_NODE This is the probability of selecting a node with pheromone vs randomly selecting a node.

Higher value of this means the ants just keep following the trail and don't find new paths.

Very low value implies the ants keep moving randomly.

Instead of re-computing every time the pheromone we store pre-computed value in an array, and the current pheromone level is the index to this array.

We only store up to N+1 levels. This also impacts the rate of evaporation.

3

Download