Jump to content

First of all, I'm from Argentina so english is not my fist language, so i want to apologise beforehand for any mistakes.

I'm a computer enthusiast and I love to program whatever comes to my mind, specially when it comes to benchmarking. Lately the "N Queens problem" has been in my mind since i read an article in the newspaper. The problem states that given N queens and an NxN chessboard, find a way to place the queens so that no two queens attack each other. As you can imagine its a pretty process intensive problem for big numbers of N (with an i7 950 @ 4.2ghz trying to find 1 solution for N = 40 took little more than 21 hours).
 

Im still working in the multithread. As it stands right now, the program does the same process in each thread, that is if you want to find 1 solution with 10 threads, all 10 threads will find the same solution.
 

The program also lets you chose if you want to separate the process in iterations, how much time you want to process each iteration and how much time you want to wait between each iteration. I programed this to simulate the normal use of a computer in order to break in an AS5 i bought (lol).


 

Inputs:

Quote

 

Select the type of test:

[a] for multithreaded benchmark || for single threaded benchmark || [Any key] for custom

Here you can select prebuilt test for benchmarking and comparing propuses or you can press any key to enter your own parameters.


 

N = Is the number of queens and the chessboard size
Solutions to find = Quantity of solutions to find. 0 = all the solutions.
Threads to use (max CPU concurrency is xxxxxxxx) = Quantity of threads to use. 0 = max CPU concurrency.
Iterations = Iteration quantity. 0 = infinite.
Time to process each iteration in seconds (aprox)= Each iteration processing time. This number is an aproximate because the program is not able to get 100% accuracy on process time. 0 = infinite (will finish when solution quantity is met).
Time between iterations in seconds = Time between each iteration.

 


 

Output per thread:

Quote

 

------------------------------------ Thread [number] ------------------------------------

N: Selected N

Time: Time that took to process in seconds

Queens positioned before finishing: Queens positioned before finishing

Queens positioned per second: Queens positioned per second

Solutions found: Solutions quantity found

Last solution: Last solution found before finishing

 


 

Output Summary:

Quote

 

--------------------------------------------------------------------------------------------

------------------------------------ Finished - Summary ------------------------------------

--------------------------------------------------------------------------------------------

Finished at xxxxxxxxxxxxxxxxxxxxxxxxx


 

N: Selected N

Sum of queens positioned: Sum of all positioned queens <- IMPORTANT FOR BENCHAMARKING

Sum of queens positioned per second: Sum of all positioned queens per second <- IMPORTANT FOR BENCHAMARKING

Sum of solutions found: Sum of all solutions found <- IMPORTANT FOR BENCHAMARKING


 


 

<press any key to exit>

 

 

 

I hope you enjoy this as much as i enjoy making it. I'll be updating the program, so I'll be posting the updates here.

 

 

nQueens.zip

Link to comment
https://linustechtips.com/topic/1074424-n-queens-program-for-benchmarking/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×