Code covered by the BSD License  

Highlights from
Genetic Algorithm for n-queen problem

4.5 | 4 ratings Rate this file 32 Downloads (last 30 days) File Size: 5.42 KB File ID: #35820
image thumbnail

Genetic Algorithm for n-queen problem


Swapnil Marathe


22 Mar 2012 (Updated )

N-queen generalized genetic algorithm. Parameters can be changed and tested

| Watch this File

File Information

EACH INDIVIDUAL:- [1*8] where each column value tells the position of queen in that particular column

FINAL SOLUTION:- each row gives one unique solution in the 'solution' matrix

It has very basic but effective functions of selection,crossover and mutation.
Queens are randomly positioned in the beginning.
I have written it for n-queens.
It gives a good amount of solutions for queens > 8.
Also you can change parameters and test for yourself.
The cross-over logic is given in the attached PDF-cross-over_logic.


Travelling Salesman Problem With Genetic Algorithm inspired this file.

Required Products MATLAB
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
27 Nov 2014 Stéfano Acosta

Stéfano Acosta

19 Oct 2014 nazish niaz

nazish niaz

13 Feb 2014 Hank



04 Nov 2012 Chaowarin


04 Nov 2012 Chaowarin



Comment only
13 Jun 2012 rafik



Comment only
23 Mar 2012 Swapnil Marathe

Swapnil Marathe

guys..this is my first attempt in genetic algorithm direction.....plz suggest me more problems and improvements in this one...

Comment only
24 Mar 2012

description of how the each individual has been defined

08 May 2012

Modified the file to calculate the fitness function for 'n' queens and not 8 queens

Contact us