Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

occupation times to mito in minutes #231

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class ConstructionModelImpl extends AbstractModel implements Construction
private int currentYear = -1;



private float betaForZoneChoice;
private float priceIncreaseForNewDwelling;

Expand Down Expand Up @@ -110,6 +111,8 @@ public Collection<ConstructionEvent> 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()) {
Expand Down Expand Up @@ -150,11 +153,18 @@ public Collection<ConstructionEvent> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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:
Expand Down