Examples of VehicleRoutingProblemSolution


Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

    public void unassignedJobShouldBeRead(){
        VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
        ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
        new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpWithShipmentsAndSolution.xml");

        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
        assertEquals(1,solution.getUnassignedJobs().size());
        assertEquals("4",solution.getUnassignedJobs().iterator().next().getId());
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

   
    vra = new VehicleRoutingAlgorithm(vrp, strategyManager);
    vra.addListener(stateManager);
    vra.addListener(new RemoveEmptyVehicles(fleetManager));
 
    VehicleRoutingProblemSolution iniSolution = new InsertionInitialSolutionFactory(bestInsertion, solutionCostCalculator).createSolution(vrp);

    vra.addInitialSolution(iniSolution);
   
    vra.setMaxIterations(2000);
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

public class AcceptNewRemoveWorstTest {
 
  @Test
  public void whenHavingNewSolAndLimitedMemory_removeWorstAndAddNew(){
   
    VehicleRoutingProblemSolution sol1 = mock(VehicleRoutingProblemSolution.class);
    VehicleRoutingProblemSolution sol2 = mock(VehicleRoutingProblemSolution.class);
    when(sol1.getCost()).thenReturn(1.0);
    when(sol2.getCost()).thenReturn(2.0);
   
    List<VehicleRoutingProblemSolution> solList = new ArrayList<VehicleRoutingProblemSolution>();
    solList.add(sol1);
    solList.add(sol2);
   
    VehicleRoutingProblemSolution sol3 = mock(VehicleRoutingProblemSolution.class);
   
    new GreedyAcceptance(2).acceptSolution(solList, sol3);
   
    assertEquals(2,solList.size());
    assertThat(sol3,is(solList.get(1)));
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

        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()){
                    for(String skill : job.getRequiredSkills().values()){
                        if(!vehicleSkill.containsSkill(skill)){
                            assertFalse(true);
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

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

        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);

        SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);

        assertEquals(2,solution.getRoutes().iterator().next().getTourActivities().getJobs().size());
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

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

        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);

        SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);

        int jobsInSolution = 0;
        for(VehicleRoute r : solution.getRoutes()){
            jobsInSolution += r.getTourActivities().jobSize();
        }
        assertEquals(4,jobsInSolution);
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

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

        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);

        SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);

        assertEquals(2, solution.getRoutes().iterator().next().getActivities().size());
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

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

        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);

        int nuActs = 0;
        for(VehicleRoute r : solution.getRoutes()){
            nuActs += r.getActivities().size();
        }
        assertEquals(6, nuActs);
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

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

        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);

        assertTrue(hasActivityIn(solution.getRoutes().iterator().next(),"1"));
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

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

        VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
        Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);

        assertTrue(hasActivityIn(solution.getRoutes(),"1"));
        assertTrue(hasActivityIn(solution.getRoutes(),"2"));
        assertTrue(hasActivityIn(solution.getRoutes(),"3"));
        assertTrue(hasActivityIn(solution.getRoutes(),"4"));
    }
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.