Certain locations not being added to any route

I modified the MultipleDepotExample and ran it with my own dataset. However it appears that there are certain destinations that are not visited on any of the routes output by the program. This occurs despite the fact that I have excess capacity and more than enough depots/vehicles to visit all destinations.

How do I ensure that all destinations are assigned to a route? Please advise.

I extract the output in the following way:

` JSONArray routes = new JSONArray();

    for(VehicleRoute route : suggestedSolution.getRoutes()) {
        JSONObject routeJson = new JSONObject();
        String gardenerId = route.getVehicle().getId();
        routeJson.put("gardener_email", gardenerId.substring(0,gardenerId.length()-10));
        routeJson.put("weekday", Integer.parseInt(gardenerId.substring(gardenerId.length()-9,gardenerId.length()-8)));

        JSONArray scheduleArray = new JSONArray();

        for(TourActivity houseVisit : route.getActivities()) {
            JSONObject schedule = new JSONObject();
            schedule.put("id", houseVisit.getLocation().getId());
            scheduleArray.add(schedule);            
        }

        routeJson.put("schedule", scheduleArray);
        routes.add(routeJson);
        
    }`

Hi, From your code example I can hardly see the reason why jobs end up to be assigned. Please post your problem or a sub-problem so that I can reproduce it. Unassigned jobs can have several reasons such as tight constraints, e.g. time windows, operation time of driver, capacity of vehicle. Or you modified the objective function such that unassigned jobs are not penalyzed appropriately.

I did not modify the objective function and the input file follows exactly the format of the input_cordeau file.

The following is my code:

`
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();

    new VrpXMLReader(vrpBuilder).read(inputFilePath + inputFileName);        

    Scanner gardenerList = null;
    Scanner gardener = null;
    int nuOfVehicles = 1;   //Model each gardener as having 5 vehicles (1 for every day of the week)
    int capacity = 7;      //Max number of houses that can be visited by a single gardener
    int maxIterations = 2000;

    String weekOrDay = inputFileName.substring(inputFileName.length()-9 ,inputFileName.length()-4);

    if(weekOrDay.equals("Week1") || weekOrDay.equals("Week2")) {
        nuOfVehicles = 5;
    }

    try {
        gardenerList = new Scanner(new File(gardenerFilePath));
    } catch(FileNotFoundException fnfe) { 
        System.out.println(fnfe.getMessage());
    } 

    gardenerList.nextLine();    //Skip first line with coloum labels

    while (gardenerList.hasNextLine()) {
        gardener = new Scanner(gardenerList.nextLine());
        gardener.useDelimiter(",");

        Coordinate gardenerCoord = null;

        gardener.next();
        String data = gardener.next();
        String gardenerEmail = data;

        while(gardener.hasNext()) {
            if(data.charAt(0) == '-' || data.charAt(0) == '3') {  //temporarily hardcoded because not sure how to ignore commas in the adress when using java scanner csv reading technique
                Double x = Double.parseDouble(data);
                data = gardener.next();
                Double y = Double.parseDouble(data);

                gardenerCoord = Coordinate.newInstance(x,y);
                for (int i = 0; i < nuOfVehicles; i++) {
                    VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(new Random().nextInt(100) + "_type").addCapacityDimension(0, capacity).setCostPerDistance(1.0).build();
                    
                    String vehicleName = nameCurrentRoute(weekdayNumber, i, gardenerEmail);

                    VehicleImpl vehicle = VehicleImpl.Builder.newInstance(vehicleName).setStartLocation(Location.newInstance(gardenerCoord.getX(), gardenerCoord.getY())).setType(vehicleType).setLatestArrival(10.0).build();
                    vrpBuilder.addVehicle(vehicle);
                }
            } else {
                data = gardener.next();
            }
        }
    }

    gardenerList.close();

    vrpBuilder.setFleetSize(FleetSize.FINITE);

    VehicleRoutingProblem vrp = vrpBuilder.build();

    VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.THREADS, "5").buildAlgorithm();
    vra.getAlgorithmListeners().addListener(new StopWatch(), Priority.HIGH);
    vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener(progressOutputFilePath));
    vra.setMaxIterations(maxIterations);
    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

    VehicleRoutingProblemSolution suggestedSolution = Solutions.bestOf(solutions);`

Try to increase capacity sufficiently. Additionally, set vehicle latest
arrival to Double.MAX_VALUE or just omit it. Do you still have
unassigned jobs then?

I am going to check shortly and update.

I cannot increase capacity, though I do have more than enough vehicles to service the homes. It could also be because of the time windows I have set in the input xml file.

Every house has the following start and end:

Start: 0.0
End: 1.7976931348623157E308

What should I put instead, if my intention is to model that they can be picked up at any time of day?