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

Workbench: Data modeler's planning solution should implement Solution interface

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 6.4.0.Final
    • None
    • optaplanner-wb
    • None
    • NEW
    • NEW

      Caused by PLANNER-325.

      In the data modeler, when a class is configured as a Planning solution - it does get the @PlanningSolution annotation, but it doesn't get the "implements Solution<HardSoftScore>" line (which needs to know the score type btw), nor get the Score field, nor get the getProblemFacts() method:

      @PlanningSolution
      public class CloudBalance extends AbstractPersistable implements Solution<HardSoftScore> {
      
          ... // fields defined by the editor
      
          private HardSoftScore score;
          public HardSoftScore getScore() {
              return score;
          }
          public void setScore(HardSoftScore score) {
              this.score = score;
          }
      
          public Collection<? extends Object> getProblemFacts() {
              List<Object> facts = new ArrayList<Object>();
              // Add all fields: addAll() for a Collection, add() for non Collections
              facts.addAll(computerList);
              // Do not add the fields annotated with @PlanningEntityCollectionProperty (processList)
              return facts;
          }
      

      This blocks toni's testing of PLANNER-342, because SolverConfig.buildSolver() will fail-fast due to this.

      Feel free to leave the getProblemFacts() method empty in the first iteration as that won't break Toni's testing - I can even look into letting optaplanner do that automatically as desired.

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

                Created:
                Updated:
                Resolved: