Search in sources :

Example 16 with TerminationConfig

use of org.optaplanner.core.config.solver.termination.TerminationConfig in project droolsjbpm-integration by kiegroup.

the class AbstractTaskAssigningCoreTest method createNonDaemonSolver.

protected Solver<TaskAssigningSolution> createNonDaemonSolver(int stepCountLimit) {
    SolverConfig config = createBaseConfig();
    ConstructionHeuristicPhaseConfig constructionHeuristicPhaseConfig = new ConstructionHeuristicPhaseConfig();
    constructionHeuristicPhaseConfig.setConstructionHeuristicType(ConstructionHeuristicType.FIRST_FIT);
    LocalSearchPhaseConfig phaseConfig = new LocalSearchPhaseConfig();
    phaseConfig.setTerminationConfig(new TerminationConfig().withStepCountLimit(stepCountLimit));
    config.setPhaseConfigList(Arrays.asList(constructionHeuristicPhaseConfig, phaseConfig));
    SolverFactory<TaskAssigningSolution> solverFactory = SolverFactory.create(config);
    return solverFactory.buildSolver();
}
Also used : TerminationConfig(org.optaplanner.core.config.solver.termination.TerminationConfig) TaskAssigningSolution(org.kie.server.services.taskassigning.core.model.TaskAssigningSolution) LocalSearchPhaseConfig(org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig) ConstructionHeuristicPhaseConfig(org.optaplanner.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 17 with TerminationConfig

use of org.optaplanner.core.config.solver.termination.TerminationConfig 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 18 with TerminationConfig

use of org.optaplanner.core.config.solver.termination.TerminationConfig 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 19 with TerminationConfig

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

the class CloudBalancingMultithreadedSolvingScalabilityBenchmark method getTerminationConfig.

@Override
protected TerminationConfig getTerminationConfig() {
    TerminationConfig terminationConfig = new TerminationConfig();
    terminationConfig.setStepCountLimit(500);
    return terminationConfig;
}
Also used : TerminationConfig(org.optaplanner.core.config.solver.termination.TerminationConfig)

Example 20 with TerminationConfig

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

the class AbstractProjectJobSchedulingMoveSelectorBenchmark method getTerminationConfig.

@Override
public TerminationConfig getTerminationConfig() {
    TerminationConfig terminationConfig = new TerminationConfig();
    terminationConfig.setTerminationClass(ProjectJobSchedulingCalculateCountTermination.class);
    return terminationConfig;
}
Also used : TerminationConfig(org.optaplanner.core.config.solver.termination.TerminationConfig)

Aggregations

TerminationConfig (org.optaplanner.core.config.solver.termination.TerminationConfig)32 SolverConfig (org.optaplanner.core.config.solver.SolverConfig)17 CounterfactualPrediction (org.kie.kogito.explainability.model.CounterfactualPrediction)10 Prediction (org.kie.kogito.explainability.model.Prediction)10 PredictionInput (org.kie.kogito.explainability.model.PredictionInput)10 PredictionOutput (org.kie.kogito.explainability.model.PredictionOutput)10 Feature (org.kie.kogito.explainability.model.Feature)9 Output (org.kie.kogito.explainability.model.Output)9 PredictionProvider (org.kie.kogito.explainability.model.PredictionProvider)9 LinkedList (java.util.LinkedList)7 Test (org.junit.jupiter.api.Test)7 CounterfactualEntity (org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity)6 Value (org.kie.kogito.explainability.model.Value)6 CounterfactualConfig (org.kie.kogito.explainability.local.counterfactual.CounterfactualConfig)5 CounterfactualExplainer (org.kie.kogito.explainability.local.counterfactual.CounterfactualExplainer)5 CounterfactualResult (org.kie.kogito.explainability.local.counterfactual.CounterfactualResult)5 LocalSearchPhaseConfig (org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig)5 Random (java.util.Random)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 ScoreDirectorFactoryConfig (org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig)4