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

Allow setting a global variable (for example a service) which can be used by the score rules

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: optaplanner-core
    • Labels:
      None

      Description

      Currently, it is not possible to set a global variable in the working memory used by the solver. If a scoring rule needs an external helper for calculating scores (e.g. a dependency injected with OSGi DS), a workaround using a static variable in some class accessible by the scoring rules is needed.

      The easiest implementation is probably a new method in the Solver interface: // Impossible
      public WorkingMemory getWorkingMemory();
      which provides access to the working memory used by the solver.
      => Impossible because the number of WorkingMemory equals the number of threads being used by Planner, and sometimes they are reset.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ge0ffrey Geoffrey De Smet
                  Reporter:
                  whorre Wouter Horré
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated: