Jump to content
• Advertisement

# How a Genetic Algorithm works

This topic is 3895 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

There seems to be a bit of interest on this forum regarding Genetic AI Algorithms so I thought I would give a very simplistic explanation of how a genetic algorithm works accoring to gene theory. You give a robot (or a program - same thing) certain characteristics or traits. eg goToLight(); goAwayFromLight(); goLeft(); goRight(); ..... etc, etc You can then use a variable to define a percentage of ocurrences when they will exhibit that behaviour. Then (the genetic part) you give that "trait" a dominant or recessive flag. You then combine robots, breed them, get them to teach each other, whatever method for "mixing" the traits. You get dominant X Dominant crosses, recessive X recessive crosses and dominant X recessive crosses for each trait. In theory the most "dominant" combinations always rise to the top and eventually keep crossing (some algorithms have less successful crosses "die off" or the whole population eventually inherits the most dominant traits. You experiment by constantly changing the percentages variables to change the overall behaviour of the simulation. You can define percentage changes according to some target variable (ie robot went to correct target) so that percentage changes can be part of the overall algorithm and not require external intervention. You can introduce random seeding. It all depends entirely on how many traits you combine and what you choose to be recessive or dominant. Some algorithms can change the dominance according to a pre-determined trigger. As you can quickly see there is nothing truly random at all. Everything is set up by the behaviour modifiers that are introduced into the algorithm. You can also "cross-link" genes so that a certain match of two traits then triggers a change in the normal match of another pair. Actual implementation can be far more complex but that is the basic theory. m0ng00se

#### Share this post

##### Share on other sites
Advertisement
The above is NOT a description of a genetic algorithm in the usual sense of the term and I would advise anyone trying to learn about them to ignore the above.

m0ng00se, please don't attempt to confuse those readers not yet familiar with GAs by posting such blatantly erroneous information. What you describe would very loosely fall into the category of evolutionary programming techniques, but even then you're providing a very watered down description of your own interpretation and no explaining the principles of EP.

#### Share this post

##### Share on other sites
suit yourself.
It is NOT an exact science as you seem to be insinuating and there is NO specific "theory" as you again insinuate. It is an open slather field of research with many people writing papers and declaring that their methodology is the correct one.

A cynical programmer would say it is nothing more than a way for the academics to attract research grants.

I am entitled to my "interpretation" just like any other researcher or interested person and who are you to say that it is wrong?

I see the Flat Earth society is still alive and kicking. Contrary to what you say I would encourage everybody to do their own research and do not be blinded by those saying that their way is the "only" way or the right way or that anybody else's interpretation is wrong. The more variance in the field of AI the better.

Look mate you just go ahead and ban me or delete my messages or whatever gets you off. There's always somebody wants to put other people down and imply they know more than anybody else. Science is full of the knockers who kept telling everybody the world really is flat. So whatever... like I actually care?

You have a nice day.

m0ng00se

#### Share this post

##### Share on other sites
Quote:
 So whatever... like I actually care?

You should avoid phrases like that. It sounds like something a kid would say. I doubt Timkin was out to attack you as you seem to feel, but it was in the interest of others to wave a caution flag. Someone recently posted a link to an article about why most folks shouldn't write tutorials and I think it applies here. Helping people feels good, but that feeling can be like a drug which people who shouldn't be helping often abuse. People who simply can't provide the kind of clarity and depth that is required to be an effective teacher. Your post is an example of that. It doesn't mean you're dumb about the subject yourself. Find other ways to feel good.

There's no need for you to dismiss "academics" either. This makes you sound bitter. If I attempt to read something about an AI topic and it's full of math I don't understand, I simply accept that I am lacking in that area. I don't scowl and mutter "Pfft. Damn academics. All these funky equations are just a lot of BS to get research grants."

See also:
Neats vs. Scruffies (you would be a scruffy)

[Edited by - Hollower on February 17, 2008 2:59:19 AM]

#### Share this post

##### Share on other sites
M0ng00se, the problem is that when you say 'Genetic Algorithm' this term already has a defined meaning, which you are misrepresenting. It's all well and good to claim relativism, but if I call a turkey club sandwich a 'pizza' then walk into a pizza store, ask for a pizza and then get in a big huff about elitist chefs using fancy names to draw customers when I'm give an actual pizza instead of a turkey club, the process of choosing you own definitions isn't useful, especially to newcomers who may not understand the differences.

When someone says 'Genetic Algorithm' they mostly refer to the process of representing a possible solution as a sequence of genes (e.g. weights in a neural net or sequences of moves) then using whatever the problem requires to test those solutions to determine a fitness for each, mixing the genes of those with high fitnesses with others to create the next generation, dumping the low performers, and repeating the process for however many generations it takes to reach a satisfactory level of fitness.

Of course there are multitude variations on this, but that's the 'stereotypical' if you will type of GA, and is what most people refer to when they say 'Genetic Algorithm'.

Hope I helped.

#### Share this post

##### Share on other sites
A better description of GAs.

Quote:
 Original post by m0ng00seSo whatever... like I actually care?

If you're going to write things like this, you damn well should.

#### Share this post

##### Share on other sites
m0ng00se:

Quote:
 I am entitled to my "interpretation" just like any other researcher or interested person and who are you to say that it is wrong?

Yes, you are entitled to your interpretation, even if it is wrong. However, you should NOT be posting your interpretation without first verifying that it is correct, lest you spread erroneous information and lead uninformed minds astray.

Who am I to say your interpretation is wrong? Someone with nearly twenty years of research and application experience in this area.

Quote:
 It is NOT an exact science as you seem to be insinuating and there is NO specific "theory" as you again insinuate.

I insinuate nothing. I openly and clearly state that there IS an exact science behind 'genetic algorithms' and well proven theories to explain their operation... and in saying that there is no scientific basis for GAs you confirm that you know little of this topic beyond, perhaps, the few EP application papers you have read (which again are NOT GAs). Perhaps you'd best go and read some of the early developmental material on GAs, particularly that of John Holland.

Quote:
 Contrary to what you say I would encourage everybody to do their own research...

Mmm, that's funny. That's what I said.

If anyone reading this thread particularly wants to learn more about GAs I'm happy to provide citations for peer-review articles and books on the topic.

Quote:
 Look mate you just go ahead and ban me or delete my messages or whatever gets you off.

I have no intention of banning or suspending your account or deleting or modifying your posts... unless you blatantly break the forum rules. I would advise you though to think before you write, lest you say something that will get your account suspended or banned.

Regards,

Timkin

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5
• Advertisement

• 11
• 18
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632929
• Total Posts
3009282
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!