ImmutableList<Double> costs = decomposedCost(state, schedule, objFunc); final ImmutableSet<Parcel> newParcels = GlobalStateObjects.unassignedParcels(state);
@Override public ImmutableList<ImmutableList<Parcel>> solve(GlobalStateObject state) throws InterruptedException { final List<List<Parcel>> mutSchedule = new ArrayList<>(state.getVehicles().size()); for (final VehicleStateObject vso : state.getVehicles()) { mutSchedule.add(new ArrayList<>(vso.getRoute().get())); } final Set<Parcel> unscheduled = GlobalStateObjects.unassignedParcels(state); for (final Parcel p : unscheduled) { int index = 0; int minJobs = mutSchedule.get(0).size(); for (int i = 1; i < mutSchedule.size(); i++) { final int jobs = mutSchedule.get(i).size(); if (jobs < minJobs) { index = i; minJobs = jobs; } } mutSchedule.get(index).add(0, p); mutSchedule.get(index).add(0, p); } final ImmutableList.Builder<ImmutableList<Parcel>> schedule = ImmutableList.builder(); for (final List<Parcel> row : mutSchedule) { schedule.add(ImmutableList.copyOf(row)); } return schedule.build(); }
GlobalStateObjects.unassignedParcels(state); route.addAll(unassigned); route.addAll(unassigned);