public void updateParkingOccupancy( Id parkingFacilityId, Double arrivalTime, Double departureTime, int parkingCapacity) { if (!parkingOccupancies.containsKey(parkingFacilityId)) { parkingOccupancies.put(parkingFacilityId, new ParkingOccupancyBins()); } ParkingOccupancyBins parkingOccupancyBins = parkingOccupancies.get(parkingFacilityId); parkingOccupancyBins.inrementParkingOccupancy(arrivalTime, departureTime); if (parkingOccupancyBins.isMaximumCapacityConstraintViolated(parkingCapacity)) { DebugLib.emptyFunctionForSettingBreakPoint(); setNumberOfMaximumParkingCapacitConstraintViolations( getNumberOfMaximumParkingCapacitConstraintViolations() + 1); // System.out.println(numberOfMaximumParkingCapacitConstraintViolations); } }
public void writeOutParkingOccupanciesTxt( Controler controler, IntegerValueHashMap<Id> facilityCapacities, int iteration) { String iterationFilename = controler.getControlerIO().getIterationFilename(iteration, "parkingOccupancy.txt"); ArrayList<String> list = new ArrayList<String>(); // create header line StringBuffer row = new StringBuffer("name\tcapacity"); for (int i = 0; i < 96; i++) { row.append("\t"); row.append("bin-" + i); } list.add(row.toString()); // content for (Id parkingFacilityId : parkingOccupancies.keySet()) { ParkingOccupancyBins parkingOccupancyBins = parkingOccupancies.get(parkingFacilityId); row = new StringBuffer(parkingFacilityId.toString()); row.append("\t"); row.append(facilityCapacities.get(parkingFacilityId)); for (int i = 0; i < 96; i++) { row.append("\t"); row.append(parkingOccupancyBins.getOccupancy(i * 900)); } list.add(row.toString()); } GeneralLib.writeList(list, iterationFilename); }