Examples of VehicleRoutingAlgorithm


Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    VehicleRoutingProblem problem = vrpBuilder.build();
   
    /*
     * get the algorithm out-of-the-box.
     */
    VehicleRoutingAlgorithm algorithm = new SchrimpfFactory().createAlgorithm(problem);
   
    /*
     * and search a solution
     */
    Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
   
    /*
     * get the best
     */
    VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    vrpBuilder.setFleetSize(FleetSize.FINITE);
   
    //build problem
    VehicleRoutingProblem vrp = vrpBuilder.build();
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
   
    SolutionPrinter.print(vrp, best, SolutionPrinter.Print.VERBOSE);
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    double[] vehicles = new double[runs];
    double[] results = new double[runs];
    double[] times = new double[runs];
   
    for(int run=0;run<runs;run++){
      VehicleRoutingAlgorithm vra = createAlgorithm(p);
      StopWatch stopwatch = new StopWatch();
      vra.getAlgorithmListeners().addListener(stopwatch,Priority.HIGH);
      Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
      VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
      vehicles[run] = best.getRoutes().size();
      results[run] = cost.getCost(best);
      times[run] = stopwatch.getCompTimeInSeconds();
    }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    this.threads = threads;
  }

  private void runAlgorithm(BenchmarkInstance p, Algorithm algorithm, int run) {
    System.out.println("[algorithm=" + algorithm.name + "][instance="+p.name+"][run="+run+"][status=start]");
    VehicleRoutingAlgorithm vra = algorithm.factory.createAlgorithm(p.vrp);
    informCalculationStarts(p, algorithm.name, vra, run);
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
    System.out.println("[algorithm=" + algorithm.name + "][instance="+p.name+"][run="+run+"][status=finished]");
    informCalculationsEnds(p, algorithm.name, vra, run, solutions);
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    vrpBuilder.setRoutingCost(matrixBuilder.build());
   
    VehicleRoutingProblem vrp = vrpBuilder.build();
   
    VehicleRoutingAlgorithm vra = new GreedySchrimpfFactory().createAlgorithm(vrp);
    vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    SolutionPrinter.print(Solutions.bestOf(solutions));
   
    new VrpXMLWriter(vrp, solutions).write("output/refuseCollectionExampleSolution.xml");
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

//    SolutionPlotter.plotVrpAsPNG(vrp, "output/problem08.png", "p08");

    /*
     * solve the problem
     */
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml");
    vra.setMaxIterations(10000);
        vra.getAlgorithmListeners().addListener(new StopWatch(),Priority.HIGH);
//    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    SolutionPrinter.print(vrp, Solutions.bestOf(solutions), jsprit.core.reporting.SolutionPrinter.Print.VERBOSE);

    new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/p08_solution.png", "p08");
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    VehicleRoutingProblem problem = vrpBuilder.build();
   
    /*
     * get the algorithm out-of-the-box.
     */
    VehicleRoutingAlgorithm algorithm = new SchrimpfFactory().createAlgorithm(problem);
   
    /*
     * and search a solution
     */
    Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
   
    /*
     * get the best
     */
    VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    VehicleRoutingTransportCosts costMatrix = costMatrixBuilder.build();
   
    VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().setFleetSize(FleetSize.INFINITE).setRoutingCost(costMatrix)
        .addVehicle(vehicle).addJob(s1).addJob(s2).addJob(s3).build();
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/fastAlgo.xml");
   
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    SolutionPrinter.print(Solutions.bestOf(solutions));
   
    new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/yo.png", "po");
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        ConstraintManager constraintManager = new ConstraintManager(problem,stateManager);
        constraintManager.addSkillsConstraint();

        vraBuilder.setStateAndConstraintManager(stateManager,constraintManager);

    VehicleRoutingAlgorithm algorithm = vraBuilder.build();
   
    /*
     * and search a solution
     */
    Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
   
    /*
     * get the best
     */
    VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        StateManager stateManager = new StateManager(vrp);
        ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
        constraintManager.addConstraint(new ServiceDeliveriesFirstConstraint(), ConstraintManager.Priority.CRITICAL);

        vraBuilder.setStateAndConstraintManager(stateManager,constraintManager);
        VehicleRoutingAlgorithm vra = vraBuilder.build();



    /*
     * Solve the problem.
     *
     *
     */
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.