Genetic Algorithm is designed to simulate processes in natural systems. Over a consecutive generation, GA stimulates the survival of the fittest among individuals. GA is also a part of evolutionary computing. We guide research scholars for genetic algorithm implementation in ns2 simulator with source code.
After the initial population, the algorithms define the following functions
Get to know about the basic operator, applications, and benefits of genetic algorithm projects. Implement genetic algorithm in ns2 with guidance from industry experts for an affordable cost.
#Creating a new Simulator object
set ns [new Simulator]
#Opening file to be used as nam trace file
set nf [open shot.nam w]
$ns namtrace-all $nf
#Finish procedure
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam shot.nam &
exit 0}
#Defining two nodes
set n0 [$ns node]
set n1 [$ns node]
#Connecting two nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
#CreateUDP agent and connect to node0
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
#Create CBR traffic source and attach to UDP agent
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 1
$cbr0 attach-agent $udp0
set null0 [new Agent/Null]
$ns attach-agent $n1 $null0
$ns connect $udp0 $null0
#CreateUDP agent and connect to node1
set udp1 [new Agent/UDP]
$ns attach-agent $n1 $udp1
#Create CBR traffic source and attach to UDP agent
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 1
$cbr1 attach-agent $udp1
set null1 [new Agent/Null]
$ns attach-agent $n0 $null1
$ns connect $udp1 $null1
for {set i 0} {$i < 10} {incr i} {
set q [expr $i%2]
if {$q==0} {
set a i
set b [expr $i+1]
$ns at a “$cbr0 start”
$ns at b “$cbr0 stop”}
if {$q!=0} {
set a i
set b [expr $i+1]
$ns at a “$cbr1 start”
$ns at b “$cbr1 stop”}}
#Stop after 10 seconds
$ns at 10.0 “finish”
Running simulation
$ns run
Technology | Ph.D | MS | M.Tech |
---|---|---|---|
NS2 | 75 | 117 | 95 |
NS3 | 98 | 119 | 206 |
OMNET++ | 103 | 95 | 87 |
OPNET | 36 | 64 | 89 |
QULANET | 30 | 76 | 60 |
MININET | 71 | 62 | 74 |
MATLAB | 96 | 185 | 180 |
LTESIM | 38 | 32 | 16 |
COOJA SIMULATOR | 35 | 67 | 28 |
CONTIKI OS | 42 | 36 | 29 |
GNS3 | 35 | 89 | 14 |
NETSIM | 35 | 11 | 21 |
EVE-NG | 4 | 8 | 9 |
TRANS | 9 | 5 | 4 |
PEERSIM | 8 | 8 | 12 |
GLOMOSIM | 6 | 10 | 6 |
RTOOL | 13 | 15 | 8 |
KATHARA SHADOW | 9 | 8 | 9 |
VNX and VNUML | 8 | 7 | 8 |
WISTAR | 9 | 9 | 8 |
CNET | 6 | 8 | 4 |
ESCAPE | 8 | 7 | 9 |
NETMIRAGE | 7 | 11 | 7 |
BOSON NETSIM | 6 | 8 | 9 |
VIRL | 9 | 9 | 8 |
CISCO PACKET TRACER | 7 | 7 | 10 |
SWAN | 9 | 19 | 5 |
JAVASIM | 40 | 68 | 69 |
SSFNET | 7 | 9 | 8 |
TOSSIM | 5 | 7 | 4 |
PSIM | 7 | 8 | 6 |
PETRI NET | 4 | 6 | 4 |
ONESIM | 5 | 10 | 5 |
OPTISYSTEM | 32 | 64 | 24 |
DIVERT | 4 | 9 | 8 |
TINY OS | 19 | 27 | 17 |
TRANS | 7 | 8 | 6 |
OPENPANA | 8 | 9 | 9 |
SECURE CRT | 7 | 8 | 7 |
EXTENDSIM | 6 | 7 | 5 |
CONSELF | 7 | 19 | 6 |
ARENA | 5 | 12 | 9 |
VENSIM | 8 | 10 | 7 |
MARIONNET | 5 | 7 | 9 |
NETKIT | 6 | 8 | 7 |
GEOIP | 9 | 17 | 8 |
REAL | 7 | 5 | 5 |
NEST | 5 | 10 | 9 |
PTOLEMY | 7 | 8 | 4 |