nicolae_velciov
asked on
Queens and Knights Problem Using Simulated Annealing
Hello all.
I have to provide a solution to the following problem using simulated annealing:
I must place an equal number of knights and queens on a chessboard such that no piece attacks any other piece. And I need to determine the maximum number of pieces I can place on the board + how many different ways I can do it (printing the board for each discovered solution).
My experience in this field of heuristics is relatively reduced and any help you can provide regarding the data structures required to store the solution plus a way of actually solving the problem would be very much welcome.
Many thanks.
I have to provide a solution to the following problem using simulated annealing:
I must place an equal number of knights and queens on a chessboard such that no piece attacks any other piece. And I need to determine the maximum number of pieces I can place on the board + how many different ways I can do it (printing the board for each discovered solution).
My experience in this field of heuristics is relatively reduced and any help you can provide regarding the data structures required to store the solution plus a way of actually solving the problem would be very much welcome.
Many thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
simulated annealing uses a heuristic representing a cost that it seeks to minimize.
in this problem, the cost might be the number of attacks and the number of queens and knights short of the maximum.
in this problem, the cost might be the number of attacks and the number of queens and knights short of the maximum.
ASKER
I see. Could you possibly add some code so as to exemplify? I have read here: http://www.vector.org.uk/archive/v213/hui213.htm
that on a 8 x 8 board a maximum of 5 queens and 5 knights can be placed. Could you please provide some code (preferably in C/C++) so as to solve this particular problem (of Q and K placement) for this particular board size using SA?
Thank you.
that on a 8 x 8 board a maximum of 5 queens and 5 knights can be placed. Could you please provide some code (preferably in C/C++) so as to solve this particular problem (of Q and K placement) for this particular board size using SA?
Thank you.
Can anybody provide code?
ASKER
If I need to ask this question separately (so that you may get the points for it) please tell me. I'm new and this problem is very urgent for me.
Thank you again.