[jboss-svn-commits] JBL Code SVN: r17134 - labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Dec 9 16:16:29 EST 2007


Author: ge0ffrey
Date: 2007-12-09 16:16:29 -0500 (Sun, 09 Dec 2007)
New Revision: 17134

Modified:
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Local_Search_Solver.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Score_calculation.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_configuration.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_introduction.xml
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/nQueensDomainDiagram.dia
   labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/nQueensDomainDiagram.png
Log:
presentation based improvements

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-12-09 21:09:13 UTC (rev 17133)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Local_Search_Solver.xml	2007-12-09 21:16:29 UTC (rev 17134)
@@ -414,6 +414,12 @@
     <para>Notice that the logging used the <literal>toString()</literal>
     method from our <literal>Move</literal> implementation: <literal>[Queen-1]
     1 @ 0 =&gt; 3</literal>.</para>
+
+    <para>The local search solver solves the 4 queens problem in 3 steps, by
+    evaluating only 37 possible solutions (3 steps with 12 moves each + 1
+    starting solution), which is only fraction of all 256 possible solutions.
+    It solves 16 queens in 31 steps, by evaluating only 7441 out of
+    18446744073709551616 possible solutions.</para>
   </section>
 
   <section>

Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Score_calculation.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Score_calculation.xml	2007-12-09 21:09:13 UTC (rev 17133)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Score_calculation.xml	2007-12-09 21:16:29 UTC (rev 17134)
@@ -178,7 +178,7 @@
             count($constraintOccurrence)
         );
     then
-        scoreCalculator.setScore(- $constraintCountintValue());
+        scoreCalculator.setScore(- $constraintCount.intValue());
 end</programlisting>
 
     <para>Optionally, you can also weigh your constraints differently, by

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-12-09 21:09:13 UTC (rev 17133)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_configuration.xml	2007-12-09 21:16:29 UTC (rev 17134)
@@ -73,8 +73,8 @@
     <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
+      <para>Simplex turns all constraints and data 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>
 
@@ -287,10 +287,10 @@
 
     <programlisting>public interface Solution {
 
+    Collection&lt;? extends Object&gt; getFacts();
+
     Solution cloneSolution();
 
-    Collection&lt;? extends Object&gt; getFacts();
-
 }</programlisting>
 
     <para>For example:</para>
@@ -303,12 +303,28 @@
 
 }</programlisting>
 
-    <para>Most solvers use the <literal>cloneSolution()</literal> method to
-    clone the solution each time they encounter a new best solution. The
-    <literal>NQueens</literal> implementation just clones all
-    <literal>Queen</literal> instances:</para>
+    <section>
+      <title>The getFacts method</title>
 
