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

Replace @PlanningEntityCollectionProperty and @ProblemFactCollectionProperty with @PlanningEntityProperty and @ProblemFactProperty

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • Future
    • 6.4.0.Final
    • optaplanner-core
    • NEW
    • NEW

      Proposal A) Old behaviour

      @ProblemFactProperty
      public Person getPerson() {} // Person in WM
      
      @ProblemFactCollectionProperty
      public List<Person> getPersonList() {} // Each person in WM
      
      @ProblemFactProperty
      public List<Person> getPersonList() {} // List in WM
      
      @ProblemFactCollectionProperty
      public Person getPerson() {} // throws IllegalStateException
      

      Disadvantage of proposal A): when a user use @ProblemFactProperty on a List<Person> by accident, his score rules on Person don't match and it's hard to figure out why.

      Proposal C) Jiri Locker's proposal

      @ProblemFactProperty
      public Person getPerson() {} // Person in WM
      
      @ProblemFactProperty
      public List<Person> getPersonList() {} // Each person in WM
      
      @ProblemFactProperty(extractItems = false) // extractItems is true by default
      public List<Person> getPersonList() {} // List in WM, instead of the persons
      

      Advantage of proposal C): less is more

      Same approach for @PlannignEntityCollectionProperty.

      Backwards compatibility: The Collection annotations become deprecated. In case any one used @PlanningEntityProperty to put a List in the WM (not it's items), they need to add extractitems=true, so this is a 7.0 or 8.0 change as it does break backwards compatibility (with about 0 users...).

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

              Created:
              Updated: