0

I want to have multiple solution classes and multiple constraint providers, So instead of using @PlanningSolution used solverConfigs(xml). while creating SolverFactory.create() I am getting this error.

java.lang.IllegalStateException: The solutionClass (class Solution) has been specified as a solution in the configuration, but does not have a @PlanningSolution annotation.

My ultimate goal is to use multiple solution classes in a single application.

James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

1

Create a separate SolverConfig (or solverConfig.xml) for each one. For example:

SolverConfig sc1 = new SolverConfig()
      .withSolutionClass(Sol1.class)
      .with...;
SolverConfig sc2 = new SolverConfig()
      .withSolutionClass(Sol2.class)
      .with...;

Then create a seperate SolverManager for each one. Both Sol1 and Sol2 need a @PlanningSolution annotation.

This is already possible in Timefold/OptaPlanner today. The Quarkus and Spring Boot integration can't deal with this currently. Feel free to open an issue on Timefold to support this through @Named etc.

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