Select Page

# NS2 Genetic Algorithm

How to Implement Genetic Algorithm Projects using NS2 code

## What is Genetic Algorithm? Implementing Genetic Algorithm using NS2 Simulator

Genetic algorithms contains global search methods such as selection, crossover and mutation.In networks genetic algorithm is used for topology optimization for effective results.we will see what are requirements for implementing genetic algorithm using ns2 and download sample source code using NS3 Genetic Algorithm.

### Requirements of genetic algorithm:

• It requires two things mainly are generic representation of the solution domain and fitness function.
• Standard representation of the solution is as an array of bits.
• Variable length representation may also be used but crossover implementation is more complex in this case.
• Main property that makes these genetic representations convenient is that their parts are easily aligned due to their fixed size, that facilitates simple crossover operation.
• Tree-like representation are explored in genetic programming.

#### NS2 Projects Video Output

See our Latest Video Output of Ns2 Projects on Various Domain.

#### Ns2 Projects

Customized NS2 Projects for B.E/B.Tech/M.E/M.Tech/Ms/PhD Scholars.

#### Ns2 Projects Screen Shots

Ns2 Projects Screen Shots.Regular Update of NS2 Projects Screenshots here!

#### Sample code for NS2 genetic algorithm:

This is the sample code for calculating mutation and cross over operation.

```

proc combineGenes { mother father } {
variable crossover
set all_bits_set -2147483647
set child {}
foreach first \$mother second \$father {
set bit_no  [expr int(32.0*rand())]
set bitmask [expr {(\$all_bits_set&gt;&gt;\$bit_no)&lt;&lt;\$bit_no}]
set newgene [expr {\$first&amp;\$bitmask|\$second&amp;~\$bitmask}]
lappend child \$newgene
}

return \$child
}
proc mutateGenes { child } {
variable mutation
set newgenes {}
foreach gene \$child {
if { [expr {rand()}] &lt; \$mutation } {
set bit_no  [expr {int(32.0*rand())}]
set bitmask [expr {1&lt;&lt;\$bit_no}]
set bitset  [expr {(\$gene&amp;\$bitmask) != 0}]
if { \$bitset } {
set newgene [expr {\$gene&amp;~\$bitmask}]
} else {
set newgene [expr {\$gene|\$bitmask}]
}
} else {
set newgene \$gene
}
lappend newgenes \$newgene     }
return \$newgenes
}  } ;# End of namespace

```
##### Journal Support for Research Scholars
###### Ns2 Projects Work Progress
• MANET – Mobile Ad Hoc Network 95%
• VANET – Vechicle Ad Hoc Netwok 97%
• LTE – Long Term Evolution 78%
• IoT – Internet of Things 90%
• Wireless Sensor Network 89%
• Network Security 89%
• Ns2 Attacks 96%
• Cognitive Radio Network 85%
• Parallel and Distributed Computing 73%
• SDN – Software Defined Networking 95%
• P2P , Video Streaming , Peersim 96%
• IPV4 , IPV6 88%
• 4G Network , 5G Network 80%
• Visual , Underwater Sensor Network 79%
• Multicasting Communication 84%
• Wimax, WiFi 90%
• OFDMA 94%