コード例 #1
0
  // based on:
  // playground.wrashid.parkingSearch.withindayFW.controllers.kti.HUPCControllerKTIzh.getHouseHoldIncomeCantonZH
  public static DoubleValueHashMap<Id> getHouseHoldIncomeCantonZH(Population population) {
    DoubleValueHashMap<Id> houseHoldIncome = new DoubleValueHashMap<Id>();

    for (Id<Person> personId : population.getPersons().keySet()) {
      double rand = MatsimRandom.getRandom().nextDouble();
      if (rand < 0.032) {
        houseHoldIncome.put(personId, 1000 + MatsimRandom.getRandom().nextDouble() * 1000);
      } else if (rand < 0.206) {
        houseHoldIncome.put(personId, 2000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else if (rand < 0.471) {
        houseHoldIncome.put(personId, 4000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else if (rand < 0.674) {
        houseHoldIncome.put(personId, 6000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else if (rand < 0.803) {
        houseHoldIncome.put(personId, 8000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else if (rand < 0.885) {
        houseHoldIncome.put(personId, 10000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else if (rand < 0.927) {
        houseHoldIncome.put(personId, 12000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else if (rand < 0.952) {
        houseHoldIncome.put(personId, 14000 + MatsimRandom.getRandom().nextDouble() * 2000);
      } else {
        houseHoldIncome.put(personId, 16000 + MatsimRandom.getRandom().nextDouble() * 16000);
      }
    }

    return houseHoldIncome;
  }
  public static void main(String[] args) {
    String chargingLogFileNamePath =
        "H:/data/experiments/ARTEMIS/zh/dumb charging/output/run5/ITERS/it.0/0.chargingLog.txt";
    DoubleValueHashMap<String> energyConsumptionPerLink =
        EnergyConsumptionPerLink.readChargingLog(chargingLogFileNamePath);

    LinkedList<String> energyConsumptionHigherThresholdValue =
        energyConsumptionPerLink.getKeysWithHigherValueThanThresholdValue(2 * 100000000);
    System.out.println(
        "number of links with energy consumption higher than threshold: "
            + energyConsumptionHigherThresholdValue.size());
    GeneralLib.printLinkedListToConsole(energyConsumptionHigherThresholdValue);
  }