Released the manual for implementation

Based on the manual written by Lavina Jain for the Ns-2.28, I launched the manual for implementation of AntNet altorithm for Ns-2.33.

Click here to download.

Hope that I have helped.

Regards,

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
public:

/// 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);
};

#endif