io.quarkus.optaplanner.OptaPlannerBeanProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-optaplanner Show documentation
Show all versions of quarkus-optaplanner Show documentation
Constraint solving AI for employee rostering, vehicle routing, maintenance scheduling, school timetabling, etc
package io.quarkus.optaplanner;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;
import org.optaplanner.core.api.score.ScoreManager;
import org.optaplanner.core.api.solver.SolverFactory;
import org.optaplanner.core.api.solver.SolverManager;
import org.optaplanner.core.config.solver.SolverConfig;
import org.optaplanner.core.config.solver.SolverManagerConfig;
import io.quarkus.arc.DefaultBean;
public class OptaPlannerBeanProvider {
@DefaultBean
@Singleton
@Produces
SolverFactory solverFactory(SolverConfig solverConfig) {
return SolverFactory.create(solverConfig);
}
@DefaultBean
@Singleton
@Produces
SolverManager solverManager(SolverFactory solverFactory,
SolverManagerConfig solverManagerConfig) {
return SolverManager.create(solverFactory, solverManagerConfig);
}
@DefaultBean
@Singleton
@Produces
ScoreManager scoreManager(SolverFactory solverFactory) {
return ScoreManager.create(solverFactory);
}
}