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

Avoid having to implement the Solution interface because a @PlanningSolution, @Score and optional @ProblemFacts annotation could be enough

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.Beta1
    • None
    • optaplanner-core
    • None
    • NEW
    • NEW

      It's annoying that the user both has to declare a @PlanningSolution and implement the Solution interface. That's a ugly and inconsistent.

      Some idea's how to deal with this if and only if the Solution interface isn't implemented:

      • Introduce an optional method annotation @ProblemFacts.
        • If is declared, that method is the getProblemFacts() method and must return a Collection
        • If it is not declared, a reflection thing goes through all fields and adds all fields that aren't a @PlanningEntityCollectionProperty.
        • If it's declared multiple times, fail fast.
      • Introduce an required field/method annotation @Score for the score field
        • If it's missing, fail fast. If it's declared multiple times, fail fast.
      • If a solution class does implement the deprecated Solution interface, it all behaves backwards compatibly.

            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: