Search in sources :

Example 1 with VehicleRoutingSolution

use of org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution in project kie-benchmarks by kiegroup.

the class VRPMultithreadedSolvingScalabilityBenchmark method createInitialSolution.

@Override
protected VehicleRoutingSolution createInitialSolution() {
    CustomPhaseConfig customPhaseConfig = new CustomPhaseConfig();
    customPhaseConfig.setCustomPhaseCommandClassList(Collections.singletonList(VehicleRoutingSolutionInitializer.class));
    SolverConfig solverConfig = 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 2 with VehicleRoutingSolution

use of org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution in project kie-benchmarks by kiegroup.

the class AbstractVRPLocalSearchBenchmark method createSolver.

@Override
protected Solver<VehicleRoutingSolution> 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.VEHICLE_ROUTING.getBaseSolverConfig();
    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) UnionMoveSelectorConfig(org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSelectorConfig) SolverConfig(org.optaplanner.core.config.solver.SolverConfig)

Example 3 with VehicleRoutingSolution

use of org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution 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 4 with VehicleRoutingSolution

use of org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution 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 5 with VehicleRoutingSolution

use of org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution 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)

Aggregations

VehicleRoutingSolution (org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution)9 SolverConfig (org.optaplanner.core.config.solver.SolverConfig)7 VehicleRoutingSolutionInitializer (org.jboss.qa.brms.performance.examples.vehiclerouting.solution.VehicleRoutingSolutionInitializer)3 CustomPhaseConfig (org.optaplanner.core.config.phase.custom.CustomPhaseConfig)3 UnionMoveSelectorConfig (org.optaplanner.core.config.heuristic.selector.move.composite.UnionMoveSelectorConfig)2 LocalSearchPhaseConfig (org.optaplanner.core.config.localsearch.LocalSearchPhaseConfig)2 LocalSearchForagerConfig (org.optaplanner.core.config.localsearch.decider.forager.LocalSearchForagerConfig)2 HardVRPCalculateCountTermination (org.jboss.qa.brms.performance.examples.vehiclerouting.termination.HardVRPCalculateCountTermination)1 ConstructionHeuristicPhaseConfig (org.optaplanner.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig)1 ScoreDirectorFactoryConfig (org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig)1 TerminationConfig (org.optaplanner.core.config.solver.termination.TerminationConfig)1 InnerScoreDirector (org.optaplanner.core.impl.score.director.InnerScoreDirector)1 Customer (org.optaplanner.examples.vehiclerouting.domain.Customer)1 Standstill (org.optaplanner.examples.vehiclerouting.domain.Standstill)1 Vehicle (org.optaplanner.examples.vehiclerouting.domain.Vehicle)1