Examples of VehicleRoutingProblemSolution


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(), "2"));
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

        VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();

        VehicleRoute route = VehicleRoute.Builder.newInstance(v1).addService(s1).addService(s2).build();
        List<VehicleRoute> routes = new ArrayList<VehicleRoute>();
        routes.add(route);
        VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(routes,10.);
        List<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
        solutions.add(solution);

        new VrpXMLWriter(vrp, solutions).write(infileName);
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

        assertFalse(secondActIsPickup(solutions));

    }

    private boolean secondActIsPickup(Collection<VehicleRoutingProblemSolution> solutions) {
        VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
        TourActivity secondAct = solution.getRoutes().iterator().next().getActivities().get(1);
        return secondAct instanceof PickupShipment;
    }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

        VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();

        VehicleRoute route = VehicleRoute.Builder.newInstance(v1).addService(s1).build();
        List<VehicleRoute> routes = new ArrayList<VehicleRoute>();
        routes.add(route);
        VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(routes,10.);
        solution.getUnassignedJobs().add(s2);
        List<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
        solutions.add(solution);

        new VrpXMLWriter(vrp, solutions).write(infileName);
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

        /*
        create ini sol
         */
        VehicleRoute route1 = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(vrp.getJobActivityFactory()).addService(s1).build();

        vra.addInitialSolution(new VehicleRoutingProblemSolution(Arrays.asList(route1),20.));

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

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

View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

    SolutionSelector select = mock(SolutionSelector.class);
    SolutionAcceptor accept = mock(SolutionAcceptor.class);
    SolutionCostCalculator calc = mock(SolutionCostCalculator.class);
   
    final VehicleRoutingProblem vrp = mock(VehicleRoutingProblem.class);
    final VehicleRoutingProblemSolution newSol = mock(VehicleRoutingProblemSolution.class);
   
    when(select.selectSolution(null)).thenReturn(newSol);
   
    final Collection<Integer> runs = new ArrayList<Integer>();
   
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

    SolutionSelector select = mock(SolutionSelector.class);
    SolutionAcceptor accept = mock(SolutionAcceptor.class);
    SolutionCostCalculator calc = mock(SolutionCostCalculator.class);
   
    final VehicleRoutingProblem vrp = mock(VehicleRoutingProblem.class);
    final VehicleRoutingProblemSolution newSol = mock(VehicleRoutingProblemSolution.class);
   
    when(select.selectSolution(null)).thenReturn(newSol);
   
    final Collection<Integer> runs = new ArrayList<Integer>();
   
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

    SolutionSelector select = mock(SolutionSelector.class);
    SolutionAcceptor accept = mock(SolutionAcceptor.class);
    SolutionCostCalculator calc = mock(SolutionCostCalculator.class);
   
    final VehicleRoutingProblem vrp = mock(VehicleRoutingProblem.class);
    final VehicleRoutingProblemSolution newSol = mock(VehicleRoutingProblemSolution.class);
   
    when(select.selectSolution(null)).thenReturn(newSol);
   
    int N = new Random().nextInt(1000);
   
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

            else throw new IllegalStateException("type " + type + " is not supported. Use 'pickupShipment' or 'deliverShipment' here");
         
        }
        routes.add(routeBuilder.build());
      }
            VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(routes, cost);
            List<HierarchicalConfiguration> unassignedJobConfigs = solutionConfig.configurationsAt("unassignedJobs.job");
            for(HierarchicalConfiguration unassignedJobConfig : unassignedJobConfigs){
                String jobId = unassignedJobConfig.getString("[@id]");
                Job job = getShipment(jobId);
                if(job == null) job = getService(jobId);
                if(job == null) throw new IllegalStateException("cannot find unassignedJob with id " + jobId);
                solution.getUnassignedJobs().add(job);
            }

      solutions.add(solution);
    }
  }
View Full Code Here

Examples of jsprit.core.problem.solution.VehicleRoutingProblemSolution

    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();
    assertEquals(50.0,route.getStart().getEndTime(),0.01);
  }
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.