Coder Profile - Show off your skills, get a coder profile.
 
 
 
The Author
Cinjection
Oleksi Derkatch
Send A Message
Rating
10.00
out of 10
( 1 Ratings )
Please login to rate source codes.

Click here to register a free account with us.
General Details
Scheme
Posted 115 Days Ago
280 Views
Received 1 Rating
More Codes By This Author
MD5 Brute-Forcer
Number of ways to make ch...
SPS Desktop Changer
Simple program using GUI...
Genetic Algorithm for sol...
Articles By This Author
Intorduction to memoizati...
Strings in C++
Vectors in C++
Use Cases
[C++] Pointers and their...

Genetic Algorithm for solving the N-Queens problem


Description
Here's a my first working genetic algorithm. It was inspired by a great article by closure:
http://www.coderprofile.com/coding-article/109/n-queens-series-part-i-only-the-fittest-survive

The program returns a list of co-ordinates representing the positions of the queens. For example, ((3 . 2) (1 . 3) (0 . 1) (2 . 0)) is a solution for N=4.

If you want to play around with it, just change the parameters at the top of the program. The programs runs in acceptable time for a problem size of 4 and 5. After that it really slows down. I don't know if I coded this wrong, or if it's just the algorithms limitation. If you want to see some run statistics, just turn the STATS flag to #t. It will then show you the average fitness of the population (out of 100%) as well as when a mutation occurs.

The population limit is the constant amount of chromosomes in a population.

The cross-over-rate determines how many times a cross-over occurs per generation. The default of 2 means that 4 new chromosomes are during each cycle.

The mutation rate is the chance that a chromosome will be mutated. Setting this to 100 will mean that every chromosome gets mutated at every generation. Avoid that high of a value. I've found that values under 5 are best.

If you guys have coded a GA before, could you look this over to make sure I did it right. This is my first attempt at something like this, so I'm not confident that I did it correctly.
Source Code
Comments
Please login to post comments.
Page 1 of 1
More "Scheme" Source Codes By This Author
Recently Posted "Scheme" Source Codes
Recently Rated "Scheme" Source Codes
 
 
Latest News About Coder Profile
Coder Profile Poll
What is the next application you would like to be added to your profiles?

Books
Coding Challenges
Project Management
Blog
Tutorials


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
5 Days Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved