Skip to content

Latest commit

 

History

History
78 lines (61 loc) · 1.39 KB

README.md

File metadata and controls

78 lines (61 loc) · 1.39 KB

N-Queen-Problem

Write programs in C++ to solve the n-queen problem.

  1. Use Iterative Deepening Search (IDS)
  2. Use Hill Climbing (HC)
  3. Use Genetic Algorithm (GA)

report.pdf is my research report. Write in Mandarin.
N-Queen Problem Record.xlsx is research recording of 8-Queens、50 Queens solved with IDS、HC、GA algorithm.

IDS

compile .cpp

g++ IDS.cpp -o IDS.exe

Solve 8-Queens problem with IDS algorithm
Outputfile: IDS_8_Queens.txt

.\IDS.exe 8

Solve 50-Queens problem with IDS algorithm
Outputfile: IDS_50_Queens.txt

.\IDS.exe 50

HC

compile .cpp

g++ HC.cpp -o HC.exe

Solve 8-Queens problem with HC algorithm
Outputfile: HC_8_Queens.txt

.\HC.exe 8

Solve 50-Queens problem with HC algorithm
Outputfile: HC_50_Queens.txt

.\HC.exe 50

GA

compile .cpp

g++ GA.cpp -o GA.exe

Solve 8-Queens problem with GA algorithm
Outputfile: GA_8_Queens.txt

.\GA.exe 8

Solve 50-Queens problem with GA algorithm
Outputfile: GA_50_Queens.txt

.\GA.exe 50

30times.py

Execution

.\30times.py N   -> N  Queen

This aims to generate output automatically.

It will solve N-Queens problem with HC or GA algorithm and generate output 30 times.
( Or you can modify parameter of output times in 30times.py )
Outputs will be generate in Result.xlsx automatically.