[rules-users] drools-planner drl file help

Ricardo sprabakkar at gmail.com
Wed Jun 20 11:57:07 EDT 2012


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.


More information about the rules-users mailing list