[jboss-svn-commits] JBL Code SVN: r16609 - in labs/jbossrules/trunk/documentation/manual/en: Chapter-Solver and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 14 16:04:55 EST 2007


Author: ge0ffrey
Date: 2007-11-14 16:04:55 -0500 (Wed, 14 Nov 2007)
New Revision: 16609

Added:
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotExamination.png
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotLessonSchedule.png
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotNQueens.png
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotTravelingTournament.png
Removed:
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotSolvedNQueens8.png
Modified:
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Local_Search_Solver.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_configuration.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_introduction.xml
   labs/jbossrules/trunk/documentation/manual/en/master.xml
Log:
examples section

Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Local_Search_Solver.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Local_Search_Solver.xml	2007-11-14 20:47:50 UTC (rev 16608)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Local_Search_Solver.xml	2007-11-14 21:04:55 UTC (rev 16609)
@@ -716,6 +716,12 @@
       <programlisting>    &lt;finish&gt;
         &lt;maximumHouresSpend&gt;1&lt;/maximumHouresSpend&gt;
     &lt;/finish&gt;</programlisting>
+
+      <para>Notice that if you use this finish, you will most likely sacrifice
+      reproducability. The best solution will depend on real-time process
+      speed, not only because it influences the amount of steps taken, but
+      also because time gradient based algoritms (such as simulated annealing)
+      will probably act differently on each run.</para>
     </section>
 
     <section>

Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_configuration.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_configuration.xml	2007-11-14 20:47:50 UTC (rev 16608)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_configuration.xml	2007-11-14 21:04:55 UTC (rev 16609)
@@ -3,6 +3,158 @@
   <title>Solver configuration</title>
 
   <section>
