[jboss-svn-commits] JBL Code SVN: r26340 - labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/resources/org/drools/solver/examples/manners2009/solver.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat May 2 10:40:19 EDT 2009


Author: ge0ffrey
Date: 2009-05-02 10:40:19 -0400 (Sat, 02 May 2009)
New Revision: 26340

Modified:
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/resources/org/drools/solver/examples/manners2009/solver/manners2009ScoreRules.drl
Log:
manners2009: all job rules

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/resources/org/drools/solver/examples/manners2009/solver/manners2009ScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/resources/org/drools/solver/examples/manners2009/solver/manners2009ScoreRules.drl	2009-05-02 14:23:22 UTC (rev 26339)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/resources/org/drools/solver/examples/manners2009/solver/manners2009ScoreRules.drl	2009-05-02 14:40:19 UTC (rev 26340)
@@ -24,7 +24,6 @@
 
 // Maintain a boy-girl-boy-girl seating arrangement is obsolete because it's build into the moves
 
-// 1 democrat
 rule "oneDemocratPoliticianPerTable"
     when
         $job : Job(jobType == JobType.POLITICIAN, name == "Democrat");
@@ -35,7 +34,6 @@
                 $table));
 end
 
-// 1 republican
 rule "oneRepublicanPoliticianPerTable"
     when
         $job : Job(jobType == JobType.POLITICIAN, name == "Republican");
@@ -46,16 +44,23 @@
                 $table));
 end
 
+// 1 democrat and 1 republican
 // 2 doctors at each table but NOT two of the same kind
-rule "twoDoctorsPerTable"
+// 2 sports stars at each table but NOT two of the same kind
+// 2 programmers at each table but NOT two of the same kind
+// 2 socialites at each table
+// 2 teachers at each table
+rule "twoSameJobTypePerTable"
     when
+        $jobType : JobType();
         $table : Table();
         not (
-            SeatDesignation(guestJobType == JobType.DOCTOR, seatTable == $table, $firstJob : guestJob)
-            and SeatDesignation(guestJobType == JobType.DOCTOR, seatTable == $table, guestJob != $firstJob)
+            SeatDesignation(guestJobType == $jobType, seatTable == $table, $firstJob : guestJob)
+            and SeatDesignation(guestJobType == $jobType, seatTable == $table, $secondJob : guestJob)
+            and (eval($jobType == JobType.SOCIALITE) or eval($jobType == JobType.TEACHER) or eval($firstJob != $secondJob))
         );
     then
-        insertLogical(new UnweightedConstraintOccurrence("twoDoctorsPerTable",
+        insertLogical(new UnweightedConstraintOccurrence("twoSameJobTypePerTable",
                 $table));
 end
 
@@ -72,10 +77,6 @@
                 $table, $jobType));
 end
 
-// 2 socialites at each table
-// 2 sports stars at each table but NOT two of the same kind
-// 2 teachers at each table
-// 2 programmers at each table but NOT two of the same kind
 
 
 // Each person must share a hobby with his/her left neighbour




More information about the jboss-svn-commits mailing list