Skip to content

mirzaeiyan/nqueens-genetic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nqueens-genetic

A simple pure python code which solves nqueens problem using GA. Just change problem parameters, then see what will happen in result.

Usage

Simply use command below:

run.py -d <dimension> -p <population_count> -m <mutation_factor> -i <iteration>

Result:

Generation=> 1 Maximum Fitness=> 23
Generation=> 2 Maximum Fitness=> 24
Generation=> 3 Maximum Fitness=> 24
Generation=> 4 Maximum Fitness=> 25
Generation=> 5 Maximum Fitness=> 25
Generation=> 6 Maximum Fitness=> 25
Generation=> 7 Maximum Fitness=> 24
Generation=> 8 Maximum Fitness=> 23
Generation=> 9 Maximum Fitness=> 25
Generation=> 10 Maximum Fitness=> 25
Generation=> 11 Maximum Fitness=> 25
Generation=> 12 Maximum Fitness=> 26
Generation=> 13 Maximum Fitness=> 26
Generation=> 14 Maximum Fitness=> 27
Generation=> 15 Maximum Fitness=> 26
Generation=> 16 Maximum Fitness=> 27
Generation=> 17 Maximum Fitness=> 28
([2, 4, 6, 0, 3, 1, 7, 5], 'Fitness=>', 28)

Feel free to contribute to this code or add new features.

About

Solving the nqueens problem using genetic algorithm

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages