Examples of VehicleRoutingAlgorithm


Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        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

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    vrp = vrpBuilder.build();
  }

    @Test
    public void itShouldReadMaxIterations(){
        VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp,"src/test/resources/algorithmConfigForReaderTest.xml");
        Assert.assertEquals(2000,vra.getMaxIterations());
    }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    }

    @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);
    }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        Assert.assertEquals(100,iCounter.iterations);
    }

    @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

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    assertTrue(true);
  }
 
  @Test
  public void whenCreatingAlgorithm_nOfStrategiesIsCorrect(){
    VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
    assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
  }

  @Test
  public void whenCreatingAlgorithm_nOfIterationsIsReadCorrectly(){
    VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
    assertEquals(10, algo.getNuOfIterations());
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    assertEquals(10, algo.getNuOfIterations());
  }
 
  @Test
  public void whenCreatingAlgorithm_nOfStrategyModulesIsCorrect(){
    VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
    int nOfModules = 0;
    for(SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()){
      nOfModules += strat.getSearchStrategyModules().size();
    }
    assertEquals(3, nOfModules);
  }
View Full Code Here

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

        stateManager.updateSkillStates();

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

        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

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    public void itShouldFindTheBestKnownSolution(){
        VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
        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

Examples of jsprit.core.algorithm.VehicleRoutingAlgorithm

    vrpBuilder.addJob(Service.Builder.newInstance("myService").addSizeDimension(0, 2).setLocationId("0,20").setCoord(Coordinate.newInstance(0, 20)).build());
    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
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.