-    <programlisting>    public NQueens cloneSolution() {
+      <para>All Objects returned by the <literal>getFacts()</literal> method
+      will be asserted into the drools working memory. Those facts can be used
+      by the score rules. For example, <literal>NQueens</literal> just returns
+      all <literal>Queen</literal> instances.</para>
+
+      <programlisting>    public Collection&lt;? extends Object&gt; getFacts() {
+        return queenList;
+    }</programlisting>
+    </section>
+
+    <section>
+      <title>The cloneSolution method</title>
+
+      <para>Most solvers use the <literal>cloneSolution()</literal> method to
+      clone the solution each time they encounter a new best solution. The
+      <literal>NQueens</literal> implementation just clones all
+      <literal>Queen</literal> instances:</para>
+
+      <programlisting>    public NQueens cloneSolution() {
         NQueens clone = new NQueens();
         List&lt;Queen&gt; clonedQueenList = new ArrayList&lt;Queen&gt;(queenList.size());
         for (Queen queen : queenList) {
@@ -318,13 +334,14 @@
         return clone;
     }</programlisting>
 
-    <para>The <literal>cloneSolution()</literal> method should clone no more
-    and no less than the parts of the <literal>Solution</literal> that can
-    change during solving. For example, in the lesson schedule example the
-    lessons are cloned, but teachers, groups and timeslots are not cloned
-    because only a lesson's appointed timeslot changes during solving:</para>
+      <para>The <literal>cloneSolution()</literal> method should clone no more
+      and no less than the parts of the <literal>Solution</literal> that can
+      change during solving. For example, in the lesson schedule example the
+      lessons are cloned, but teachers, groups and timeslots are not cloned
+      because only a lesson's appointed timeslot changes during
+      solving:</para>
 
-    <programlisting>    /**
+      <programlisting>    /**
      * Clone will only deep copy the lessons
      */
     public LessonSchedule cloneSolution() {
@@ -339,15 +356,7 @@
         clone.lessonList = clonedLessonList;
         return clone;
     }</programlisting>
-
-    <para>All Objects returned by the <literal>getFacts()</literal> method
-    will be asserted into the drools working memory. Those facts can be used
-    by the score rules. For example, <literal>NQueens</literal> just returns
-    all <literal>Queen</literal> instances.</para>
-
-    <programlisting>    public Collection&lt;? extends Object&gt; getFacts() {
-        return queenList;
-    }</programlisting>
+    </section>
   </section>
 
   <section>

Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml
===================================================================
--- labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml	2007-12-09 21:09:13 UTC (rev 17133)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_examples.xml	2007-12-09 21:16:29 UTC (rev 17134)
@@ -128,7 +128,7 @@
       <table>
         <title>NQueens problem size</title>
 
-        <tgroup cols="4">
+        <tgroup cols="5">
           <thead>
             <row>
               <entry># queens (n)</entry>
@@ -138,6 +138,8 @@
               <entry># feasible solutions (distinct)</entry>
 
               <entry># optimal solutions (distinct)</entry>
+
+              <entry># possible / # optimal</entry>
             </row>
           </thead>
 
@@ -150,6 +152,8 @@
               <entry>2</entry>
 
               <entry>2</entry>
+
+              <entry>128</entry>
             </row>
 
             <row>
@@ -160,6 +164,8 @@
               <entry>64</entry>
 
               <entry>64</entry>
+
+              <entry>262144</entry>
             </row>
 
             <row>
@@ -170,6 +176,8 @@
               <entry>14772512</entry>
 
               <entry>14772512</entry>
+
+              <entry>1248720872503</entry>
             </row>
 
             <row>
@@ -180,6 +188,8 @@
               <entry>?</entry>
 
               <entry>?</entry>
+
+              <entry>?</entry>
             </row>
 
             <row>
@@ -190,6 +200,8 @@
               <entry>?</entry>
 
               <entry>?</entry>
+
+              <entry>?</entry>
             </row>
 
             <row>
@@ -200,6 +212,8 @@
               <entry>?</entry>
 
               <entry># feasible solutions</entry>
+
+              <entry>?</entry>
             </row>
           </tbody>
         </tgroup>
@@ -515,7 +529,7 @@
 
               <entry>1.52464943788290465606136043e+64</entry>
 
-              <entry>&lt;= 5,77608277425558771434498864e+43</entry>
+              <entry>&lt;= 5.77608277425558771434498864e+43</entry>
 
               <entry>?</entry>
 
@@ -529,9 +543,9 @@
 
               <entry>90</entry>
 
-              <entry>9,43029892325559280477052413e+112</entry>
+              <entry>9.43029892325559280477052413e+112</entry>
 
-              <entry>&lt;= 1,07573451027871200629339068e+79</entry>
+              <entry>&lt;= 1.07573451027871200629339068e+79</entry>
 
               <entry>?</entry>
 
@@ -545,9 +559,9 @@
 
               <entry>132</entry>
 
-              <entry>1,58414112478195320415135060e+177</entry>
+              <entry>1.58414112478195320415135060e+177</entry>
 
-              <entry>&lt;= 2,01650616733413376416949843e+126</entry>
+              <entry>&lt;= 2.01650616733413376416949843e+126</entry>
 
               <entry>?</entry>
 
@@ -561,9 +575,9 @@
 
               <entry>182</entry>
 
-              <entry>3,35080635695103223315189511e+257</entry>
+              <entry>3.35080635695103223315189511e+257</entry>
 
-              <entry>&lt;= 1,73513467024013808570420241e+186</entry>
+              <entry>&lt;= 1.73513467024013808570420241e+186</entry>
 
               <entry>?</entry>
 
@@ -577,9 +591,9 @@
 
               <entry>240</entry>
 
-              <entry>3,22924601799855400751522483e+354</entry>
+              <entry>3.22924601799855400751522483e+354</entry>
 
-              <entry>&lt;= 2,45064610271441678267620602e+259</entry>
+              <entry>&lt;= 2.45064610271441678267620602e+259</entry>
 
               <entry>?</entry>
 
@@ -690,7 +704,7 @@
 
               <entry>7</entry>
 
-              <entry>1,11000574474221096210367623e+1052</entry>
+              <entry>1.11000574474221096210367623e+1052</entry>
 
               <entry>?</entry>
 
@@ -708,7 +722,7 @@
 
               <entry>49</entry>
 
-              <entry>2,86903028422562597982749122e+5761</entry>
+              <entry>2.86903028422562597982749122e+5761</entry>
 
               <entry>?</entry>
 
@@ -726,7 +740,7 @@
 
               <entry>48</entry>
 
-              <entry>5,74648299136737635070728795e+5132</entry>
+              <entry>5.74648299136737635070728795e+5132</entry>
 
               <entry>?</entry>
 
@@ -744,7 +758,7 @@
 
               <entry>1</entry>
 
-              <entry>1,44349601026818742275741580e+51</entry>
+              <entry>1.44349601026818742275741580e+51</entry>
 
               <entry>?</entry>
 

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-12-09 21:09:13 UTC (rev 17133)
+++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/Section-Solver_introduction.xml	2007-12-09 21:16:29 UTC (rev 17134)
@@ -33,7 +33,7 @@
       <listitem>
         <para><ulink
         url="http://en.wikipedia.org/wiki/Travelling_salesman_problem">The
-        traveling salesmen problem</ulink></para>
+        traveling salesman problem</ulink></para>
       </listitem>
 
       <listitem>

Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Solver/nQueensDomainDiagram.dia
===================================================================
(Binary files differ)

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




More information about the jboss-svn-commits mailing list