[rules-users] drools planner ConstraintOccurrence

Ricardo sprabakkar at gmail.com
Fri Jun 22 16:17:22 EDT 2012


Hi thanks lot, for the last one week I am breaking my head to understand the
drools planner. 

I have two questions...
1) When to use Unweighted constrains?
2) Is any way I can combine the following two rules in to one rule, I mean
writing length and width in one rule condition instead of two. I tried but I
dont know how to use the accumulate for 2d constraint. Is any alternate way
to write this condition.

I really appreciate your patients and time, thanks lot again

//
############################################################################
// Hard constraints
//
############################################################################
rule "requiredLengthTotal"
    when
        $room : Room($length : length)
        $requiredSpaceTotal : Number(intValue > $length) from accumulate(
            Table(
                room == $room, 
                $tablelength : length),
            sum($tablelength)
        )
    then
        insertLogical(new IntConstraintOccurrence("requiredLengthTotal",
ConstraintType.NEGATIVE_HARD,
                $requiredSpaceTotal.intValue() - $length,
                $room));
end

rule "requiredWidthTotal"
    when
        $room : Room($width : width)
        $requiredSpaceTotal : Number(intValue > $width) from accumulate(
            Table(
                room == $room, 
                $tablewidth : width),
            sum($tablewidth)
        )
    then
        insertLogical(new IntConstraintOccurrence("requiredWidthTotal",
ConstraintType.NEGATIVE_HARD,
                $requiredSpaceTotal.intValue() - $width,
                $room));
end

-----
with kind regards,

--
View this message in context: http://drools.46999.n3.nabble.com/drools-planner-ConstraintOccurrence-tp4018182p4018189.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list