[jboss-jira] [JBoss JIRA] (JBRULES-3144) undo-then: when rule becomes no longer true execute a callback"

Geoffrey De Smet (Issue Comment Edited) (JIRA) jira-events at lists.jboss.org
Fri Dec 16 10:56:09 EST 2011


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

Geoffrey De Smet edited comment on JBRULES-3144 at 12/16/11 10:55 AM:
----------------------------------------------------------------------

I wrote a buggy undo-then implementation and ran some benchmarks to see how much faster it is:

for 256 queens for 100 steps (with undoMove assertion) average calculate count per second (higher is better):
- classic   planner: 111537
- undo-then planner: 205672 (84% faster)

for 512 queens for 100 steps (with undoMove assertion) average calculate count per second (higher is better):
- classic   planner: 111472 (-0.06%)
- undo-then planner: 187462 (68% faster, -8.85%)

It's faster, but scaling doesn't seem to be affected.
Note that it doesn't lower scaling as those number might make you think, because it just means that the insertLogical's part is not the deciding factor as it scales out.
                
      was (Author: ge0ffrey):
    I wrote a buggy undo-then implementation and ran some benchmarks to see how much faster it is:

for 256 queens for 100 steps (with undoMove assertion) average calculate count per second:
- classic   planner: 111537
- undo-then planner: 205672

for 512 queens for 100 steps (with undoMove assertion) average calculate count per second:
- classic   planner: 111472 (-0.06%)
- undo-then planner: 187462 (-8.85%)

It's faster, but scaling doesn't seem to be affected.
Note that it doesn't lower scaling as those number might make you think, because it just means that the insertLogical's part is not the deciding factor as it scales out.
                  
> undo-then: when rule becomes no longer true execute a callback"
> ---------------------------------------------------------------
>
>                 Key: JBRULES-3144
>                 URL: https://issues.jboss.org/browse/JBRULES-3144
>             Project: Drools
>          Issue Type: Task
>      Security Level: Public(Everyone can see) 
>          Components: drools-core  (expert), drools-planner
>            Reporter: Geoffrey De Smet
>            Assignee: Geoffrey De Smet
>
> Here's what I'd like to be able to do:
> {code}
> rule "serviceConflict"
>     when
>         $leftProcessAssignment : MrProcessAssignment($service : service, $machine : machine, $leftId : id)
>         $rightProcessAssignment : MrProcessAssignment(service == $service, machine == $machine, id > $leftId)
>     then
>         scoreCalculator.addToHardScore(1); // No insertLogical or accumulate of those ConstraintOccurence's needed
>     undo-then
>         scoreCalculator.substractFromHardScore(1);
> end
> {code}
> And here's a more complex example where the weight isn't a static "1":
> {code}
> rule "serviceLocationSpread"
>     when
>         $service : MrService($locationSpread : locationSpread)
>         $spreadCount : Number(intValue < $locationSpread) from accumulate(
>                 $location : MrLocation()
>                 and exists MrProcessAssignment(service == $service, location == $location),
>             count($location)
>         )
>     then
>         scoreCalculator.addToHardScore($locationSpread - $spreadCount.intValue());
>     undo-then
>         scoreCalculator.substractFromHardScore($locationSpread - $spreadCount.intValue());
>         // $spreadCount should still be the same as it used to be
> end
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list