You are on page 1of 10

Autonomus University of Nuevo Len

Mechanical and Electrical Engineering Faculty

Adaptative Systems
Half Course Project
Ant Colony Multi-Thread

Catedratic:
Dra. Sara Elena Garza Villareal
Alumni:
1646450 Ortiz Escobedo Jacob

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

AUTONOMUS UNIVERSITY OF NUEVO LEON


MECHANICAL AND ELECTRICAL ENGINEERING FACULTY
ADAPTATIVE SYSTEMS ANT COLONY OPTIMIZATION

Content
Description

Goal

Justification

Theoric Introduction

Features

Heuristic Methodology ACO

ACO Algorithm

Proposed Problem

Graph Matrix Modeling

Running Program

Running ACO with Multi-Thread

Conclusions

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

I. Description
Apply ACO (Ant Colony Optimization) Algorithm to find the optimal path with lowest weight walking once time
through each node, where the user manually defines the number of nodes.
ACO is an artificial intelligence technique based in putting ants pheromones. Basically, it is a probabilistic
technique to resolve complexes computational problems that can be reduced to seek a good path with graphs.
This algorithm is directly inspired on real ants colony behavior to solve problems of combinatorial optimization.
The basic mode of ACO algorithm is as follows: the n number of ants of the colony are concurrently moving
and asynchronous way, through the adjacent states of the problem (it can be represented as a graph with
weights). This movement is performed following one rule of transition based in the available local information
in the components (nodes). This local information includes the heuristic and memoristic information
(pheromone tracking) to guide the search. At the same time in the construction graph, ants build incrementally
solutions. Optionally, ants can put a pheromone quantity each time they cross an arc (connection) meanwhile
are building the solution (updating pheromone track step by step). Once each ant has generated a solution it
evaluates this and can deposit an amount of pheromone which is a function of the quality of its solution (online
update a posteriori of pheromone traces). This information will guide the search for the other ants of the colony
in the future.

II. Goal
Apply ACO Algorithm, developing an application in two ways, sequential and multi-thread, to know the
computational advantage while is being processing information.

III. Justification
Using multi-thread in the development can subserve to seek solution of a graph with enormous size, As you
look for the optimal route with a larger number of ants will facilitate the response in the shortest possible
time.

IV. Theoric Introduction


The term metaheuristic was introduced by Glover, and derives from the composition of two Greek words. The
meta suffix means "beyond, at a higher level," and heuristics derive from the verb heuriskein which means "to
find, to discover."
"A metaheuristic is formally defined as an iterative generation process which guides a subordinate heuristic by
intelligently combining different concepts to explore and exploit the search space, learning strategies are used
to structure the information with the aim of finding near optimal solutions efficiently ."
In short, it can be said that metaheuristics are high-level strategies for exploring search spaces using different
methods.

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

V. Features
All metaheuristic techniques have the following characteristics (Sadiq, S. M. and Habib, Y., 1999):

Blind, it doesnt know if gets the optimum solution. Therefore, they should be told when to stop.

They are approximate algorithms and, therefore, does not guarantee the optimal solution.

They occasionally accept bad moves (that is, they are search processes in which each new solution is not
necessarily better - in terms of the objective function - than the immediately previous one). Sometimes
they even accept non-viable solutions as an intermediate step to access new, unexplored regions.

They are relatively simple; All that is needed is an adequate representation of the solution space, an
initial solution (or a set of them) and a mechanism for exploring the solution field.

They are general. They can practically be applied in solving any combinatorial optimization problem.

The selection rule depends on the instant of the process and the history up to that moment. If in two
iterations determined, the solution is the same, the new solution of the following iteration need not
necessarily be the same.

VI. Heuristic Methodology ACO


The ACO algorithms are essentially constructive algorithms, that is, that in each iteration of algorithm, each ant
constructs a solution to the problem by traversing a construction graph. Each edge of the graph, which
represents the possible steps that the ant can give, has associated the types of information that guide the
movement of the ant:

Heuristic information: measures the heuristic preference of moving from node i to node j, that is,
traversing the edge . Ants do not modify this information during the execution of the algorithm.
It shows by .

Information on artificial pheromone traces: measures the learned desirability, from the movement
of i to j. It imitates the real pheromone deposited by natural ants. This information is modified during
the execution of the algorithm, depending on the solutions found by the ants. It shows by .

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

ACO Algorithm
To perform the ACO Dorigo implement certain formulas which help the path selection (edge), the update of the
pheromone (here is involved deposition and evaporation).
At each iteration, the pheromone values are updated by all the "m" ants that have built a solution. i j Is the
pheromone associated with the edge that joins the city i and j, the update is carried out in this way:

Where:
= Pheromone decreasing factor (evaporation).
^k i j = Amount of pheromone deposited on the edge (i, j) of the ant k:
This is given by:

If k passes the edge (i, j) in this path, take the top


If not, do not leave pheromone.
Where Q is the constant factor of the increase of the pheromone and Lk is the length of the roads (how many
cities it passes when completing the route, it is constant for any route, depends on the number of cities).
To find the probability of the ant selection k of edges from i to j, following the Formula:

If cij is in the set of possible candidates. Calculate the formula, otherwise assign 0
Where:
= Influence on the pheromone trail. (Give greater importance to the pheromone).

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

= Influence the distance of each edge.


ij = Heuristic information on the distances or costs of each edge.
il = Heuristic information of the other candidate paths.
il = Pheromone of the other candidate paths.
To better understand the probability formula the part of the denominator simply refers to the sum of the
product of the Heuristic Information raised to beta and the pheromone raised to the alpha of all candidates to
obtain probabilities. That is to say to the other cities which you can follow the route.
Finally, it is necessary to obtain the heuristic information about distances or costs. Here dij is the distance that
exists in the edge (i, j) or between the city i and j.

Costs, heuristic information, pheromones, and the current route that the ant has is necessary to have them
stored in some sort of list, or arrangement.

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

Proposed problem
It raises a problem where there are 11 cities (nodes), you want to go through each one without repeating the
occasion and returning to the point of origin.
The distance (weight) between each of the cities is defined manually, so the following adjacency matrix is
obtained:

Graph Matrix Modeling


The representation of the matrix is as follows:

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

Running Program
Because the choice of the initial node is arbitrary, both programs were executed until it coincides with the initial
node, in order to make a comparison in the ACO algorithm when executed sequentially and in parallel.

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

Graph Modeling with the Optimum Path

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.

Running ACO with Multi-Thread


In order to boost the optimization search, performing runs with Java using threads for the ant colony, in such a
way that they move simultaneously to find the new paths more quickly and at the same time quickly update
the pheromone of the tracking in the edges

Conclusions
In the search for the optimal path for the proposed problem with eleven nodes and four ants, starting with the
same origin node, it was observed that the time in the sequential ACO algorithm had a total time of 4,235
seconds and in the algorithm ACO Parallel one time of 3,635 seconds, thus achieving a computational advantage
in the processing time when looking for the most optimal path, the advantage expressed in time was 0.6
seconds.

Adaptative Systems, Mechanical and Electrical Engineering Faculty,


Software Technology Engineering, Autonomous University of Nuevo Len, March 2014.