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) is equivalent 
(according to the score you define) to the expected one... 

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 ? 
If yes, it should look like this : 
- rule(s) that check that tables can enter in the room post HARD constraints 
- rule(s) that count the unassigned tables and post SOFT (with big weight) 
constraints 
- rule(s) that compute the remaining space and post SOFT (with low weight) 
constraints 
I can't find these rules in what you sent (so may be I am completely wrong 
here). 

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 < $length, width < 
$width). 
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 ... 



----- Mail original -----

De: "Ricardo" <sprabak...@gmail.com> 
À: rules-users@lists.jboss.org 
Envoyé: Mercredi 20 Juin 2012 17:57:07 
Objet: [rules-users] drools-planner drl file help 

Hi, My use case is 2 rooms and multiple table in various size, I want planner 
to organize the table in the available rooms in our case 2 rooms. 

room1 - 10x10 (length x width) 
room2 - 5x5 

table1 - 5x5 (length X width) 
table2 - 2x3 
table4 - 2x3 
table5 - 7x4 
table6 - 4x2 

*my drl file as follows...* 

rule "requiredRoomSpace" 

when 
$room : Room($length : length, $width : width, $size : size) 
$requiredSizeTotal : Number(intValue > $size) from accumulate( 
Table( 
room == $room, length < $length, width < $width, 
$requiredSize : requiredSize), 
sum($requiredSize) 
) 
then 
insertLogical(new IntConstraintOccurrence("requiredRoomSpace", 
ConstraintType.NEGATIVE_HARD, 
$requiredSizeTotal.intValue() - $size, $room)); 

end 

// 
############################################################################ 
// Calculate score 
// 
############################################################################ 

// Accumulate hard constraints 
rule "hardConstraintsBroken" 
salience -1 // Do the other rules first (optional, for performance) 
when 
$hardTotal : Number() from accumulate( 
IntConstraintOccurrence(constraintType == 
ConstraintType.NEGATIVE_HARD, $weight : weight), 
sum($weight) // Vote for 
http://jira.jboss.com/jira/browse/JBRULES-1075 
) 
then 
scoreHolder.setHardConstraintsBroken($hardTotal.intValue()); 
end 


*/when i run the program...it assign all the tables into room1 only...I am 
not sure what went to wrong...help will be appriciated....if need more info 
..I will provide.../* 



warm regards, 

----- 
with kind regards, 

-- 
View this message in context: 
http://drools.46999.n3.nabble.com/drools-planner-drl-file-help-tp4018104.html 
Sent from the Drools: User forum mailing list archive at Nabble.com. 
_______________________________________________ 
rules-users mailing list 
rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users 

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to