tcl source code for genetic algorithm to find the shortest path in ns2
#1

Pls provide TCL source code for finding optimal path using GA and PSO.
Reply
#2



Procedure General for shortest path:
Initialize the array smallestWeight so that smallestWeight [u] = weight [vertex, u].
Set smallestWeight [vertex] = 0.
Find the top, v, which is the nearest Summit for which the shortest route has not been determined.
Mark v (next) Summit for which the smallest weight is found.
For each vertex w G, so that the shortest path from Summit by weight has not been determined and an edge (v, w) exists, if the weight of the path w via v is smaller than his current weight, updating the weight w to the weight of v + the weight of edge (v, w).


This code contains main function of dijikstra’s routing algorithm.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
int main()
{
Node N0(0);
Node N1(1);
Node N2(2);
Node N3(3);
Node N4(4);
RoutingVec_t NextHop;
RoutingVec_t Parent;

N0.AddAdj(1, 10);
N0.AddAdj(2, 5);

N1.AddAdj(3, 1);
N1.AddAdj(2, 2);

N2.AddAdj(4, 2);
N2.AddAdj(1, 3);
N2.AddAdj(3, 9);

N3.AddAdj(4, 4);

N4.AddAdj(0, 7);
N4.AddAdj(3, 6);

Nodes.push_back(&N0);
Nodes.push_back(&N1);
Nodes.push_back(&N2);
Nodes.push_back(&N3);
Nodes.push_back(&N4);

for (nodeid_t i = 0; i < Nodes.size(); i++)
{ // Get shortest path for each root node
printf("\nFrom root %ld\n", i);
Dijkstra(Nodes, i, NextHop, Parent);
PrintParents(Parent);
for (unsigned int k = 0; k < Nodes.size(); k++)
printf("Next hop for node %d is %ld\n", k, NextHop[k]);
printf("Printing paths\n");
for (nodeid_t j = 0; j < Nodes.size(); j++)
{
PrintRoute(i, j, Parent);
}
}
return(0);



Reason for choosing NS2 Simulator
Ns2 tech solution is a global development project and the outsourcing of the Ns2 projects for students and clients. . Ns2 technical solution works primarily in the field of searching NS2. This offers students and researchers to use our developer skills to develop a project effective Ns2. We provide various innovative ideas with an innovative solution for any type of projects NS2 in network communication. solution Ns2 helps students from last year's intelligence B.E, B.Tech, M.E and M.Tech and PhD Scholars. We provide the satisfaction of 100% with your projects and the implementation in an efficient manner.
Reply
#3

Proactive routing protocol maintains constant and updated routing information for each pair of networking nodes by propagating route updates proactively at fixed interval of time. The periodic and event-driven messages are responsible for route establishment and route maintenance. The Destination-Sequenced Distance Vector (DSDV) protocol is the commonly used proactive routing protocol in mobile ad hoc network (MANET). In DSDV, each node maintains a routing table with one route entry for each destination in which the shortest path is recorded. It uses a destination sequence number to avoid routing loops. The sample17.tcl shows a node configuration for a wireless mobile node that runs DSDV as its adhoc routing protocol. Prior to the establishment of communication between the source and receiver node, the routing protocol should be mentioned to find the route between them. Data Transmission is established between nodes using UDP agent and CBR traffic. Routing process follows DSDV routing protocol.

#Filename: sample17.tcl
#*******************DSDV ROUTING PROTOCOL****************#
# Simulator Instance Creation
set ns [new Simulator]

#Fixing the co-ordinate of simulation area
set val(x) 500
set val(y) 500
# Define options
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# page link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 10 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
set val(stop) 10.0 ;# time of simulation end

# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

# general operational descriptor- storing the hop details in the network
create-god $val(nn)

# configure the nodes
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON

# Node Creation

for {set i 0} {$i < 3} {incr i} {

set node_($i) [$ns node]
$node_($i) color black

}

#******************************Defining Communication Between node0 and all nodes ****************************8

for {set i 1} {$i < 10} {incr i} {
# Defining a transport agent for sending
set udp [new Agent/UDP]

# Attaching transport agent to sender node
$ns attach-agent $node_($i) $udp

# Defining a transport agent for receiving
set null [new Agent/Null]

# Attaching transport agent to receiver node
$ns attach-agent $node_(0) $null

#Connecting sending and receiving transport agents
$ns connect $udp $null

#Defining Application instance
set cbr [new Application/Traffic/CBR]

# Attaching transport agent to application agent
$cbr attach-agent $udp

#Packet size in bytes and interval in seconds definition
$cbr set packetSize_ 512
$cbr set interval_ 0.1

# data packet generation starting time
$ns at 1.0 "$cbr start"

# data packet generation ending time
#$ns at 6.0 "$cbr stop"

}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: shortest path code**control system for ambulances, shortest remaining time source code c, source code genetic algorithm in wsn, ns2 program to find transmission power in wireless, source code of the genetic algorithm matlab pdf, java source code for fp growth algorithm to find frequent pattern, multipath routing in ns2 tcl code,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 19,214 20-07-2018, 12:08 PM
Last Post: Guest
  authentication schemes for session passwords using color and images project source code 2 2,238 03-02-2018, 09:35 AM
Last Post: Nischithnash
  free download source code for online movie ticket booking in java 2 18,725 15-08-2017, 03:21 PM
Last Post: Morshed
  source code for rsa encryption and decryption in java 2 8,021 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
  image encryption and decryption using rsa algorithm in matlab 2 7,914 29-05-2017, 04:17 PM
Last Post: Priyanka Bidikar
  download liver tumor ct scan image in matlab with source code 4 8,070 21-05-2017, 09:54 PM
Last Post: abdulrahmanmashaal
  online cab booking source code in asp net 3 7,946 11-05-2017, 10:39 AM
Last Post: jaseela123d
Thumbs Up online catering management system on php with report and source code and ppt 4 8,806 29-04-2017, 10:59 AM
Last Post: jaseela123d
  source code for task scheduling using genetic algorithm using java 2 8,532 11-04-2017, 08:31 PM
Last Post: Guest
  automatic timetable generator source code vb 1 7,611 07-04-2017, 12:31 PM
Last Post: jaseela123d

Forum Jump: