
N Queens on an FPGA (2014) [pdf] - merrier
http://doc.utwente.nl/94663/1/NQueensOnFPGA.pdf
======
lpage
Obligatory link to the highly approachable and all around amazing
[http://nand2tetris.org](http://nand2tetris.org), which will get you to the
level of FPGA knowledge necessary to tackle projects like this.

------
kbob
I am thinking that N Queens would make a great hobby FPGA learning project.
Not the automatic math->HDL translation of the paper, but writing a solver
directly in VHDL that would blink the solutions on an LED matrix.

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.

------
utopcell
I weep for the wasted computing power that has gone to solving this problem,
considering it has a closed form solution.

~~~
taeric
When was a closed form found? Last I checked, there was none. (Quickly
googling shows that this is still the case.)

~~~
utopcell
Take a look at this 1969 paper:
[http://penguin.ewu.edu/~trolfe/QueenLasVegas/Hoffman.pdf](http://penguin.ewu.edu/~trolfe/QueenLasVegas/Hoffman.pdf)

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).

~~~
RGamma
The method described in what you linked will give you one solution (as in: one
valid placement), not enumerate all of them, which is what is done in the
submitted paper (although that information is needlessly buried for whatever
reason).

~~~
utopcell
That might have been a valid argument if it was coming from the authors of the
paper. My point was that computation power is better spent solving problems
that matter.

~~~
MichaelBurge
N queens is just an example for the technique, and it isn't much computation
anyways. My guess is your computer spends orders of magnitude more cycles
rounding the corners of rectangles or paging files in and out of disk than it
would computing solutions to N queens.

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.

~~~
utopcell
Indeed N-queens is used as a case study, my point is that this is a horrible
case study and by their admission, they don't even solve it better than the
state-of-the-art. A classic example for a high-level synthesis system would
have been to synthesize some component of a video/audio codec. This would have
clearly demonstrated value.

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.

~~~
taeric
I think we have different definitions of "politely stated."

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?")

~~~
utopcell
I may disagree with you on the value of N-queens as a case study in this
particular case, but your general statement is definitely fair: You never know
where inspiration may come from.

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.''

~~~
taeric
Funny, since my favorite solution to the N-Queens is from Knuth. [http://www-
cs-faculty.stanford.edu/~uno/papers/dancing-color...](http://www-cs-
faculty.stanford.edu/~uno/papers/dancing-color.ps.gz)

He has an update of this in his book on Fun and Games.

~~~
utopcell
dancing links are awesome.

