Search in sources :

Example 36 with SolverConfig

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

the class TravelingSalesmanExample method getBaseSolverConfig.

@Override
public SolverConfig getBaseSolverConfig() {
    SolverConfig solverConfig = new SolverConfig();
    solverConfig.withEntityClasses(Visit.class);
    solverConfig.withSolutionClass(TspSolution.class);
    solverConfig.setEnvironmentMode(EnvironmentMode.REPRODUCIBLE);
    solverConfig.setScoreDirectorFactoryConfig(new ScoreDirectorFactoryConfig());
    solverConfig.getScoreDirectorFactoryConfig().setIncrementalScoreCalculatorClass(TspIncrementalScoreCalculator.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 37 with SolverConfig

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

the class VehicleRoutingExample method createInitialSolution.

public VehicleRoutingSolution createInitialSolution(DataSet dataSet) {
    CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
    customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(VehicleRoutingSolutionInitializer.class));
    SolverConfig solverConfig = Examples.VEHICLE_ROUTING.getBaseSolverConfig();
    solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
    SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
    Solver<VehicleRoutingSolution> constructionSolver = solverFactory.buildSolver();
    VehicleRoutingSolution solution = Examples.VEHICLE_ROUTING.loadSolvingProblem(dataSet);
    return constructionSolver.solve(solution);
}
Also used : CustomPhaseConfig(org.optaplanner.core.config.phase.custom.CustomPhaseConfig) VehicleRoutingSolution(org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution) VehicleRoutingSolutionInitializer(org.jboss.qa.brms.performance.examples.vehiclerouting.solution.VehicleRoutingSolutionInitializer) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 38 with SolverConfig

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

the class FlightCrewSchedulingExample method getBaseSolverConfig.

@Override
public SolverConfig getBaseSolverConfig() {
    SolverConfig solverConfig = new SolverConfig();
    solverConfig.withEntityClasses(FlightAssignment.class, Employee.class);
    solverConfig.withSolutionClass(FlightCrewSolution.class);
    solverConfig.setEnvironmentMode(EnvironmentMode.REPRODUCIBLE);
    ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
    scoreDirectorFactoryConfig.setConstraintProviderClass(FlightCrewSchedulingConstraintProvider.class);
    scoreDirectorFactoryConfig.setInitializingScoreTrend("ONLY_DOWN");
    solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
    return solverConfig;
}
Also used : ScoreDirectorFactoryConfig(org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 39 with SolverConfig

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

the class TravelingTournamentExample method createInitialSolution.

public TravelingTournament createInitialSolution(TravelingTournamentExample.DataSet dataSet) {
    SolverConfig solverConfig = Examples.TRAVELING_TOURNAMENT.getBaseSolverConfig();
    SolverFactory<TravelingTournament> solverFactory = SolverFactory.create(solverConfig);
    Solver<TravelingTournament> constructionSolver = solverFactory.buildSolver();
    TravelingTournament solution = Examples.TRAVELING_TOURNAMENT.loadSolvingProblem(dataSet);
    return constructionSolver.solve(solution);
}
Also used : TravelingTournament(org.optaplanner.examples.travelingtournament.domain.TravelingTournament) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 40 with SolverConfig

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

the class AbstractVRPTWLocalSearchBenchmark method createInitialSolution.

@Override
protected VehicleRoutingSolution createInitialSolution() {
    SolverConfig solverConfig = Examples.VEHICLE_ROUTING.getBaseSolverConfig();
    // different from simple VRP
    solverConfig.getEntityClassList().add(TimeWindowedCustomer.class);
    CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
    customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(VehicleRoutingSolutionInitializer.class));
    solverConfig.setPhaseConfigList(Collections.singletonList(customPhaseConfig));
    SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
    Solver<VehicleRoutingSolution> constructionSolver = solverFactory.buildSolver();
    VehicleRoutingSolution solution = Examples.VEHICLE_ROUTING.loadSolvingProblem(dataset);
    return constructionSolver.solve(solution);
}
Also used : CustomPhaseConfig(org.optaplanner.core.config.phase.custom.CustomPhaseConfig) VehicleRoutingSolution(org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution) VehicleRoutingSolutionInitializer(org.jboss.qa.brms.performance.examples.vehiclerouting.solution.VehicleRoutingSolutionInitializer) 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