Search in sources :

Example 1 with CustomPhaseConfig

use of org.optaplanner.core.config.phase.custom.CustomPhaseConfig 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 CustomPhaseConfig

use of org.optaplanner.core.config.phase.custom.CustomPhaseConfig 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 3 with CustomPhaseConfig

use of org.optaplanner.core.config.phase.custom.CustomPhaseConfig 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)

Example 4 with CustomPhaseConfig

use of org.optaplanner.core.config.phase.custom.CustomPhaseConfig 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 5 with CustomPhaseConfig

use of org.optaplanner.core.config.phase.custom.CustomPhaseConfig 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

CustomPhaseConfig (org.optaplanner.core.config.phase.custom.CustomPhaseConfig)6 SolverConfig (org.optaplanner.core.config.solver.SolverConfig)6 VehicleRoutingSolutionInitializer (org.jboss.qa.brms.performance.examples.vehiclerouting.solution.VehicleRoutingSolutionInitializer)3 VehicleRoutingSolution (org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution)3 CloudBalanceSolutionInitializer (org.jboss.qa.brms.performance.examples.cloudbalancing.solution.CloudBalanceSolutionInitializer)2 CloudBalance (org.optaplanner.examples.cloudbalancing.domain.CloudBalance)2 TSPSolutionInitializer (org.jboss.qa.brms.performance.examples.tsp.solution.TSPSolutionInitializer)1 TspSolution (org.optaplanner.examples.tsp.domain.TspSolution)1