Thank you Marcus,
with your constraint I got rid of the "no-loop true" and the endTime is
recalculated when needed. So my first problem is really solved!

So I tried a similar constraint for the rule "Calc StartTime with
redecessors" 

        rule "Calc StartTime with predecessors"
            when
                $t : Task(predecessorCount > 0, $predecessors : predecessors
)
                forall ( 
                                        $succTask : Task( this == $t )
                                        $predTask : Task( this memberOf
$predecessors, endTime > 0 )
                                )
                $endTime : Number()
                        from accumulate( $p : Task() from $predecessors, 
        
max($p.getEndTime()) )
                        # new constraint
                        Task(this == $t, eval($t.getStartTime() !=
$endTime.longValue()))
                then
                        $t.setStartTime( $endTime.longValue() );
                        System.out.println( "Drools: " + $t.toString() + "
has new StartTime" );
                        # new update
                        update( $t );
        end

The improvement is that I can do an update in the RHS without infinite
recursion. But the rule is still wrong, because it doesn't fire when the
maximum of predecessors endTimes changes. 

Best regards
Ralph

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

Reply via email to