Package jsprit.core.algorithm

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm.searchSolutions()


        VehicleRoutingProblem.Builder vrpBuilder_ = VehicleRoutingProblem.Builder.newInstance();
        new VrpJsonReader(vrpBuilder_).read("output/vpr.json");
        VehicleRoutingProblem vrp_ = vrpBuilder_.build();

        VehicleRoutingAlgorithm vra = new GreedySchrimpfFactory().createAlgorithm(vrp_);
        VehicleRoutingProblemSolution solutions = Solutions.bestOf(vra.searchSolutions());

        new VrpJsonWriter(vrp,solutions,new SolutionAnalyser.DistanceCalculator() {

            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
View Full Code Here


    @Test
    public void whenSettingPrematureBreak_itShouldReadTermination(){
        VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp,"src/test/resources/algorithmConfigForReaderTest2.xml");
        IterationCounter iCounter = new IterationCounter();
        vra.addListener(iCounter);
        vra.searchSolutions();
        Assert.assertEquals(100,iCounter.iterations);
    }

    @Test
    public void itShouldReadTermination(){
View Full Code Here

    @Test
    public void itShouldReadTermination(){
        VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp,"src/test/resources/algorithmConfigForReaderTest.xml");
        IterationCounter iCounter = new IterationCounter();
        vra.addListener(iCounter);
        vra.searchSolutions();
        Assert.assertEquals(25,iCounter.iterations);
    }


 
View Full Code Here

        VehicleRoutingAlgorithm vra = vraBuilder.build();
        vra.setNuOfIterations(500);

        try {
            Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
            VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
            assertEquals(828.94, solution.getCost(), 0.01);
            for(VehicleRoute route : solution.getRoutes()){
                Skills vehicleSkill = route.getVehicle().getSkills();
                for(Job job : route.getTourActivities().getJobs()){
View Full Code Here

        new VrpXMLReader(vrpBuilder).read("src/test/resources/solomon_c101.xml");
        VehicleRoutingProblem vrp = vrpBuilder.build();

        VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp,"src/test/resources/algorithmConfig.xml");
        vra.setNuOfIterations(500);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        assertEquals(828.94, Solutions.bestOf(solutions).getCost(),0.01);
    }

}
View Full Code Here

    vrpBuilder.setFleetSize(FleetSize.INFINITE);
    vrpBuilder.setRoutingCost(getTpCosts(new CrowFlyCosts(vrpBuilder.getLocations())));
    VehicleRoutingProblem vrp = vrpBuilder.build();
   
    VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/testConfig.xml");
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    VehicleRoutingProblemSolution sol = Solutions.bestOf(solutions);
    assertEquals(40.0,sol.getCost(),0.01);
    assertEquals(1, sol.getRoutes().size());
    VehicleRoute route = sol.getRoutes().iterator().next();
View Full Code Here

     
    });
    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

     
    });
    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

    });
    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

    });
    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

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.