## Simple genetic algorithm code examples

Expand Messages
• Hi Friends, Do you have any genetic algorithm code examples that have been implemented any problem.I found a few examples. But these were not clear to
Message 1 of 4 , Sep 1, 2007
Hi Friends,
Do you have any genetic algorithm code examples that have been implemented any problem.I found a few examples. But these were not clear to understand usage of genetic algorithm in programming language. Theoritically, I understood every cycle in genetic algorithm.But ,it is still not clear in my mind how GA can be converted into code in programming language.I want to apply GA to course scheduling problem.
Best regards
Cansu Cigdem Aydin

---------------------------------
Boardwalk for \$500? In 2007? Ha!
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

[Non-text portions of this message have been removed]
• Start by trying to implement something really simple, and do it in an OO way. For example in one of Dawkins s books he introduces the Methinks it is like a
Message 2 of 4 , Sep 1, 2007
Start by trying to implement something really simple, and do it in an OO
way.

For example in one of Dawkins's books he introduces the "Methinks it is
like a weasel" problem.

Create a class Genome to represent a candidate solution - in this case a
string of letters. You can define an alphabet of letters and only use
characters from that alphabet.

e.g.

alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ ";

Add methods that mutate the Genome (swap some letters for others),
calculate the fitness (number of letters that agree with target
phrase)and which does crossover on two genomes (try single point, two
point and uniform crossover).

With these methods you can wrap a GA around your Genome. You'll just
need to add a selection method - one of the simplest being a 2-way
tournament (choose 2 random individuals uniformly from the population
and select the fittest one).

Once you have this simple problem working, all you need to do is to
modify the Genome class to make it specific to your problem. The GA
stuff will be the same regardless.

Cansu Çiðdem Aydýn wrote:
>
>
>
> Hi Friends,
> Do you have any genetic algorithm code examples that have been
> implemented any problem.I found a few examples. But these were not clear
> to understand usage of genetic algorithm in programming language.
> Theoritically, I understood every cycle in genetic algorithm.But ,it is
> still not clear in my mind how GA can be converted into code in
> programming language.I want to apply GA to course scheduling problem.
> Best regards
> Cansu Cigdem Aydin
>
> ---------------------------------
> Boardwalk for \$500? In 2007? Ha!
> Play Monopoly Here and Now (it's updated for today's economy) at Yahoo!
> Games.
>
> [Non-text portions of this message have been removed]
>
>
• Eger delphi tabanlý bir kod istersen ben sana gonderebilirim cansu? Fakat exe haldemi yoksa dpr(pas) haldemi istiyorsun??? Ozgur AKSU ...
Message 3 of 4 , Sep 3, 2007
Eger delphi tabanlý bir kod istersen ben sana
gonderebilirim cansu?

Fakat exe haldemi yoksa dpr(pas) haldemi istiyorsun???

Ozgur AKSU

--- Cansu Çiðdem Aydýn <cansu82@...> wrote:

>
> Hi Friends,
> Do you have any genetic algorithm code examples
> that have been implemented any problem.I found a few
> examples. But these were not clear to understand
> usage of genetic algorithm in programming language.
> Theoritically, I understood every cycle in genetic
> algorithm.But ,it is still not clear in my mind how
> GA can be converted into code in programming
> language.I want to apply GA to course scheduling
> problem.
> Best regards
> Cansu Cigdem Aydin
>
>
> ---------------------------------
> Boardwalk for \$500? In 2007? Ha!
> Play Monopoly Here and Now (it's updated for today's
> economy) at Yahoo! Games.
>
> [Non-text portions of this message have been
> removed]
>
>

____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/
Your message has been successfully submitted and would be delivered to recipients shortly.