Remove incorrect config file generation

This commit is contained in:
Ruben1729 2024-02-08 17:13:54 -05:00
parent 6ecba6d5dd
commit f691449d42

View File

@ -207,63 +207,9 @@ class Matsim:
with gzip.open(output_file + '.gz', 'wb') as f_out: with gzip.open(output_file + '.gz', 'wb') as f_out:
shutil.copyfileobj(f_in, f_out) shutil.copyfileobj(f_in, f_out)
# TODO: Reimplement this after figuring out what's wrong with other files
def _export_config(self): def _export_config(self):
parameterset = [] pass
for facility in self._facilities['facility']:
if facility['activity'][0]['@type'] == cte.RESIDENTIAL:
parameterset.append({'@type':'activityParams', 'param': [
{'@name':'activityType','@value':facility['activity'][0]['@type']},
{'@name':'typicalDuration', '@value' : '12:00:00'},
{'@name':'priority','@value': '1'}
]})
else:
parameterset.append({'@type':'activityParams', 'param': [
{'@name': 'activityType', '@value': facility['activity'][0]['@type']},
{'@name':'openingTime','@value': '08:00:00'},
{'@name':'closingTime','@value': '18:00:00'},
{'@name':'typicalDuration','@value': '08:00:00'},
{'@name':'priority','@value': '1'}
]
})
config = {
'module': [
{'@name': 'network', 'param': {'@name':'inputNetworkFile', '@value': f"{self._city.name}_network.xml.gz"}},
{'@name': 'plans', 'param': {'@name':'inputPlansFile', '@value': f"{self._city.name}_population.xml.gz"}},
{'@name': 'facilities', 'param': {'@name':'inputFacilitiesFile', '@value': f"{self._city.name}_facilities.xml.gz"}},
{'@name': 'controler', 'param': [
{'@name': 'outputDirectory', '@value': '/output'},
{'@name': 'firstIteration', '@value': '0'},
{'@name': 'lastIteration', '@value': '10'},
]},
{'@name': 'qsim', 'param': [
{'@name': 'startTime', '@value': '00:00:00'},
{'@name': 'endTime', '@value': '00:00:00'},
{'@name': 'snapshotperiod', '@value': '00:00:00'},
]},
{'@name':'planCalcStore','param':[
{'@name':'learningRate', '@value':'1.0'},
{'@name':'BrainExpBeta', '@value':'2.0'},
{'@name':'lateArrival', '@value':'-18'},
{'@name':'earlyDeparture', '@value':'-0'},
{'@name':'performing', '@value':'+6'},
{'@name':'waiting', '@value':'-0'},
],'parameterset': parameterset},
{'@name':'strategy','param':[
{'@name': 'maxAgentPlanMemorySize', '@value': '5'},
{'@name': 'ModuleProbability_1', '@value': '0.9'},
{'@name': 'Module_1', '@value': 'BestScore'},
{'@name': 'ModuleProbability_2', '@value': '0.1'},
{'@name': 'Module_2', '@value': 'ReRoute'},
]}
]
}
xml_content = xmltodict.unparse({'config': config}, pretty=True, short_empty_elements=True)
with open(f"{self._output_file_path}/{self._city.name}_config.xml", 'w') as file:
file.write(xml_content)
def _convert_schedules(building_schedules): def _convert_schedules(building_schedules):
converted_schedules = [] converted_schedules = []