N Queens on an FPGA (2014) [pdf]
doc.utwente.nl
doc.utwente.nl
It seems to me, at my level of VHDL knowledge, hard enough to be interesting but easy enough to be achievable. It's better than making 7 segment LEDs count, which was my last project.
For a 2n x 2n grid, the queens can be placed on (k, 2k) and (2n+1-k, 2n+1-2k), k=1..n. For a (2n+1) x (2n+1) grid, an additional queen is placed on (2n+1, 2n+1).
Anyone making something to "solve" the N-Queens is typically doing the difficult task of finding all solutions. Not the easier task of finding a solution.
Also consider that FPGAs use much less power than CPUs:
* Opening Hacker News to make your comment uses up enough power to solve N Queens thousands of times over.
* Driving to the store uses enough energy in gas to solve N Queens probably trillions of times at least.
* That time you opened a Ruby or Python interpreter and ended up closing it without doing anything? More energy than N Queens.
* That time you opened psql to the company database and had a setting to automatically start a transaction? It delayed vacuuming a table just long enough that the time spent processing unpruned records could've calculated an N Queens solution.
* I think my Basys 2 FPGA draws 2 milliamps, while my air conditioner peaks at 40 amps. My gut is that current can be used to compute an awful lot of N Queens.
Honestly, just complaining about the problem is wasting more energy than the problem.
On top of that, there are papers referenced from this paper that talk about spending 53 years of computation on a grid to solve N=25. There is (was?) even a nqueens@home project. None of this folding proteins on your GPUs nonsense, we need to know how to place queens on a board!
N-queens is a nice combinatorics problem but it's just that: Enumerating all its solutions (with custom hardware no less) is as meaningless as, say, enumerating all cyclic decompositions of permutations.
PS: nobody's complaining Michael, an opinion was politely stated. Clearly the reviewers of the prestigious "Open Channel Publishing Ltd." thought that this paper had enough value to be published, and I suppose you have the same mindset as they do.
Regardless, finding ways of running any recursive backtracking problem in faster execution environments has merit. Getting their method in the eyes of others may lead to someone else making substantial progress. May, of course. Nothing is guaranteed.
And the "toy" problem of N-Queens is a good one specifically because it is pedagogical. This is why we let people interested play with toys in the first place. (After all, why not "weep for the minds that are given these toy puzzles?")
Many years back, my PhD advisor told me the following story: Back in the 70s, he had come up with some sort of solution to the N-queens problem and had sent a (snail) mail to Don Knuth describing it. Knuth responded back with a single sentence: ``I am fed up with the N-queens problem.''
He has an update of this in his book on Fun and Games.
(1,2) (2,4) (3,6) (4,8)
(8,7) (7,5) (6,3) (5,1)
where for example (2,4) and (5,1) are queens on the same diagonal.For n=4, I believe you'd need to use construction B, which is (k, 1+((2(k-1)+n-1) % 2n)) and (2n+1-k, 2n-((2(k-1)+n-1) % 2n)). Your resulting coordinates then become:
(1,4) (2,6) (3,8) (4,2)
(8,5) (7,3) (6,1) (5,7)
I think that should be a valid solution.