2

We forked OptaPlanner as Timefold some time ago. We often get this question:

Timefold changes all import statements and dependencies. How do I migrate an OptaPlanner codebase to Timefold efficiently?

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120

1 Answers1

2

No need to manually change imports statements, dependencies, etc. Just run a single command:

  1. Pick the right Timefold version:

    • If you're on OptaPlanner 8, use Timefold 0.8.x.
    • If you're on OptaPlanner 9, use Timefold 1.x (currently 0.9.x).
  2. Copy paste the Maven or Gradle command from here. For Maven it looks like this:

    mvn org.openrewrite.maven:rewrite-maven-plugin:4.46.0:run -Drewrite.recipeArtifactCoordinates=ai.timefold.solver:timefold-solver-migration:0.8.39 -Drewrite.activeRecipes=ai.timefold.solver.migration.ToLatest
    
  3. Run the solver in your application. Verify the score calculation speed is faster now. Look at the last log message:

     INFO  Solving ended: ... score calculation speed (103322/sec) ...
    
  4. Commit the local changes.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • Report any issues with the migration [in Github issues](https://github.com/TimefoldAI/timefold-solver/issues?q=is%3Aissue+is%3Aopen+label%3Atimefold-solver-migration). – Geoffrey De Smet May 16 '23 at 06:47
  • 1
    I get this error when I run that mvn command(with ./mvnw ) Error resolving version for plugin '.recipeArtifactCoordinates=ai.timefold.solver:timefold-solver-migration' from the repositories [local (C:\.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository – elk-tamer May 22 '23 at 03:17
  • 1
    Are you sure that this is the entire command? From the error message (which actually includes *property name* and not a plugin name, I am guessing at a typo on the command line. – Lukáš Petrovický May 24 '23 at 20:47
  • No I'm not sure. I did a copy/paste of the posted cmd"mvn org.openrewrite.maven:rewrite-maven-plugin:4.45.3:run -Drewrite.recipeArtifactCoordinates=ai.timefold.solver:timefold-solver-migration:0.8.38 -Drewrite.activeRecipes=ai.timefold.solver.migration.ToLatest" and ran it using ./mvnw instead of mvn in a windows terminal. – elk-tamer May 26 '23 at 18:16
  • I've updated the answer to rewrite 4.46 and timefold 0.8.39, can you try again? I 'd love to get to the bottom of this. – Geoffrey De Smet May 30 '23 at 13:30
  • What does `mvnw --version` print? – Geoffrey De Smet May 30 '23 at 13:32