Package jsprit.core.algorithm.termination

Examples of jsprit.core.algorithm.termination.IterationWithoutImprovementTermination


        if(basedOn.equals("iterations")){
            log.info("set prematureBreak based on iterations");
            String iter = config.getString("iterations");
            if(iter == null) throw new IllegalStateException("iterations is missing");
            int iterations = Integer.valueOf(iter);
            return new IterationWithoutImprovementTermination(iterations);
        }
        if(basedOn.equals("time")){
            log.info("set prematureBreak based on time");
            String timeString = config.getString("time");
            if(timeString == null) throw new IllegalStateException("time is missing");
View Full Code Here


    if(basedOn.equals("iterations")){
      log.info("set prematureBreak based on iterations");
      String iter = config.getString("prematureBreak.iterations");
      if(iter == null) throw new IllegalStateException("prematureBreak.iterations is missing");
      int iterations = Integer.valueOf(iter);
      return new IterationWithoutImprovementTermination(iterations);
    }
    if(basedOn.equals("time")){
      log.info("set prematureBreak based on time");
      String timeString = config.getString("prematureBreak.time");
      if(timeString == null) throw new IllegalStateException("prematureBreak.time is missing");
View Full Code Here

        constraintManager.addConstraint(geoClusterConstraint);

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

    algorithm.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
//    algorithm.setNuOfIterations(30000);
    /*
     * and search a solution
     */
    Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
View Full Code Here

     * run both
     */
    vra_withThreshold.searchSolutions();
   
    vra_greedy.searchSolutions()
    vra_greedy.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(40));
    vra_greedy.searchSolutions();
 
   
  }
View Full Code Here

    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

    vra.setMaxIterations(1000);
   
    /*
     * optionally define a premature termination criterion (by default: not criterion is set)
     */
    vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
   
    return vra;
  }
View Full Code Here

        readDistances(matrixBuilder);

        vrpBuilder.setRoutingCost(matrixBuilder.build());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
    vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    SolutionPrinter.print(vrp, Solutions.bestOf(solutions), Print.VERBOSE);
   
    assertEquals(397.0,Solutions.bestOf(solutions).getCost(),40.);
View Full Code Here

        readDistances(matrixBuilder);

        vrpBuilder.setRoutingCost(matrixBuilder.build());
        VehicleRoutingProblem vrp = vrpBuilder.build();
        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

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

        assertEquals(397.0,Solutions.bestOf(solutions).getCost(),40.);
View Full Code Here

        readDistances(matrixBuilder);

        vrpBuilder.setRoutingCost(matrixBuilder.build());
        VehicleRoutingProblem vrp = vrpBuilder.build();
        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

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

        assertEquals(397.0,Solutions.bestOf(solutions).getCost(),40.);
View Full Code Here

    }
   
    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(vrp, Solutions.bestOf(solutions), Print.VERBOSE);
   
    assertEquals(2.*397.+397.,Solutions.bestOf(solutions).getCost(),0.01);
 
View Full Code Here

TOP

Related Classes of jsprit.core.algorithm.termination.IterationWithoutImprovementTermination

Copyright © 2018 www.massapicom. 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.