blob: b1e3519e4fd2e3c70544430a39f0ada684fd7797 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_292) on Tue Jun 15 06:00:57 GMT 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.apache.hadoop.examples.dancing (Apache Hadoop Main 3.3.1 API)</title>
<meta name="date" content="2021-06-15">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="org.apache.hadoop.examples.dancing (Apache Hadoop Main 3.3.1 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/hadoop/examples/package-summary.html">Prev&nbsp;Package</a></li>
<li><a href="../../../../../org/apache/hadoop/examples/pi/package-summary.html">Next&nbsp;Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/hadoop/examples/dancing/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;org.apache.hadoop.examples.dancing</h1>
<div class="docSummary">
<div class="block">This package is a distributed implementation of Knuth's <a
href="http://en.wikipedia.org/wiki/Dancing_Links">dancing links</a>
algorithm that can run under Hadoop.</div>
</div>
<p>See:&nbsp;<a href="#package.description">Description</a></p>
</div>
<div class="contentContainer"><a name="package.description">
<!-- -->
</a>
<h2 title="Package org.apache.hadoop.examples.dancing Description">Package org.apache.hadoop.examples.dancing Description</h2>
<div class="block">This package is a distributed implementation of Knuth's <a
href="http://en.wikipedia.org/wiki/Dancing_Links">dancing links</a>
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 <b>true</b> value
in each column.
<p>
The package includes two example applications: a <a
href="http://en.wikipedia.org/wiki/Pentomino">pentomino</a> solver and
a sudoku solver.
<p>
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.
<p>
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.
<p>
Both applications have been added to the examples jar, so they can be
run as:
<pre>
bin/hadoop jar hadoop-*-examples.jar pentomino pent-outdir
bin/hadoop jar hadoop-*-examples.jar sudoku puzzle.txt
</pre>
<p>
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.</div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/hadoop/examples/package-summary.html">Prev&nbsp;Package</a></li>
<li><a href="../../../../../org/apache/hadoop/examples/pi/package-summary.html">Next&nbsp;Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/hadoop/examples/dancing/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2021 <a href="https://www.apache.org">Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>