##
Package org.apache.hadoop.examples.dancing

This package is a distributed implementation of Knuth's dancing links
algorithm that can run under Hadoop.
**See:**

**Description**

##
Package org.apache.hadoop.examples.dancing Description

This package is a distributed implementation of Knuth's dancing links
algorithm that can run under Hadoop. It is a generic model for
problems, such as tile placement, where all of the valid choices can
be represented as a large sparse boolean array where the goal is to
pick a subset of the rows to end up with exactly 1 **true** value
in each column.

The package includes two example applications: a pentomino solver and
a sudoku solver.

The pentomino includes both a "normal" pentomino set and a one-sided
set where the tiles that are different when flipped are
duplicated. The pentomino solver has a Hadoop driver application to
launch it on a cluster. In Knuth's paper on dancing links, he
describes trying and failing to solve the one-sided pentomino in a
9x10 board. With the advances of computers and a cluster, it takes a
small (12 node) hadoop cluster 9 hours to find all of the solutions
that Knuth estimated would have taken him months.

The sudoku solver is so fast, I didn't bother making a distributed
version. (All of the puzzles that I've tried, including a 42x42 have
taken around a second to solve.) On the command line, give the solver
a list of puzzle files to solve. Puzzle files have a line per a row
and columns separated by spaces. The squares either have numbers or
'?' to mean unknown.

Both applications have been added to the examples jar, so they can be
run as:

bin/hadoop jar hadoop-*-examples.jar pentomino pent-outdir
bin/hadoop jar hadoop-*-examples.jar sudoku puzzle.txt

I (Owen) implemented the original version of the distributed pentomino
solver for a Yahoo Hack day, where Yahoos get to work on a project of
their own choosing for a day to make something cool. The following
afternoon, everyone gets to show off their hacks and gets a free
t-shirt. I had a lot of fun doing it.

Copyright © 2014 Apache Software Foundation. All Rights Reserved.