コード例 #1
0
 protected NOSRankTaxiOptimizer(
     TaxiOptimizerContext optimConfig, IdleRankVehicleFinder vehicleFinder) {
   super(optimConfig);
   this.optimConfig = optimConfig;
   this.idleVehicleFinder = vehicleFinder;
   this.rankModeTaxiScheduler = (RankModeTaxiScheduler) optimConfig.scheduler;
   rankModeTaxiScheduler.optimizer = this;
 }
コード例 #2
0
  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);
          }
        }
      }
    }
  }
コード例 #3
0
  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.");
  }
コード例 #4
0
  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);
          }
        }
      }
    }
  }