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

Construction Heuristics fail to initialize partially initialized solution

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 6.0.0.Final
    • 6.0.0.CR4
    • optaplanner-core
    • None

      When Construction Heuristics are applied on a partially initialized solution, number of entities remain uninitialized.

      Use Case - I have assignments with two planning variables time and resource. If I partially null resource variable (because some of resources are not available anymore) and then pass this solution to solver, I will get UninitializedSolutionException.

      Easily replicable with simple testcase where you pass two instances of Foo to CH with following planning variable values:

      Foo foo1 = new Foo();
      foo1.setBar(null);
      foo1.setBaz(null);

      Foo foo2 = new Foo();
      foo2.setBar("someBar");
      foo2.setBaz(null);

      Solution solution = ...
      solution.getFooList.add(foo1);
      solution.getFooList.add(foo2);

      ....
      solver.setPlanningProblem(solution);
      solver.solve(); // <- UninitializedSolutionException after CH phase since Baz of foo2 will not get initialized!

      I tried to find out where the bug is but couldn't find the place, I assume it has something to do with the CartesianProductMoveSelector used by the DefaultConstructionHeuristicSolverPhase?

      br
      reinis

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

                Created:
                Updated:
                Resolved: