antnet_rtable.h – Lavina’ s algorithm

// \file antnet_rtable.h

// \brief Definition file for routing table in AntNet

#ifndef __antnet_rtable_h__
#define __antnet_rtable_h__

#include <trace.h>
#include <map>
#include <string>
#include <vector>
#include <classifier-port.h>

#include <random.h>

#include “ant_pkt.h”
#include “antnet_common.h”

// \brief Represents an entry in routing table

// This structure represents pheromone value corresponding to a neighbor node

struct pheromone {
nsaddr_t neighbor; ///< address of neighbor node
double phvalue; ///< pheromone value

/// vector of pheromone values (represents entry in routing table corresponding to a destination)

typedef std::vector<struct pheromone> pheromone_matrix;
/// Routing table
typedef std::map<nsaddr_t, pheromone_matrix> rtable_t;
/// Vector of neighbors all having same and maximum pheromone value
typedef std::vector<nsaddr_t> sameph_t;

/// \brief Class to implement routing table

class antnet_rtable {
rtable_t rt_;   ///< routing table

RNG *rnum;      ///< random number generator

/// Constructor
antnet_rtable() {
rnum = new RNG((long int)CURRENT_TIME);

/// Method to add an entry in routing table
// Parameters: destination node, neighbor node, pheromone value

void add_entry(nsaddr_t destination, nsaddr_t neighbor, double phvalue);
/// Method to print routing table
void print();
/// returns destination node for given source node
nsaddr_t calc_destination(nsaddr_t source);
/// returns next hop node for given source destination pair
// Parameters: source node, destination node, parent node

nsaddr_t calc_next(nsaddr_t source, nsaddr_t destination, nsaddr_t parent);
/// updates an entry in routing table
// Parameters: destination node, neighbor node

void update(nsaddr_t destination, nsaddr_t neighbor);



One Response

  1. I can’t understand how to get the next hop node,the probability computed is based on the queue length between two nodes. But why not use the pheromone?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: