Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1421

Support multi-argument accumulate functions

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Obsolete
    • Major
    • None
    • 6.5.0.Final
    • core engine
    • None
    • NEW
    • NEW

    Description

      I'd like to be able to do this:

             accumulate(
                  TaskAssignment($person : person, $duration : duration);
                  $b : loadBalance($person, $duration)
             )
      

      This loadBalance function basically does sqrt(sum(squared(sum($duration) per $person))), so it cannot be split up into 2 separate accumulate functions. This loadBalance of fairness function is very common for employee rostering, task assignment (incl jbpm), cloud optimization, etc, so we 'll provide it out of the box.

      Internally, the compiler should do some syntactic sugar for DRL

      $b : loadBalance($p, $d)
      => syntactic sugar =>
      $b : loadBalance(new Object[]{$p, $d})
      

      The AccumulateFunction would then get an Object[] instance:

          public void accumulate(Serializable context, Object o) {
              Object[] value = (Object[]) o;
              ...
          }
      

      It's ok that the AccumulateFunction is still complex as that's only coded once, but the use of that function is in a lot of user code and examples.

      Attachments

        Issue Links

          Activity

            People

              mfusco@redhat.com Mario Fusco
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: