Search in sources :

Example 21 with SolverConfig

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

the class AbstractVRPTWLocalSearchBenchmark method createSolver.

@Override
protected Solver<VehicleRoutingSolution> createSolver() {
    SolverConfig solverConfig = Examples.VEHICLE_ROUTING.getBaseSolverConfig();
    solverConfig.getEntityClassList().add(TimeWindowedCustomer.class);
    LocalSearchPhaseConfig localSearchPhaseConfig = new LocalSearchPhaseConfig();
    localSearchPhaseConfig.setMoveSelectorConfig(new UnionMoveSelectorConfig());
    ((UnionMoveSelectorConfig) localSearchPhaseConfig.getMoveSelectorConfig()).setMoveSelectorConfigList(createMoveSelectorConfigList());
    localSearchPhaseConfig.setAcceptorConfig(createAcceptorConfig());
    localSearchPhaseConfig.setForagerConfig(new LocalSearchForagerConfig());
    localSearchPhaseConfig.getForagerConfig().setAcceptedCountLimit(getAcceptedCountLimit());
    localSearchPhaseConfig.setTerminationConfig(getTerminationConfig());
    solverConfig.setPhaseConfigList(Collections.singletonList(localSearchPhaseConfig));
    SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
    return solverFactory.buildSolver();
}
Also used : VehicleRoutingSolution(org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution) LocalSearchForagerConfig(org.optaplanner.core.config.localsearch.decider.forager.LocalSearchForagerConfig) LocalSearchPhaseConfig(org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig) UnionMoveSelectorConfig(org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSelectorConfig)

Example 22 with SolverConfig

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

the class VRPTimeWindowedConstructionBenchmark method createSolver.

@Override
protected Solver<VehicleRoutingSolution> createSolver() {
    SolverConfig solverConfig = Examples.VEHICLE_ROUTING.getBaseSolverConfig();
    ConstructionHeuristicPhaseConfig constructionHeuristicPhaseConfig = new ConstructionHeuristicPhaseConfig().withConstructionHeuristicType(getConstructionHeuristicType());
    solverConfig.setPhaseConfigList(Collections.singletonList(constructionHeuristicPhaseConfig));
    // diff between normal VRP and TimeWindowed
    solverConfig.getEntityClassList().add(TimeWindowedCustomer.class);
    SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(solverConfig);
    return solverFactory.buildSolver();
}
Also used : VehicleRoutingSolution(org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution) ConstructionHeuristicPhaseConfig(org.optaplanner.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 23 with SolverConfig

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

the class AbstractCloudBalanceLocalSearchBenchmark method createSolver.

@Override
protected Solver<CloudBalance> createSolver() {
    LocalSearchPhaseConfig localSearchPhaseConfig = new LocalSearchPhaseConfig();
    localSearchPhaseConfig.setMoveSelectorConfig(new UnionMoveSelectorConfig());
    ((UnionMoveSelectorConfig) localSearchPhaseConfig.getMoveSelectorConfig()).setMoveSelectorConfigList(createMoveSelectorConfigList());
    localSearchPhaseConfig.setAcceptorConfig(createAcceptorConfig());
    localSearchPhaseConfig.setForagerConfig(new LocalSearchForagerConfig());
    localSearchPhaseConfig.getForagerConfig().setAcceptedCountLimit(getAcceptedCountLimit());
    localSearchPhaseConfig.setTerminationConfig(getTerminationConfig());
    SolverConfig solverConfig = Examples.CLOUD_BALANCING.getBaseSolverConfig();
    solverConfig.setPhaseConfigList(Collections.singletonList(localSearchPhaseConfig));
    SolverFactory<CloudBalance> solverFactory = SolverFactory.create(solverConfig);
    return solverFactory.buildSolver();
}
Also used : LocalSearchForagerConfig(org.optaplanner.core.config.localsearch.decider.forager.LocalSearchForagerConfig) CloudBalance(org.optaplanner.examples.cloudbalancing.domain.CloudBalance) LocalSearchPhaseConfig(org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig) UnionMoveSelectorConfig(org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSelectorConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 24 with SolverConfig

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

the class ConferenceSchedulingExample method getBaseSolverConfig.

@Override
public SolverConfig getBaseSolverConfig() {
    SolverConfig solverConfig = new SolverConfig();
    solverConfig.withEntityClasses(Talk.class);
    solverConfig.withSolutionClass(ConferenceSolution.class);
    solverConfig.setScoreDirectorFactoryConfig(new ScoreDirectorFactoryConfig());
    solverConfig.getScoreDirectorFactoryConfig().setInitializingScoreTrend("ONLY_DOWN");
    solverConfig.getScoreDirectorFactoryConfig().setConstraintProviderClass(ConferenceSchedulingConstraintProvider.class);
    return solverConfig;
}
Also used : ScoreDirectorFactoryConfig(org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 25 with SolverConfig

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

the class FlightCrewSchedulingExample method createInitialSolution.

public FlightCrewSolution createInitialSolution(DataSet dataSet) {
    ConstructionHeuristicPhaseConfig chPhaseConfig = new ConstructionHeuristicPhaseConfig();
    SolverConfig solverConfig = Examples.FLIGHT_CREW_SCHEDULING.getBaseSolverConfig();
    solverConfig.setPhaseConfigList(Collections.singletonList(chPhaseConfig));
    SolverFactory<FlightCrewSolution> solverFactory = SolverFactory.create(solverConfig);
    Solver<FlightCrewSolution> constructionSolver = solverFactory.buildSolver();
    FlightCrewSolution solution = Examples.FLIGHT_CREW_SCHEDULING.loadSolvingProblem(dataSet);
    return constructionSolver.solve(solution);
}
Also used : FlightCrewSolution(org.optaplanner.examples.flightcrewscheduling.domain.FlightCrewSolution) ConstructionHeuristicPhaseConfig(org.optaplanner.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig) 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