+    <title>Types of solvers</title>
+
+    <para>Different solvers solve problems in different ways. Each type has
+    advantages and disadvantages. We 'll roughly discuss a few of the solver
+    types here. You can safely skip this section.</para>
+
+    <section>
+      <title>Brute force</title>
+
+      <para>Brute force creates and evaluates every possible solution, usually
+      by creating a search tree.</para>
+
+      <para>Advantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It finds an optimal solution. If there is more then 1 optimal
+          solution, it finds all optimal solutions.</para>
+        </listitem>
+
+        <listitem>
+          <para>It is straightforward and simple to implement.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Disadvantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It has a horrible performance and scalability. Mostly unusable
+          for a real-world problem due to time constraints.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Brute force is currently not implemented in drools-solver. But we
+      have plans to implement it in the future, as a reference for validating
+      the output of the other solver types.</para>
+    </section>
+
+    <section>
+      <title>Branch and bound</title>
+
+      <para>Branch and bound is an improvement over brute force, as it prunes
+      away subsets of solutions which cannot have a better solution than the
+      best solution already found at that point.</para>
+
+      <para>Advantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It finds an optimal solution. If there is more then 1 optimal
+          solution, it can find all optimal solutions if needed.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Disadvantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It still scales very badly.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Branch and bound is currently not implemented in
+      drools-solver.</para>
+    </section>
+
+    <section>
+      <title>Simplex</title>
+
+      <para>Simplex turns all constraints into a big equation, which it
+      transmutes into a mathematical function without local optima. It then
+      finds an optimal solution to the planning problem by finding an optima
+      of that mathematical function.</para>
+
+      <para>Advantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It finds an optimal solution.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Disadvantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It's usually rather complex and mathematical to implement
+          constraints.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Drools-solver does not currently implement simplex.</para>
+    </section>
+
+    <section>
+      <title>Local search (tabu search, simulated annealing, ...)</title>
+
+      <para>Local search starts from an initial solution and evolves that
+      single solution into a better and better solution. It uses a single
+      search path of solutions. At each solution in this path it evaluates a
+      number of possible moves on the solution and applies the most suitable
+      move to take the step to the next solution.</para>
+
+      <para>Local search works a lot like a human planner: it uses a single
+      search path and moves facts around to find a good feasible
+      solution.</para>
+
+      <para>A simple local search can easily get stuck in a local optima, but
+      improvements (such as tabu search and simulated annealing) address this
+      problem.</para>
+
+      <para>Advantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It's relatively simple and natural to implement constraints
+          (at least in drools-solver's implementation).</para>
+        </listitem>
+
+        <listitem>
+          <para>It's very scalable, even when adding extra constraints (at
+          least in drools-solver's implementation).</para>
+        </listitem>
+
+        <listitem>
+          <para>It generally needs to worry about less negative hard
+          constraints, because the move pattern can fulfill a number of the
+          negative hard constraints.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Disadvantages:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>It does not know when it has found an optimal solution.</para>
+        </listitem>
+
+        <listitem>
+          <para>If the optimal score is unknown (which is usually the case),
+          it must be told when to stop looking (for example based on time
+          spend, user input, ...).</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Drools-solver implements local search, including tabu search and
+      simulated annealing.</para>
+    </section>
+  </section>
+
+  <section>
     <title>The Solver interface</title>
 
     <para>Every build-in solver implemented in drools-solver implements the

Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml	                        (rev 0)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml	2007-11-14 21:04:55 UTC (rev 16609)
@@ -0,0 +1,403 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+  <title>Solver examples</title>
+
+  <section>
+    <title>Introduction</title>
+
+    <para>Drools-solver has several examples. In this manual we explain
+    drools-solver mainly using the n queens example. So it's advisable to read
+    at least the section about that example.</para>
+  </section>
+
+  <section>
+    <title>The n queens example</title>
+
+    <section>
+      <title>Running the example</title>
+
+      <para>In the directory
+      <literal>/drools-solver/drools-solver-examples/</literal> run the
+      following command:</para>
+
+      <programlisting>$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.nqueens.app.NQueensApp"
+...</programlisting>
+    </section>
+
+    <section>
+      <title>Screenshot</title>
+
+      <para>Here is a screenshot of the example:</para>
+
+      <figure>
+        <title>Screenshot of the n queens example</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="screenshotNQueens.png" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+    </section>
+
+    <section>
+      <title>Problem statement</title>
+
+      <para>The <emphasis>n queens puzzle</emphasis> is a puzzle with the
+      follow constraints:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>Use a chessboard of n rows and n columns.</para>
+        </listitem>
+
+        <listitem>
+          <para>Place n queens on the chessboard.</para>
+        </listitem>
+
+        <listitem>
+          <para>No 2 queens can attack each other. Note that a queen can
+          attack any other queen on the same horizontal, vertical or diagonal
+          line.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>The most common n queens puzzle is the 8 queens puzzle, with
+      <emphasis>n = 8</emphasis>. We 'll explain drools-solver using the 4
+      queens puzzle as the primary example.</para>
+
+      <para>A proposed solution could be:</para>
+
+      <figure>
+        <title>A wrong solution for the 4 queens puzzle</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata align="center"
+                       fileref="partiallySolvedNQueens04Explained.svg"
+                       format="SVG" />
+          </imageobject>
+
+          <imageobject>
+            <imagedata align="center"
+                       fileref="partiallySolvedNQueens04Explained.png"
+                       format="PNG" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+
+      <para>The above solution is wrong because queens A1 and B0 can attack
+      each other (as can queens B0 and D0). Removing queen B0 would respect
+      the "no 2 queens can attack each other" constraint, but would break the
+      "place n queens" constraint.</para>
+    </section>
+
+    <section>
+      <title>Solution(s)</title>
+
+      <para>Below is a correct solution:</para>
+
+      <figure>
+        <title>A correct solution for the 4 queens puzzle</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata align="center" fileref="solvedNQueens04.svg"
+                       format="SVG" />
+          </imageobject>
+
+          <imageobject>
+            <imagedata align="center" fileref="solvedNQueens04.png"
+                       format="PNG" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+
+      <para>All the constraints have been met, so the solution is correct.
+      Note that most n queens puzzles have multiple correct solutions. We 'll
+      focus on finding a single correct solution for a given n, not on finding
+      the number of possible correct solutions for a given n.</para>
+    </section>
+
+    <section>
+      <title>Class diagram</title>
+
+      <para>Use a good domain model and it will be easier to understand and
+      solve your problem with drools-solver. We 'll use this domain model for
+      the n queens example:</para>
+
+      <figure>
+        <title>NQueens domain diagram</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata align="center" fileref="nQueensDomainDiagram.png"
+                       format="PNG" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+
+      <para>A <literal>Queen</literal> instance has an x (its column, for
+      example: 0 is column A, 1 is column B, ...) and a y (its row, for
+      example: 0 is row 0, 1 is row 1, ...). Based on the x and y, the
+      ascending diagonal line as well as the descending diagonal line can be
+      calculated. The x and y indexes start from the upper left corner of the
+      chessboard.</para>
+
+      <table>
+        <title>A solution for the 4 queens puzzle shown in the domain
+        model</title>
+
+        <tgroup cols="6">
+          <thead>
+            <row>
+              <entry align="center">A solution</entry>
+
+              <entry align="center">Queen</entry>
+
+              <entry>x</entry>
+
+              <entry>y</entry>
+
+              <entry>ascendingD (x + y)</entry>
+
+              <entry>descendingD (x - y)</entry>
+            </row>
+          </thead>
+
+          <tbody>
+            <row>
+              <entry morerows="3"><mediaobject>
+                  <imageobject>
+                    <imagedata fileref="partiallySolvedNQueens04Explained.png"
+                               format="PNG" />
+                  </imageobject>
+                </mediaobject></entry>
+
+              <entry>A1</entry>
+
+              <entry>0</entry>
+
+              <entry>1</entry>
+
+              <entry>1 (**)</entry>
+
+              <entry>-1</entry>
+            </row>
+
+            <row>
+              <entry>B0</entry>
+
+              <entry>1</entry>
+
+              <entry>0 (*)</entry>
+
+              <entry>1 (**)</entry>
+
+              <entry>1</entry>
+            </row>
+
+            <row>
+              <entry>C2</entry>
+
+              <entry>2</entry>
+
+              <entry>2</entry>
+
+              <entry>4</entry>
+
+              <entry>0</entry>
+            </row>
+
+            <row>
+              <entry>D0</entry>
+
+              <entry>3</entry>
+
+              <entry>0 (*)</entry>
+
+              <entry>3</entry>
+
+              <entry>3</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+
+      <para>A single <literal>NQueens</literal> instance contains a list of
+      all <literal>Queen</literal> instances. It is the
+      <literal>Solution</literal> implementation which will be supplied to and
+      retrieved from drools-solver. Notice that in the 4 queens example,
+      NQueens's <literal>getN()</literal> method will always return 4.</para>
+
+      <para>You can find the source code of this example (as well as well as
+      several other examples) in the drools-solver-examples src
+      distribution.</para>
+    </section>
+  </section>
+
+  <section>
+    <title>The lesson schedule example</title>
+
+    <section>
+      <title>Running the example</title>
+
+      <para>In the directory
+      <literal>/drools-solver/drools-solver-examples/</literal> run the
+      following command:</para>
+
+      <programlisting>$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.lessonschedule.app.LessonScheduleApp"
+...</programlisting>
+    </section>
+
+    <section>
+      <title>Screenshot</title>
+
+      <para>Here is a screenshot of the example:</para>
+
+      <figure>
+        <title>Screenshot of the lesson schedule example</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="screenshotLessonSchedule.png" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+    </section>
+
+    <section>
+      <title>Problem statement</title>
+
+      <para>Schedule lessons with the follow constraints:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>No teacher with 2 lessons in the same timeslot</para>
+        </listitem>
+
+        <listitem>
+          <para>No group with 2 lessons in the same timeslot</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+  </section>
+
+  <section>
+    <title>The traveling tournament example</title>
+
+    <section>
+      <title>Running the example</title>
+
+      <para>In the directory
+      <literal>/drools-solver/drools-solver-examples/</literal> run one of the
+      the following commands:</para>
+
+      <programlisting>$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.travelingtournament.app.simple.SimpleTravelingTournamentApp"
+...
+$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.travelingtournament.app.smart.SmartTravelingTournamentApp"
+...</programlisting>
+
+      <para>The smart implementation performs and scales a lot better than the
+      simple implementation.</para>
+    </section>
+
+    <section>
+      <title>Screenshot</title>
+
+      <para>Here is a screenshot of the example:</para>
+
+      <figure>
+        <title>Screenshot of the traveling tournament example</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="screenshotTravelingTournament.png" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+    </section>
+
+    <section>
+      <title>Problem statement</title>
+
+      <para>Schedule matches between teams with the following hard
+      constraints:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>Each team plays twice against every other team: once home and
+          once away</para>
+        </listitem>
+
+        <listitem>
+          <para>Each team has exactly 1 match on each playing day</para>
+        </listitem>
+
+        <listitem>
+          <para>No more than 3 consecutive home or 3 consecutive away matches
+          for any team</para>
+        </listitem>
+
+        <listitem>
+          <para>No repeaters: 2 consecutive matches of the same 2 teams (so
+          each team plays once home and once away</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>and the following soft constraints:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>Minimize the total distance traveled of all teams.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para><ulink url="http://mat.gsia.cmu.edu/TOURN/">You can find a
+      detailed description as well as several records of this problem
+      here.</ulink></para>
+    </section>
+  </section>
+
+  <section>
+    <title>The ITC2007 examination example</title>
+
+    <section>
+      <title>Running the example</title>
+
+      <para>In the directory
+      <literal>/drools-solver/drools-solver-examples/</literal> run the
+      following command:</para>
+
+      <programlisting>$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.itc2007.examination.app.ExaminationApp"
+...</programlisting>
+    </section>
+
+    <section>
+      <title>Screenshot</title>
+
+      <para>Here is a screenshot of the example:</para>
+
+      <figure>
+        <title>Screenshot of the examination example</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="screenshotExamination.png" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+    </section>
+
+    <section>
+      <title>Problem statement</title>
+
+      <para>Schedule exams with the a large number of hard and soft
+      constraints. It uses real-life data of a large university.</para>
+
+      <para><ulink
+      url="http://www.cs.qub.ac.uk/itc2007/examtrack/exam_track_index.htm">You
+      can find a detailed description of this problem here.</ulink></para>
+    </section>
+  </section>
+</section>
\ No newline at end of file

Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_introduction.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_introduction.xml	2007-11-14 20:47:50 UTC (rev 16608)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_introduction.xml	2007-11-14 21:04:55 UTC (rev 16609)
@@ -119,7 +119,7 @@
   </section>
 
   <section>
-    <title>Getting started with the examples</title>
+    <title>Building drools-solver and running an example</title>
 
     <para>No releases have been made yet, but you can easily build it from
     source yourself. Check out drools from subversion and do a maven 2 build
@@ -131,24 +131,15 @@
 $ mvn -Psolver -Dmaven.test.skip clean install
 ...</programlisting>
 
-    <para>Now you will If you want to use a stable version of drools, add this
-    /drools-solver/pom.xml </para>
+    <para>After that, you can run any example directly from the command line,
+    for example to run the n queens example, run:</para>
 
-    <para>After that, you can run any example directly from the command line
-    like this:</para>
-
     <programlisting>$ cd drools-solver/drools-solver-examples/
 $ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.nqueens.app.NQueensApp"
-...
-$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.lessonschedule.app.LessonScheduleApp"
-...
-$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.travelingtournament.app.simple.SimpleTravelingTournamentApp"
-...
-$ mvn exec:exec -Dexec.mainClass="org.drools.solver.examples.travelingtournament.app.smart.SmartTravelingTournamentApp"
 ...</programlisting>
 
-    <para>You will use the latest, unstable revision of drools. If you would
-    rather use a stable version of drools, edit
+    <para>You will use drools-solver with the latest, unstable revision of
+    drools. If you would rather use a stable version of drools, edit
     <literal>/drools-solver/drools-solver-examples/pom.xml</literal> and
     overwrite the drools jar versions, before runing the example:</para>
 
@@ -167,365 +158,5 @@
         ...
 
      &lt;/dependencies&gt;</programlisting>
-
-    <para>Here's a screenshot of the n queens example, which is a simple
-    example:</para>
-
-    <mediaobject>
-      <imageobject>
-        <imagedata fileref="screenshotSolvedNQueens8.png" format="PNG" />
-      </imageobject>
-    </mediaobject>
   </section>
-
-  <section>
-    <title>The 4 queens example</title>
-
-    <section>
-      <title>Problem statement</title>
-
-      <para>The <emphasis>n queens puzzle</emphasis> is a puzzle with the
-      follow constraints:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>Use a chessboard of n rows and n columns.</para>
-        </listitem>
-
-        <listitem>
-          <para>Place n queens on the chessboard.</para>
-        </listitem>
-
-        <listitem>
-          <para>No 2 queens can attack each other. Note that a queen can
-          attack any other queen on the same horizontal, vertical or diagonal
-          line.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>The most common n queens puzzle is the 8 queens puzzle, with
-      <emphasis>n = 8</emphasis>. We 'll explain drools-solver using the 4
-      queens puzzle as the primary example.</para>
-
-      <para>A proposed solution could be:</para>
-
-      <figure>
-        <title>A wrong solution for the 4 queens puzzle</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata align="center"
-                       fileref="partiallySolvedNQueens04Explained.svg"
-                       format="SVG" />
-          </imageobject>
-
-          <imageobject>
-            <imagedata align="center"
-                       fileref="partiallySolvedNQueens04Explained.png"
-                       format="PNG" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-
-      <para>The above solution is wrong because queens A1 and B0 can attack
-      each other (as can queens B0 and D0). Removing queen B0 would respect
-      the "no 2 queens can attack each other" constraint, but would break the
-      "place n queens" constraint.</para>
-    </section>
-
-    <section>
-      <title>Solution(s)</title>
-
-      <para>Below is a correct solution:</para>
-
-      <figure>
-        <title>A correct solution for the 4 queens puzzle</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata align="center" fileref="solvedNQueens04.svg"
-                       format="SVG" />
-          </imageobject>
-
-          <imageobject>
-            <imagedata align="center" fileref="solvedNQueens04.png"
-                       format="PNG" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-
-      <para>All the constraints have been met, so the solution is correct.
-      Note that most n queens puzzles have multiple correct solutions. We 'll
-      focus on finding a single correct solution for a given n, not on finding
-      the number of possible correct solutions for a given n.</para>
-    </section>
-
-    <section>
-      <title>Class diagram</title>
-
-      <para>Use a good domain model and it will be easier to understand and
-      solve your problem with drools-solver. We 'll use this domain model for
-      the n queens example:</para>
-
-      <figure>
-        <title>NQueens domain diagram</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata align="center" fileref="nQueensDomainDiagram.png"
-                       format="PNG" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-
-      <para>A <literal>Queen</literal> instance has an x (its column, for
-      example: 0 is column A, 1 is column B, ...) and a y (its row, for
-      example: 0 is row 0, 1 is row 1, ...). Based on the x and y, the
-      ascending diagonal line as well as the descending diagonal line can be
-      calculated. The x and y indexes start from the upper left corner of the
-      chessboard.</para>
-
-      <table>
-        <title>A solution for the 4 queens puzzle shown in the domain
-        model</title>
-
-        <tgroup cols="6">
-          <thead>
-            <row>
-              <entry align="center">A solution</entry>
-
-              <entry align="center">Queen</entry>
-
-              <entry>x</entry>
-
-              <entry>y</entry>
-
-              <entry>ascendingD (x + y)</entry>
-
-              <entry>descendingD (x - y)</entry>
-            </row>
-          </thead>
-
-          <tbody>
-            <row>
-              <entry morerows="3"><mediaobject>
-                  <imageobject>
-                    <imagedata fileref="partiallySolvedNQueens04Explained.png"
-                               format="PNG" />
-                  </imageobject>
-                </mediaobject></entry>
-
-              <entry>A1</entry>
-
-              <entry>0</entry>
-
-              <entry>1</entry>
-
-              <entry>1 (**)</entry>
-
-              <entry>-1</entry>
-            </row>
-
-            <row>
-              <entry>B0</entry>
-
-              <entry>1</entry>
-
-              <entry>0 (*)</entry>
-
-              <entry>1 (**)</entry>
-
-              <entry>1</entry>
-            </row>
-
-            <row>
-              <entry>C2</entry>
-
-              <entry>2</entry>
-
-              <entry>2</entry>
-
-              <entry>4</entry>
-
-              <entry>0</entry>
-            </row>
-
-            <row>
-              <entry>D0</entry>
-
-              <entry>3</entry>
-
-              <entry>0 (*)</entry>
-
-              <entry>3</entry>
-
-              <entry>3</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </table>
-
-      <para>A single <literal>NQueens</literal> instance contains a list of
-      all <literal>Queen</literal> instances. It is the
-      <literal>Solution</literal> implementation which will be supplied to and
-      retrieved from drools-solver. Notice that in the 4 queens example,
-      NQueens's <literal>getN()</literal> method will always return 4.</para>
-
-      <para>You can find the source code of this example (as well as well as
-      several other examples) in the drools-solver-examples src
-      distribution.</para>
-    </section>
-  </section>
-
-  <section>
-    <title>Types of solvers</title>
-
-    <para>Different solvers solve problems in different ways. Each type has
-    advantages and disadvantages. We 'll roughly discuss a few of the solver
-    types here. You can safely skip this section.</para>
-
-    <section>
-      <title>Brute force</title>
-
-      <para>Brute force creates and evaluates every possible solution, usually
-      by creating a search tree.</para>
-
-      <para>Advantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It finds an optimal solution. If there is more then 1 optimal
-          solution, it finds all optimal solutions.</para>
-        </listitem>
-
-        <listitem>
-          <para>It is straightforward and simple to implement.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Disadvantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It has a horrible performance and scalability. Mostly unusable
-          for a real-world problem due to time constraints.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Brute force is currently not implemented in drools-solver. But we
-      have plans to implement it in the future, as a reference for validating
-      the output of the other solver types.</para>
-    </section>
-
-    <section>
-      <title>Branch and bound</title>
-
-      <para>Branch and bound is an improvement over brute force, as it prunes
-      away subsets of solutions which cannot have a better solution than the
-      best solution already found at that point.</para>
-
-      <para>Advantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It finds an optimal solution. If there is more then 1 optimal
-          solution, it can find all optimal solutions if needed.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Disadvantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It still scales very badly.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Branch and bound is currently not implemented in
-      drools-solver.</para>
-    </section>
-
-    <section>
-      <title>Simplex</title>
-
-      <para>Simplex turns all constraints into a big equation, which it
-      transmutes into a mathematical function without local optima. It then
-      finds an optimal solution to the planning problem by finding an optima
-      of that mathematical function.</para>
-
-      <para>Advantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It finds an optimal solution.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Disadvantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It's usually rather complex and mathematical to implement
-          constraints.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Drools-solver does not currently implement simplex.</para>
-    </section>
-
-    <section>
-      <title>Local search (tabu search, simulated annealing, ...)</title>
-
-      <para>Local search starts from an initial solution and evolves that
-      single solution into a better and better solution. It uses a single
-      search path of solutions. At each solution in this path it evaluates a
-      number of possible moves on the solution and applies the most suitable
-      move to take the step to the next solution.</para>
-
-      <para>Local search works a lot like a human planner: it uses a single
-      search path and moves facts around to find a good feasible
-      solution.</para>
-
-      <para>A simple local search can easily get stuck in a local optima, but
-      improvements (such as tabu search and simulated annealing) address this
-      problem.</para>
-
-      <para>Advantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It's relatively simple and natural to implement constraints
-          (at least in drools-solver's implementation).</para>
-        </listitem>
-
-        <listitem>
-          <para>It's very scalable, even when adding extra constraints (at
-          least in drools-solver's implementation).</para>
-        </listitem>
-
-        <listitem>
-          <para>It generally needs to worry about less negative hard
-          constraints, because the move pattern can fulfill a number of the
-          negative hard constraints.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Disadvantages:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>It does not know when it has found an optimal solution.</para>
-        </listitem>
-
-        <listitem>
-          <para>If the optimal score is unknown (which is usually the case),
-          it must be told when to stop looking (for example based on time
-          spend, user input, ...).</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Drools-solver implements local search, including tabu search and
-      simulated annealing.</para>
-    </section>
-  </section>
 </section>
\ No newline at end of file

Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotExamination.png
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotExamination.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotLessonSchedule.png
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotLessonSchedule.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotNQueens.png
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotNQueens.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Deleted: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotSolvedNQueens8.png
===================================================================
(Binary files differ)

Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotTravelingTournament.png
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/screenshotTravelingTournament.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossrules/trunk/documentation/manual/en/master.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/master.xml	2007-11-14 20:47:50 UTC (rev 16608)
+++ labs/jbossrules/trunk/documentation/manual/en/master.xml	2007-11-14 21:04:55 UTC (rev 16609)
@@ -195,6 +195,8 @@
 
         <xi:include href="Chapter-Solver/Section-Solver_introduction.xml" />
 
+        <xi:include href="Chapter-Solver/Section-Solver_examples.xml" />
+
         <xi:include href="Chapter-Solver/Section-Solver_configuration.xml" />
 
         <xi:include href="Chapter-Solver/Section-Score_calculation.xml" />




More information about the jboss-svn-commits mailing list