<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 10pt; color: #000000'>I am not sure to understand your problem exactly, and espacially chat you intend to do, but it is likely because you don't declare the suitable criterion so the solution you have (could help if you post it too)&nbsp; is equivalent (according to the score you define) to the expected one...<br><br>If I try to summarize, it is a bin-packing problem : you try to place 'as much tables as possible' in your 2 rooms by maximizing the global remaining space ?<br>If yes, it should look like this : <br>&nbsp;&nbsp; - rule(s) that check that tables can enter in the room post HARD constraints<br>&nbsp;&nbsp; - rule(s) that count the unassigned tables and post SOFT (with big weight) constraints<br>
&nbsp;&nbsp; - rule(s) that compute the remaining space  and post SOFT (with low weight) constraints<br>I can't find these rules in what you sent (so may be I am completely wrong here).<br><br>According to what I imagine and what I see, I think that you are confusing the planner violated contraints (which are objects to insert into WM under some conditions) and the LHS conditions (like those :  length &lt; $length, width &lt; $width).<br>A last thing not clear : you defines items with 2 dimensions, but it seems that you only have a 'size' attribute which is used as a number ...<br><br><br><br><hr id="zwchr"><div style="color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>De: </b>"Ricardo" &lt;sprabakkar@gmail.com&gt;<br><b>À: </b>rules-users@lists.jboss.org<br><b>Envoyé: </b>Mercredi 20 Juin 2012 17:57:07<br><b>Objet: </b>[rules-users] drools-planner drl file help<br><br>Hi, My use case is 2 rooms and multiple table in various size, I want planner<br>to organize the table in the available &nbsp;rooms in our case 2 rooms.<br><br>room1 - 10x10 (length x width)<br>room2 - 5x5<br><br>table1 - 5x5 (length X width)<br>table2 - 2x3<br>table4 - 2x3<br>table5 - 7x4<br>table6 - 4x2<br><br>*my drl file as follows...*<br><br>rule "requiredRoomSpace"<br><br>&nbsp;&nbsp; &nbsp;when<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$room : Room($length : length, $width : width, $size : size)<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$requiredSizeTotal : Number(intValue &gt; $size) from accumulate(<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Table(<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;room == $room, length &lt; $length, width &lt; $width,<br>$requiredSize : requiredSize),<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sum($requiredSize)<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;)<br>&nbsp;&nbsp; &nbsp;then<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;insertLogical(new IntConstraintOccurrence("requiredRoomSpace",<br>ConstraintType.NEGATIVE_HARD,<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$requiredSizeTotal.intValue() - $size, $room));<br><br>end<br><br>//<br>############################################################################<br>// Calculate score<br>//<br>############################################################################<br><br>// Accumulate hard constraints<br>rule "hardConstraintsBroken"<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;salience -1 // Do the other rules first (optional, for performance)<br>&nbsp;&nbsp; &nbsp;when<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$hardTotal : Number() from accumulate(<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IntConstraintOccurrence(constraintType ==<br>ConstraintType.NEGATIVE_HARD, $weight : weight),<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sum($weight) // Vote for<br>http://jira.jboss.com/jira/browse/JBRULES-1075<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;)<br>&nbsp;&nbsp; &nbsp;then<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;scoreHolder.setHardConstraintsBroken($hardTotal.intValue());<br>end<br><br><br>*/when i run the program...it assign all the tables into room1 only...I am<br>not sure what went to wrong...help will be appriciated....if need more info<br>..I will provide.../*<br><br><br><br>warm regards,<br><br>-----<br>with kind regards,<br><br>--<br>View this message in context: http://drools.46999.n3.nabble.com/drools-planner-drl-file-help-tp4018104.html<br>Sent from the Drools: User forum mailing list archive at Nabble.com.<br>_______________________________________________<br>rules-users mailing list<br>rules-users@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/rules-users<br></div><br></div></body></html>