Search code examples
javarandomoptaplannertimefold

timefold: is it possible to create random initial solution with construction heuristic?


I'm trying to use parallel restarts in my timefold model.

I want different initial solutions for each restart. But I can't understand how to create random initial solution with construction heuristic phase.

Of course, I can create initial solution by myself, but I'm still wondering is it possible to use construction heuristic for that or not?

I've tried this configuration:

  <constructionHeuristic>
    <changeMoveSelector>
      <entitySelector>
        <selectionOrder>RANDOM</selectionOrder>
      </entitySelector>
    </changeMoveSelector>
  </constructionHeuristic>

And I've got this error:

java.lang.IllegalStateException: The <constructionHeuristic> contains a changeMoveSelector (ChangeMoveSelectorConfig(EntitySelectorConfig(null), null)) that contains an entitySelector (EntitySelectorConfig(null)) without explicitly configuring the <queuedEntityPlacer>.

My timefold version 1.6.0


Solution

  • No, but we could add a specific phase for it (or reuse the ConstructionHeuristic phase for it), like

    <randomConstruction/>
    

    Meanwhile, you can define a CustomPhase