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

No score reported in best solution if no steps taken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 5.4.0.Final
    • None
    • optaplanner-core
    • None

      If my initial solution guess is perfect and the solver exits before taking any steps, then solver.getBestSolution().getScore() is null. If I change my initializer so the first guess is intentionally wrong, then getScore() returns non-null.

      I would prefer that getScore() would be guaranteed to always return non-null after a successful solver.solve() invocation. Clearly the score is being computed because the log messages show it (see below). But the returned solution instance does not reflect that. By debugging, I can see that the returned solution is in fact the same instance that I passed in via setPlanningProblem() and not a clone.

      2012-03-30 15:42:53,283 INFO  [DefaultSolver.java:172] Solving started: time spend (145), score (0hard/0soft), new best score (0hard/0soft), random seed (0). - o.d.p.c.s.DefaultSolver
      2012-03-30 15:42:53,289 INFO  [DefaultSolver.java:197] Solving ended: time spend (156), best score (0hard/0soft), average calculate count per second (6). - o.d.p.c.s.DefaultSolver
      

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

                Created:
                Updated:
                Resolved: