Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2344

CS: Implement "shortcut" for when groupBy() flows directly into a consequence

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 8.4.0.Final
    • None
    • optaplanner-core
    • None

      For performance reasons, PLANNER-2331 removed all uses of Drools From node. Or more precisely, their uses were encapsulated inside the Drools exec model for certain use cases. As a result, CS should now be more efficient, but it could be made even more efficient in some cases.

      Consider the following two cases:

      1) groupBy(...).penalize(...)
      2) groupBy(...).filter(...).penalize()

      In the first case, the result of groupBy goes directly into penalize(), we do not need to perform any further operations on the groupBy() result, and therefore we can use the variables directly in the consequence.

      In the second case, we need to filter on the results of the groupBy() result, which will force variable binding on a new pattern, and only pass variables from that filtered pattern to the consequence. This is where FromNode may possibly be inserted by Drools.

      At the moment, both cases use the same behavior - the latter. We want to implement an optimization for the first case, one which will avoid the extra pattern and therefore all possibility for Drools to have to insert a FromNode in that case.

            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: