Ejemplo n.º 1
0
  private static void addDummyParking(LinkedList<PParking> parkings) {
    PublicParking parking = new PublicParking(new CoordImpl(100000000, 100000000));
    parking.setMaxCapacity(100000000000.0);
    parking.setParkingId(Id.create("backupParking", PParking.class));
    parking.setType("public");
    parkings.add(parking);

    parking = new PublicParking(new CoordImpl(100000000, 100000000));
    parking.setMaxCapacity(100000000000.0);
    parking.setParkingId(Id.create("gp-bkp", PParking.class));
    parking.setType("public");
    parkings.add(parking);
  }
Ejemplo n.º 2
0
  private static void addIllegalParking(Network network, LinkedList<PParking> parkings) {
    double shareOfLinksWithIllegalParking =
        ZHScenarioGlobal.loadDoubleParam("ParkingLoader.shareOfLinksWithIllegalParking");
    Coord coordinatesLindenhofZH = ParkingHerbieControler.getCoordinatesLindenhofZH();
    Random rand =
        new Random(
            19873); // fixing seed (scenarios with different simulation seeds should still have same
                    // illegal parking infrastructure)

    int i = 0;
    for (Link link : network.getLinks().values()) {
      if (GeneralLib.getDistance(coordinatesLindenhofZH, link.getCoord()) < 7000
          && rand.nextDouble() < shareOfLinksWithIllegalParking) {
        PublicParking parking = new PublicParking(link.getCoord());
        parking.setMaxCapacity(1.0);
        parking.setParkingId(Id.create("illegal-" + i, PParking.class));
        parking.setType("public");
        parkings.add(parking);
        i++;
      }
    }
    System.out.println("number of illegal parking added: " + i / 1000.0 + "k");
  }