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

Autodiscover problem facts without @ProblemFactProperty and @ProblemFactCollectionProperty annotations through flag on @Planningsolution (AKA deprecate AbstractSolution)

XMLWordPrintable

    • NEW
    • NEW

      It's a pain that workbench planning solutions need to extend AbstractSolution.

      Requirements

      • If autodiscover is FIELD (resp. GETTER), it applies to all fields (resp. getters), including subclasses (and superclasses)
      • If autodiscover is FIELD and a field has an explicit annotation, that annotation overrides the autodetected behavior. (Similar for GETTER)
      • if an autodiscovered member is a Score then it's PlanningScore. (Unit test wanted for BendableScore? Impossible to autodiscover I think)
      • if an autodiscovered member is entityClass or a subclass thereof (Unit test needed) then it's PlanningEntityProperty
      • if an autodiscovered member is a Collection of entityClass or a subclass thereof (Unit test needed) then it's PlanningEntityCollectionProperty
      • if an autodiscovered member is a Collection then it's ProblemFactCollectionProperty
      • else then it's ProblemFactCollectionProperty
      • (Unit test needed for if a getter is overriden and the parent was autodetect but the child has an explicit annotation - and vica versa)

      Proposal A)

      @PlanningSolution(autoDetectStrategyType = AutoDetectStrategyType.FIELDS)
      public class MySolution {
      
          @ValueRangeProvider(id = "valueRange")
          private List<TestdataValue> valueList; // Automatically behaves as @ProblemFactCollectionProperty
          private List<TestdataEntity> entityList; // Automatically behaves as @PlanningEntityCollectionProperty
      
      
          private TestdataValue value; // Automatically behaves as @ProblemFactProperty
          private TestdataEntity entity; // Automatically behaves as @PlanningEntityProperty
      
      }
      

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

                Created:
                Updated:
                Resolved: