What is Genetic Algorithm?What are important terms used in Genetic Algorithm NS2?
Genetic Algorithm is a search technique mainly used in computing. To find true or approximate solutions to optimization or to solve problems genetic algorithm ns2 is widely used.Some of the important terms used in genetic algorithm ns2 are as follows
- Individual.
- Chromosome.
- Search space.
- Locus.
- Population.
- Genome.
- Allele.
- Trait.
Core Concepts used in Genetic Algorithm Implementation in NS2
- Web service discovery.
- Involved in bus network optimization.
- For achieving QoS in manet
- Network scheduling.
- Used in intrusion detection system.
Architecture of genetic algorithm:
Journal Support for NS2 Projects:
Sample code for genetic algorithm in NS2
This is the code for main function of genetic algorithm.
set population {} for { set i 0 } { $i < $pop_size } { incr i } { set member {} for { set j 0 } { $j < $no_genes } { incr j } { lappend member [expr {int(2147483000.0*rand())}] } lappend population $member } set child_pop $population } # # Determine the fitness per member # set high_fit -1 set tot_fit 0.0 set pop_fit {} foreach member $population { set fit [eval $fitness $member] if { $high_fit < $fit } { set high_fit $fit set best_guess $member } lappend pop_fit $fit set tot_fit [expr {$tot_fit+$fit}] }