Genetic Algorithms Selection Presentation

Download Report

Transcript Genetic Algorithms Selection Presentation

Genetic Algorithms
Genetic Programming
Representation of Chromosome
Selection Procedure(pseudo code)
Roulette Wheel procedure
Java Genetic Algorithm library
Python Genetic Algorithm library
Vasanth Raja Chittampally
10IT05F
http://www.vasanthexperiments .wordpress.com
1
Representation of Chromosome

private static class Chromosome {
– public double score;
– StringBuffer chromo= new StringBuffer(chromoLen * 4);
– //
– public Chromosome(int target) {
 //
 chromo.append(binString);
//
}
}
Vasanth Raja Chittampally
www.vasanthexperiments .wordpress.com
2
Roulette Wheel selection procedure



A roulette wheel contains slots weighted in proportion to
string fitness values.
In the below code we see the select function returns the
index value corresponding to the selected individual.
Partial sum of the fitness values is accumulated in the real
variable partsum
– rand=rand*sumfitness
Sum of the population fitnesses is multiplied by the normalized
pseudorandom number.
Repeate-until searches through the weighted roulette wheel until the
partial sum is greater than or equal to the stopping point rand.
3
Pseudo code of Selection process

Function select(popsize, sumfitness, population) {
– Begin
 Partsum=0
j=0
 rand= rand*sumfitness
 Repeat
– j=j+1
– partsum=partsum+pop[j].fitness
Until(partsum>=rand) or (j=popsize)
– Return individual number
– Select=j
end
Vasanth Raja Chittampally
www.vasanthexperiments .wordpress.com
4
Java Selection Function

private Chomosone selectMember(ArrayList l) {
double tot=0.0;
for (int x=l.size()-1;x>=0;x--) {
double score = ((Chomosone)l.get(x)).score;
tot+=score;
}
double rand1 = tot*rand.nextDouble();
double ttot=0.0;
for (int x=l.size()-1;x>=0;x--) {
Chomosone node = (Chomosone)l.get(x);
ttot+=node.score;
if (ttot>=rand1) { l.remove(x); return node;
}
}
return (Chomosone)l.remove(l.size()-1); }
5
Java Genetic Algorithm Library





http://jgap.sourceforge.net/
It provides basic genetic mechanisms that can be easily
used to apply evolutionary principles to problem solutions
This contains the general purpose functions to be
performed for Genetic algorithms
Good documentation is available
Set of examples were given in the above link with source
code
6
Python Genetic Algorithms Library

http://pyevolve.sourceforge.net/
 Pyevolve was developed to be a complete genetic
algorithm framework written in pure python.
 Good documentation is available
 Set of examples were given in the above link with source
code

http://www.freenet.org.nz/python/pygene/
 Python based genetic algorithms library.
7
References

http://www.genetic-programming.org/
 http://pyevolve.sourceforge.net
 http://gafp.sourceforge.net/
 http://jgap.sourceforge.net/
 http://amitksaha.wordpress.com/2009/12/16/ga-basedsorting-bogosort-using-pyevolve/
 http://amitksaha.wordpress.com/2009/12/16/ga-basedsorting-bogosort-using-pyevolve/
 http://pyevolve.sourceforge.net/examples.html#example12-the-travelling-salesman-problem-tsp
 http://www.geneticprogramming.com/ga
8
Queries ???
Vasanth Raja Chittampally
10IT05F
www.vasanthexperiments .wordpress.com
9
Thank you
Vasanth Raja Chittampally
10IT05F
www.vasanthexperiments .wordpress.com
10