Click here to Skip to main content
15,884,628 members
Articles / Programming Languages / C# 3.5
Tip/Trick

ARA - Simulation

Rate me:
Please Sign up or sign in to vote.
4.33/5 (2 votes)
10 May 2014CPOL2 min read 10.2K   10  
Ant-Colony Based Routing Algorithm (ARA) C# Simulation

Introduction

I'm providing a simulation for the (ARA) Ant-Colony Based Routing Algorithm in A mobile ad-hoc network (MANET).

MANET is a set of mobile nodes which communicate over radio and do not need any infrastructure. These kind of networks are very flexible and suitable for several situations and applications, thus they allow the establishing of temporary communication without pre installed infrastructure. Due to the limited transmission range of wireless interfaces, the communication traffic has to be relayed over several intermediate nodes to enable the communication between two nodes.

Nodes have to work as hosts, and also each node has to be a router, forwarding packets for other nodes.
The main problem in mobile ad-hoc networks is still, the finding of a route between the communication end-points, which is aggravated through the node mobility.
The ARA is a new approach for an on demand ad-hoc routing algorithm, which is based on swarm intelligence.
The ant colony is an Optimization Meta heuristic used to solve different problems, e.g. optimization problems.

Image 1

Background

Ant colony algorithms are a subset of swarm intelligence and consider the ability of simple ants to solve complex problems by cooperation. The interesting point is, that the ants do not need any direct communication for the solution process, instead they communicate by stigmergy.

The notion of stigmergy means the indirect communication of individuals through modifying their environment. Several algorithms which are based on ant colony problems were introduced in recent years to solve different problems, e.g. optimization problems. To show that the approach has the potential to become an appropriate algorithm for mobile multi-hop ad-hoc networks we present some results, which are based on our simulations.

The basic idea of the ant colony optimization meta heuristic is taken from the food searching behavior of real ants. When ants are on they way to search for food, they start from their nest and walk toward the food. When an ant reaches an intersection, it has to decide which branch to take next.
While walking, ants deposit pheromone, which marks the route taken. The concentration of pheromone on a certain path is an indication of its usage. With time, the concentration of pheromone decreases due to diffusion effects.
This property is important because it is integrating dynamic into the path searching process.

Using the Code

The method that runs on every node in the network.

C++
public void run()
{
    Console.WriteLine("Thread run for Node"+this.id);
    Message message;
        if (messagesToSend.Count > 0)
        {
            //Source and Dest must be define
            message = messagesToSend.Peek();
            int nextID = routingTable.getNextHop(message.dest);
            System.Windows.Forms.MessageBox.Show("I'm Node ["+this.id+"] Routing table result :" + nextID);
            if (nextID != -1)
            {
                message = messagesToSend.Dequeue();
                string seqNo = new SequenceFormat().createSequance(message);
                sequanceNumList.Add(seqNo);
                message.sequnceNumber = seqNo;
                message.messageType = MessageType.DATA;
                message.publinNod = Form1.getNodeById(nextID);
                send(message);
            }
            else
            {
                message = messagesToSend.Dequeue();
                string seqNo = new SequenceFormat().createSequance(message);
                message.sequnceNumber = seqNo;
                messageInWait.Add(message);
                System.Windows.Forms.MessageBox.Show("I'm Node [" + this.id + "] and i create a Fant." );
                Message fantMessage = new Message();
                fantMessage.source = this;
                fantMessage.dest = message.dest;
                fantMessage.messageType = MessageType.FANT;
                string fantseq = new SequenceFormat().createSequance(fantMessage);
                sequanceNumList.Add(fantseq);
                fantMessage.sequnceNumber = fantseq;
                broadCast(fantMessage);
            }
        }
        checkChannel();
        routingTable.updatePhermones();
        Thread.Sleep(10);
}

To download the code:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --