Examples of VehicleRoutingAlgorithm


Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    final double[] results = new double[nOfRandomWalks];
   
    URL resource = Resource.getAsURL("randomWalk.xml");
    AlgorithmConfig algorithmConfig = new AlgorithmConfig();
    new AlgorithmConfigXmlReader(algorithmConfig).read(resource);
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(problem, algorithmConfig);
    vra.setMaxIterations(nOfRandomWalks);
    vra.getAlgorithmListeners().addListener(new IterationEndsListener() {
     
      @Override
      public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
        double result = Solutions.bestOf(solutions).getCost();
//        logger.info("result="+result);
        results[iteration-1] = result;
      }
     
    });
    vra.searchSolutions();
   
    StandardDeviation dev = new StandardDeviation();
    double standardDeviation = dev.evaluate(results);
    double initialThreshold = standardDeviation / 2;
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    final double[] results = new double[nOfRandomWalks];
   
    URL resource = Resource.getAsURL("randomWalk.xml");
    AlgorithmConfig algorithmConfig = new AlgorithmConfig();
    new AlgorithmConfigXmlReader(algorithmConfig).read(resource);
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(problem, algorithmConfig);
    vra.setNuOfIterations(nOfRandomWalks);
    vra.getAlgorithmListeners().addListener(new IterationEndsListener() {
     
      @Override
      public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
        double result = Solutions.bestOf(solutions).getCost();
//        logger.info("result="+result);
        results[iteration-1] = result;
      }
     
    });
    vra.searchSolutions();
   
    StandardDeviation dev = new StandardDeviation();
    double standardDeviation = dev.evaluate(results);
    initialThreshold = standardDeviation / 2;
   
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     */
    computationalLab.addAlgorithmFactory("schrimpfAcceptance", new VehicleRoutingAlgorithmFactory() {
     
      @Override
      public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
        VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
        vra.setMaxIterations(4000);
        return vra;
      }
    });
    /*
     * run schrimpfAcceptance 5 times (and thus each with another seed of random number generator)
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     * Define the required vehicle-routing algorithms to solve the above problem.
     *
     * The algorithm can be defined and configured in an xml-file.
     */
//    VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml");
        vra.setMaxIterations(20000);
//    vra.setPrematureBreak(100);
    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
    /*
     * Solve the problem.
     *
     *
     */
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
        constraintManager.addConstraint(new NoBananasANDApplesConstraint(stateManager), ConstraintManager.Priority.CRITICAL);
//        constraintManager.addConstraint(new BananasFirst(),ConstraintManager.Priority.CRITICAL);

        vraBuilder.setStateAndConstraintManager(stateManager,constraintManager);
        VehicleRoutingAlgorithm vra = vraBuilder.build();
//        vra.setNuOfIterations(100); //1.3.2-SNAPSHOT
//        vra.setMaxIterations(100);

        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

        SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);

        new GraphStreamViewer(vrp, Solutions.bestOf(solutions)).labelWith(GraphStreamViewer.Label.ID).setRenderShipments(true).display();
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     * Define the required vehicle-routing algorithms to solve the above problem.
     *
     * The algorithm can be defined and configured in an xml-file.
     */
//    VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml");
    vra.setMaxIterations(20000);
//    vra.setPrematureBreak(100);
    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
    /*
     * Solve the problem.
     *
     *
     */
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    /*
     * Define the required vehicle-routing algorithms to solve the above problem.
     *
     * The algorithm can be defined and configured in an xml-file.
     */
    VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);

    /*
     * Solve the problem.
     *
     *
     */
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     * Define the required vehicle-routing algorithms to solve the above problem.
     *
     * The algorithm can be defined and configured in an xml-file.
     */
//    VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml");
    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
    /*
     * Solve the problem.
     *
     *
     */
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

     * Define the required vehicle-routing algorithms to solve the above problem.
     *
     * The algorithm can be defined and configured in an xml-file.
     */
//    VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_open.xml");
    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
    /*
     * Solve the problem.
     *
     *
     */
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

   
    /*
     * Get schrimpf with threshold accepting
     * Note that Priority.LOW is a way to priorize AlgorithmListeners
     */
    VehicleRoutingAlgorithm vra_withThreshold = new SchrimpfFactory().createAlgorithm(vrp);
    vra_withThreshold.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/schrimpfThreshold_progress.png"), Priority.LOW);
    vra_withThreshold.getAlgorithmListeners().addListener(new StopWatch(), Priority.HIGH);
    /*
     * Get greedy schrimpf
     */
    VehicleRoutingAlgorithm vra_greedy = new GreedySchrimpfFactory().createAlgorithm(vrp);
    vra_greedy.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/schrimpfGreedy_progress.png"), Priority.LOW);
    vra_greedy.getAlgorithmListeners().addListener(new StopWatch(), Priority.HIGH);

    /*
     * run both
     */
    vra_withThreshold.searchSolutions();
   
    vra_greedy.searchSolutions()
    vra_greedy.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(40));
    vra_greedy.searchSolutions();
 
   
  }
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.