Search in sources :

Example 31 with SolverConfig

use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.

the class ConferenceSchedulingBenchmark method createSolver.

@Override
protected Solver<ConferenceSolution> createSolver() {
    // the pre-defined configuration in ConferenceScheduling cannot be used
    SolverConfig solverConfig = new SolverConfig();
    solverConfig.withEntityClasses(Talk.class);
    solverConfig.withSolutionClass(ConferenceSolution.class);
    ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
    scoreDirectorFactoryConfig.setConstraintProviderClass(ConferenceSchedulingConstraintProvider.class);
    LocalSearchPhaseConfig localSearchPhaseConfig = new LocalSearchPhaseConfig();
    localSearchPhaseConfig.setLocalSearchType(LocalSearchType.TABU_SEARCH);
    solverConfig.setPhaseConfigList(Arrays.asList(new ConstructionHeuristicPhaseConfig(), localSearchPhaseConfig));
    solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
    solverConfig.setTerminationConfig(new TerminationConfig().withTerminationClass(ConferenceSchedulingTermination.class));
    SolverFactory<ConferenceSolution> solverFactory = SolverFactory.create(solverConfig);
    return solverFactory.buildSolver();
}
Also used : ScoreDirectorFactoryConfig(org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig) TerminationConfig(org.optaplanner.core.config.solver.termination.TerminationConfig) ConferenceSolution(org.optaplanner.examples.conferencescheduling.domain.ConferenceSolution) LocalSearchPhaseConfig(org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig) ConstructionHeuristicPhaseConfig(org.optaplanner.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig) ConferenceSchedulingTermination(org.jboss.qa.brms.performance.examples.conferencescheduling.termination.ConferenceSchedulingTermination)

Example 32 with SolverConfig

use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.

the class VehicleRoutingBenchmark method createSolver.

@Override
protected Solver<VehicleRoutingSolution> createSolver() {
    // the pre-defined configuration in VehicleRouting cannot be used
    SolverConfig solverConfig = new SolverConfig();
    solverConfig.withEntityClasses(Standstill.class, Customer.class, TimeWindowedCustomer.class);
    solverConfig.withSolutionClass(VehicleRoutingSolution.class);
    ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
    scoreDirectorFactoryConfig.setInitializingScoreTrend("ONLY_DOWN");
    scoreDirectorFactoryConfig.setConstraintProviderClass(VehicleRoutingConstraintProvider.class);
    solverConfig.setPhaseConfigList(getPhaseConfigList());
    solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
    solverConfig.setTerminationConfig(new TerminationConfig().withTerminationClass(HardVRPCalculateCountTermination.class));
    SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
    return solverFactory.buildSolver();
}
Also used : ScoreDirectorFactoryConfig(org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig) TerminationConfig(org.optaplanner.core.config.solver.termination.TerminationConfig) VehicleRoutingSolution(org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution) HardVRPCalculateCountTermination(org.jboss.qa.brms.performance.examples.vehiclerouting.termination.HardVRPCalculateCountTermination) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 33 with SolverConfig

use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.

the class CloudBalancingMultithreadedSolvingScalabilityBenchmark method createInitialSolution.

@Override
protected CloudBalance createInitialSolution() {
    CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
    customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(CloudBalanceSolutionInitializer.class));
    SolverConfig solverConfig = getBaseSolverConfig();
    solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
    SolverFactory<CloudBalance> solverFactory = SolverFactory.create(solverConfig);
    Solver<CloudBalance> constructionSolver = solverFactory.buildSolver();
    CloudBalance solution = Examples.CLOUD_BALANCING.loadSolvingProblem(dataset);
    return constructionSolver.solve(solution);
}
Also used : CustomPhaseConfig(org.optaplanner.core.config.phase.custom.CustomPhaseConfig) CloudBalance(org.optaplanner.examples.cloudbalancing.domain.CloudBalance) CloudBalanceSolutionInitializer(org.jboss.qa.brms.performance.examples.cloudbalancing.solution.CloudBalanceSolutionInitializer) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 34 with SolverConfig

use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.

the class CloudBalancingExample method getBaseSolverConfig.

@Override
public SolverConfig getBaseSolverConfig() {
    SolverConfig solverConfig = new SolverConfig();
    solverConfig.withEntityClasses(CloudProcess.class);
    solverConfig.withSolutionClass(CloudBalance.class);
    solverConfig.setEnvironmentMode(EnvironmentMode.REPRODUCIBLE);
    solverConfig.setScoreDirectorFactoryConfig(new ScoreDirectorFactoryConfig());
    solverConfig.getScoreDirectorFactoryConfig().setIncrementalScoreCalculatorClass(CloudBalancingIncrementalScoreCalculator.class);
    solverConfig.getScoreDirectorFactoryConfig().setInitializingScoreTrend("ONLY_DOWN");
    return solverConfig;
}
Also used : ScoreDirectorFactoryConfig(org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 35 with SolverConfig

use of org.optaplanner.core.config.solver.SolverConfig in project kie-benchmarks by kiegroup.

the class AbstractTSPLocalSearchBenchmark method createInitialSolution.

@Override
protected TspSolution createInitialSolution() {
    CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
    customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(TSPSolutionInitializer.class));
    SolverConfig solverConfig = Examples.TRAVELING_SALESMAN.getBaseSolverConfig();
    solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
    SolverFactory<TspSolution> solverFactory = SolverFactory.create(solverConfig);
    Solver<TspSolution> constructionSolver = solverFactory.buildSolver();
    TspSolution solution = Examples.TRAVELING_SALESMAN.loadSolvingProblem(dataset);
    return constructionSolver.solve(solution);
}
Also used : CustomPhaseConfig(org.optaplanner.core.config.phase.custom.CustomPhaseConfig) TSPSolutionInitializer(org.jboss.qa.brms.performance.examples.tsp.solution.TSPSolutionInitializer) TspSolution(org.optaplanner.examples.tsp.domain.TspSolution) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Aggregations

SolverConfig (org.optaplanner.core.config.solver.SolverConfig)54 TerminationConfig (org.optaplanner.core.config.solver.termination.TerminationConfig)17 ScoreDirectorFactoryConfig (org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig)14 LocalSearchPhaseConfig (org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig)12 CounterfactualPrediction (org.kie.kogito.explainability.model.CounterfactualPrediction)11 Prediction (org.kie.kogito.explainability.model.Prediction)11 PredictionInput (org.kie.kogito.explainability.model.PredictionInput)11 PredictionOutput (org.kie.kogito.explainability.model.PredictionOutput)11 Feature (org.kie.kogito.explainability.model.Feature)10 Output (org.kie.kogito.explainability.model.Output)10 PredictionProvider (org.kie.kogito.explainability.model.PredictionProvider)10 Test (org.junit.jupiter.api.Test)9 ConstructionHeuristicPhaseConfig (org.optaplanner.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig)9 LinkedList (java.util.LinkedList)7 CounterfactualEntity (org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity)7 LocalSearchForagerConfig (org.optaplanner.core.config.localsearch.decider.forager.LocalSearchForagerConfig)7 VehicleRoutingSolution (org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Value (org.kie.kogito.explainability.model.Value)6 UnionMoveSelectorConfig (org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSelectorConfig)6