public Plan generatePlan(Vehicle vehicle) { int vehicleId = vehicle.id(); City current = vehicle.getCurrentCity(); Plan p = new Plan(current); List<ExtendedTask> tasks = solution.get(vehicleId); City intermediateCity = current; for (ExtendedTask t : tasks) { City nextDestination = t.isPickup() ? t.getT().pickupCity : t.getT().deliveryCity; for (City c : intermediateCity.pathTo(nextDestination)) { p.appendMove(c); } if (t.isPickup()) p.appendPickup(t.getT()); else p.appendDelivery(t.getT()); intermediateCity = nextDestination; } return p; }
private Plan BFSPlan(Vehicle vehicle, TaskSet tasks) { City current = vehicle.getCurrentCity(); Plan plan = new Plan(current); System.out.println("Compute BFS for vehicle :" + vehicle.id()); System.out.println(tasks.toString()); // Initialize states State initialState = computeInitialState(vehicle, tasks); List<State> finalStates = computeFinalStates(vehicle, tasks); // Build the tree return plan; }
private Plan naivePlan(Vehicle vehicle, TaskSet tasks) { City current = vehicle.getCurrentCity(); Plan plan = new Plan(current); System.out.println("Compute naivePlan for vehicle :" + vehicle.id()); System.out.println(tasks.toString()); for (Task task : tasks) { // move: current city => pickup location for (City city : current.pathTo(task.pickupCity)) plan.appendMove(city); plan.appendPickup(task); // move: pickup location => delivery location for (City city : task.path()) plan.appendMove(city); plan.appendDelivery(task); // set current city current = task.deliveryCity; } return plan; }