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

Remove <scoreDefinitionType> from the solver configuration

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.Beta2
    • 6.4.0.Final
    • optaplanner-core
    • None
    • NEW
    • NEW

      It's stupid that we have to declare the score type 3 times:

      • In the domain class with @PlanningSolution: the Score field
      • In the DRL: the global ScoreHolder
      • In the solver configuration: the element `<scoreDefinitionType>`

      This should become obsolete:

        <scoreDirectorFactory>
          <scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
        </scoreDirectorFactory>
      

      1) Based on the type of the field/getter that has the @PlanningScore's, we get the Score type. Then we put that through a Map<ScoreClass, ScoreDefinitionClass> to figure out the ScoreDefinition instance.
      2) Special case: Bendable scores. For bendable score, the @PlanningScore gets an optional hardLevelSize and softLevelSize. This means that config moves from the solver config into the domain model.
      3) To plug in a custom ScoreDefinition, use

      @PlanningScore(scoreDefinitionClass=MyDef.class)

      Fail fast include that hardLevelSize is always null for non bendables and always non-null for bendables.

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

              Created:
              Updated:
              Resolved: