public void sendIdlingTaxisBackToRank(double time) { for (Vehicle veh : optimConfig.context.getVrpData().getVehicles().values()) { if (!optimConfig.scheduler.isIdle(veh)) continue; if (veh.getSchedule().getStatus() != ScheduleStatus.STARTED) continue; if (!(Schedules.getLastTask(veh.getSchedule()).getTaskIdx() == veh.getSchedule().getCurrentTask().getTaskIdx())) continue; if (veh.getSchedule().getCurrentTask().getType().equals(TaskType.STAY)) { TaxiStayTask twst = (TaxiStayTask) veh.getSchedule().getCurrentTask(); if (!this.rankHandler.isRankLocation(twst.getLink().getId())) { if (time - twst.getBeginTime() > 60.) { rankModeTaxiScheduler.scheduleRankReturn(veh, time, false, false); } } } } }
private void sendIdlingTaxisHome(double time) { int homeboundthishour = 0; for (Vehicle veh : optimConfig.context.getVrpData().getVehicles().values()) { if (time + 3600 < veh.getT1()) continue; if (!optimConfig.scheduler.isIdle(veh)) continue; if (veh.getSchedule().getStatus() != ScheduleStatus.STARTED) continue; if (!(Schedules.getLastTask(veh.getSchedule()).getTaskIdx() == veh.getSchedule().getCurrentTask().getTaskIdx())) continue; if (veh.getSchedule().getCurrentTask().getType().equals(TaskType.STAY)) { rankModeTaxiScheduler.scheduleRankReturn(veh, time, false, true); homeboundthishour++; } } log.info( time % 3600 + " hrs: " + homeboundthishour + " sent home" + this.homebound + " total."); }
private void checkWaitingVehiclesBatteryState(double time) { for (Vehicle veh : optimConfig.context.getVrpData().getVehicles().values()) { if (!optimConfig.scheduler.isIdle(veh)) continue; if (veh.getSchedule().getStatus() != ScheduleStatus.STARTED) continue; if (!(Schedules.getLastTask(veh.getSchedule()).getTaskIdx() == veh.getSchedule().getCurrentTask().getTaskIdx())) continue; if (veh.getSchedule().getCurrentTask().getType().equals(TaskType.STAY)) { TaxiStayTask twst = (TaxiStayTask) veh.getSchedule().getCurrentTask(); if (!this.ecabhandler.isAtCharger(twst.getLink().getId())) { if (this.needsToCharge(veh.getId())) { log.info("veh" + veh.getId() + " to charge"); rankModeTaxiScheduler.scheduleRankReturn(veh, time, true, false); } } } } }