genetic algorithm (DNA) (= GA)

1 Conversation

The name of the author of THE book (DNA) reminds me of a project I had to do for university, and because I found this project really unbelievable and interesting, I decided to write an entry about it: here it is:
I had to write a program in MODULA-2 (which is really a vogon-language; it's so primitive that even a Babel-fish wouldn't be any help to you) which would resolve the 8-queens-problem by genetic algorithm...

The problem: place 8 queens safely on a chess-board .
The way to the solution: Genetic Algorythm (GA)
For a GA-solution, you begin with a few (+/- 500) wrong solutions (the computer wil choose them on random) and then, it's very simple: The computer chooses 2 specimens from the 500 original 'persons' (who all have a genetic code) and
does like nature:

REPRODUCTION: the 2 'parents' give a part of their genetic code to the 'child': e.g.
The solution you're looking for is (e.g.) 123456
If the 'parents' have as code: 113524 (1st parent) and 126456 (2nd parent), then, the first parent has score = 2/6 and the second parent = 4/6 (2 or 4 right numbers on the right place). The child can (e.g.) have as genetic code 113456 (score = 5/6) which is better than the parents' genetic codes: thus, the 'parent' with the worst score will then die to make place for his 'child'
otherwise, if his score is under 2/6, he won't survive.

MUTATION: you simply take one of the parents and you change one of his numbers (a part of his genetic code)
( e.g.: 113425 -----> 123425 )

If someone's interested in the program, say so and I'll try to set it on this site.
If I were asked to give some comments about this way of solving problems, I surely would say that this is a typical Sirius Cybernatics program, because it does a job which otherwise can be done within 2 seconds in a quarter of an hour ( this is absolutely TRUE; I've tested it, as researcher for the guide). But it's a quite original way of resolving problems, so try it...
OK, I must also admit it's sometimes the only way out of a problem, but surely not in a 'normal' situation...

Bookmark on your Personal Space


Entry

A272693

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more