[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1804) Logical insertion lingers after the rule that inserted it no longer supports it (with testcase patch)

Mark Proctor (JIRA) jira-events at lists.jboss.org
Sat Apr 3 15:12:38 EDT 2010


    [ https://jira.jboss.org/jira/browse/JBRULES-1804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12523725#action_12523725 ] 

Mark Proctor commented on JBRULES-1804:
---------------------------------------

"hack" from geoffrey for solver:
// All demanded shifts must be assigned to a nurse
rule "requiredEmployeeSizePerShift"
    when
        $shift : Shift(requiredEmployeeSize > 0, $requiredEmployeeSize : requiredEmployeeSize);

        $totalEmployeeSize : Number(intValue != $requiredEmployeeSize) from accumulate(
            $assignment : EmployeeAssignment(shift == $shift),
            count($assignment)
        );

        // HACK to fix wierd truth maintenance behavior in drools
        // because making weight part of the equals/hashcode doesn't cut it
        // Vote for https://jira.jboss.org/jira/browse/JBRULES-1804
        not IntConstraintOccurrence(
            ruleId == "requiredEmployeeSizePerShift",
            constraintType == ConstraintType.NEGATIVE_HARD,
            causes contains $shift,
            eval(weight != Math.abs($requiredEmployeeSize - $totalEmployeeSize.intValue()))
        );
    then
        insertLogical(new IntConstraintOccurrence("requiredEmployeeSizePerShift", ConstraintType.NEGATIVE_HARD,
                Math.abs($requiredEmployeeSize - $totalEmployeeSize.intValue()),
                $shift));
end



> Logical insertion lingers after the rule that inserted it no longer supports it (with testcase patch)
> -----------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-1804
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-1804
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core  (expert)
>    Affects Versions:  5.0.0.M2
>            Reporter: Geoffrey De Smet
>            Assignee: Edson Tirelli
>            Priority: Critical
>             Fix For: 5.1.0.M2
>
>
> This one got me headscratching for a while, untill I realized what the problem is.
> Tim reported on the mailing list he ran into it to.
> I've commmited a testcase in subversion, in TruthMaintenanceTest, called
>    disabled_testLogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion
> Remove the "disabled_" to enable it and try it out.
> Here's what happens in the testcase:
> 3 sensors with tempature 100, 200 and 200 are inserted.
> There's a rule which logically inserts all encountered tempatures, so 100 and 200.
> Then the first sensor modifies to a tempature of 150.
> As it turns out, the encoutered tempatures should be 150 and 200 now, but instead it's 100, 150 and 200.
> Even though there is no sensor that has a tempature of 100.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list