From 3ed579a5446397db5360bccf625b6698c120e735 Mon Sep 17 00:00:00 2001 From: Nico Date: Tue, 24 Sep 2019 11:13:52 +0200 Subject: [PATCH] fix for unrealized demand, send job and school times in minutes to mito --- .../construction/ConstructionModelImpl.java | 14 ++++++++++++-- .../bgu/msm/data/mito/MitoDataConverterMuc.java | 6 ++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/siloCore/src/main/java/de/tum/bgu/msm/models/realEstate/construction/ConstructionModelImpl.java b/siloCore/src/main/java/de/tum/bgu/msm/models/realEstate/construction/ConstructionModelImpl.java index 4bbb9ad9a..b0e04bf74 100644 --- a/siloCore/src/main/java/de/tum/bgu/msm/models/realEstate/construction/ConstructionModelImpl.java +++ b/siloCore/src/main/java/de/tum/bgu/msm/models/realEstate/construction/ConstructionModelImpl.java @@ -39,6 +39,7 @@ public class ConstructionModelImpl extends AbstractModel implements Construction private int currentYear = -1; + private float betaForZoneChoice; private float priceIncreaseForNewDwelling; @@ -110,6 +111,8 @@ public Collection getEventsForCurrentYear(int year) { } DwellingType[] sortedDwellingTypes = findOrderOfDwellingTypes(dataContainer); + int unrealizedDemandCounter = 0; + for (DwellingType dt : sortedDwellingTypes) { int dto = dwellingTypes.indexOf(dt); for (int region : geoData.getRegions().keySet()) { @@ -150,11 +153,18 @@ public Collection getEventsForCurrentYear(int year) { for (int i = 1; i <= unrealizedDwellings; i++) { int zone = allocateUnrealizedDemandInDifferentRegion(realEstate, dt, dto, avePriceByTypeAndZone, avePriceByTypeAndRegion, utilitiesByDwellingTypeByZone); - events.add(createNewDwelling(realEstate, aveSizeByTypeAndRegion, avePriceByTypeAndZone, - avePriceByTypeAndRegion, dt, dto, region, zone)); + + if(zone > -1) { + events.add(createNewDwelling(realEstate, aveSizeByTypeAndRegion, avePriceByTypeAndZone, + avePriceByTypeAndRegion, dt, dto, region, zone)); + } else { + unrealizedDemandCounter++; + } } } } + logger.warn("There have been " + unrealizedDemandCounter + " dwellings that could not be built " + + "due to lack of developable land."); return events; } diff --git a/useCases/munich/src/main/java/de/tum/bgu/msm/data/mito/MitoDataConverterMuc.java b/useCases/munich/src/main/java/de/tum/bgu/msm/data/mito/MitoDataConverterMuc.java index d285fe514..4aa042adc 100644 --- a/useCases/munich/src/main/java/de/tum/bgu/msm/data/mito/MitoDataConverterMuc.java +++ b/useCases/munich/src/main/java/de/tum/bgu/msm/data/mito/MitoDataConverterMuc.java @@ -56,6 +56,8 @@ private void convertSchools(DataSet dataSet, DataContainer dataContainer) { coordinate = zone.getRandomCoord(); } MitoSchool mitoSchool = new MitoSchool(zones.get(school.getZoneId()), coordinate, school.getId()); + mitoSchool.setStartTime_min((int) (school.getStartTimeInSeconds() / 60.)); + mitoSchool.setEndTime_min((int) ((school.getStartTimeInSeconds() + school.getStudyTimeInSeconds()) / 60.)); zone.addSchoolEnrollment(school.getOccupancy()); dataSet.addSchool(mitoSchool); } @@ -127,8 +129,8 @@ private MitoPerson convertToMitoPp(PersonMuc person, DataSet dataSet, DataContai coordinate = zone.getRandomCoord(); } mitoOccupation = new MitoJob(zone, coordinate, job.getId()); - mitoOccupation.setStartTime(job.getStartTimeInSeconds()); - mitoOccupation.setEndTime(job.getStartTimeInSeconds() + job.getWorkingTimeInSeconds()); + mitoOccupation.setStartTime_min((int) (job.getStartTimeInSeconds() / 60.)); + mitoOccupation.setEndTime_min((int) ((job.getStartTimeInSeconds() + job.getWorkingTimeInSeconds()) / 60.)); } break; case UNEMPLOYED: