Skip to content

Commit

Permalink
check warmstart files exist
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-sijia committed Jul 18, 2024
1 parent 744ff45 commit f6e4098
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tm2py/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,33 @@ def run_next(self):
if self._iteration != iteration:
self.logger.log(f"Start iteration {iteration}")
self._iteration = iteration

# check wamrstart files exist
if iteration == 0:
if self.config.warmstart.warmstart:
if self.config.warmstart.use_warmstart_demand:
for source in ["household","truck","air_passenger","internal_external"]:
path = self.get_abs_path(
self.config[source].highway_demand_file
).__str__()
for time in self.config["time_periods"]:
path = path.format(period=time.name, iter=iteration)
assert os.path.isfile(path)
elif self.config.warmstart.use_warmstart_skim:
highway_skim_file = self.get_abs_path(
self.config["highway"].output_skim_path+self.config["highway"].output_skim_filename_tmpl
).__str__()
for time in self.config["time_periods"]:
path = highway_skim_file.format(period=time.name)
assert os.path.isfile(path)
transit_skim_file = self.get_abs_path(
self.config["transit"].output_skim_path+self.config["transit"].output_skim_filename_tmpl
).__str__()
for time in self.config["time_periods"]:
for tclass in self.config["transit"]["classes"]:
path = transit_skim_file.format(period=time.name, iter=tclass.name)
assert os.path.isfile(path)

self._component = component
component.run()
self.completed_components.append((iteration, name, component))
Expand Down

0 comments on commit f6e4098

Please sign in to comment.