@Override protected void scheduleUnplannedRequests() { Set<TaxibusRequest> handledRequests = new HashSet<>(); for (TaxibusRequest req : unplannedRequests) { TaxibusLine line = dispatcher.findLineForRequest(req); if (line == null) { log.error("rejecting reqeuest" + req.getId() + " f " + req.getPassenger()); req.setRejected(true); handledRequests.add(req); continue; } if (this.optimContext.timer.getTimeOfDay() > req.getT0() - 3600) { TaxibusDispatch requestPath = this.currentRequestPathForLine.get(line.getId()); if (requestPath == null) { Vehicle veh = line.getNextEmptyVehicle(); if (veh == null) break; VrpPathWithTravelData path = calculateVrpPath(veh, req); requestPath = new TaxibusDispatch(veh, req, path); this.currentRequestPathForLine.put(line.getId(), requestPath); double twmax = Math.max(req.getT0(), path.getArrivalTime()) + line.getCurrentTwMax(); this.currentTwMax.put(line.getId(), twmax); } else { double departureTime = requestPath.getEarliestNextDeparture(); VrpPathWithTravelData path = calculateFromPickupToPickup(requestPath.getLastPathAdded(), req, departureTime); requestPath.addRequestAndPath(req, path); } handledRequests.add(req); if (line.getCurrentOccupationRate() == requestPath.requests.size()) { fillPathWithDropOffsAndSchedule(requestPath, line.getId()); this.currentRequestPathForLine.put(line.getId(), null); this.currentTwMax.put(line.getId(), null); } } } unplannedRequests.removeAll(handledRequests); }