Examples of VehicleRoutingAlgorithm


Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

      }
     
    });
    VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    assertEquals(20.0+30.0,Solutions.bestOf(solutions).getCost(),0.1);
   
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

      }
     
    });
    VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    assertEquals(0.0,Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
   
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     
    });
    VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
   
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    assertEquals(20.0,Solutions.bestOf(solutions).getCost(),0.1);
   
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     
    });
    VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
   
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    assertEquals(30.0,Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
   
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     
    });
    VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addJob(service2).addVehicle(vehicle).build();
   
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    assertEquals(40.0,Solutions.bestOf(solutions).getCost(),0.1);
   
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     
    });
    VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addJob(service2).addVehicle(vehicle).build();
   
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    assertEquals(10.0,Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
   
 
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

  private static VehicleRoutingAlgorithmFactory getAlgorithmFactory(final int iterations) {
    return new VehicleRoutingAlgorithmFactory() {
     
      @Override
      public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
        VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
        vra.setMaxIterations(iterations);
        return vra;
      }
    };
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        vraBuilder.addDefaultCostCalculators();
        StateManager stateManager = new StateManager(problem);
        ConstraintManager constraintManager = new ConstraintManager(problem,stateManager);
        constraintManager.addConstraint(new ServiceDeliveriesFirstConstraint(), ConstraintManager.Priority.CRITICAL);
        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

//    SolutionPlotter.plotVrpAsPNG(vrp, "output/problem01.png", "p01");

    /*
     * solve the problem
     */
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
    vra.getAlgorithmListeners().addListener(new StopWatch(),Priority.HIGH);
    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    SolutionPrinter.print(Solutions.bestOf(solutions));
   
    new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/p01_solution.png", "p01");
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    VehicleRoutingAlgorithmBuilder algorithmBuilder = new VehicleRoutingAlgorithmBuilder(problem, "input/algorithmConfig_noVehicleSwitch.xml");
    algorithmBuilder.setStateAndConstraintManager(stateManager, constraintManager);
    algorithmBuilder.addCoreConstraints();
    algorithmBuilder.addDefaultCostCalculators();
   
    VehicleRoutingAlgorithm algorithm = algorithmBuilder.build();
    algorithm.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));

    /*
     * and search a solution
     */
    Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
   
    /*
     * get the best
     */
    VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(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.