File Exchange

image thumbnail

Genetic Algorithm for n-queen problem

version 1.3 (5.42 KB) by

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

3 Downloads

Updated

View License

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.

Comments and Ratings (9)

Reza Rad

ahmed khaled

nazish niaz

Hank

Hank (view profile)

good

Chaowarin

Chaowarin

Thx

rafik

rafik (view profile)

thanks

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

Updates

1.3

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

1.1

description of how the each individual has been defined

MATLAB Release
MATLAB 7.8 (R2009a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video