Skip to content

Commit

Permalink
blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-sijia committed Aug 12, 2024
1 parent dee313d commit e8ae3f3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tm2py/components/network/create_tod_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _create_highway_scenarios(self):
"(el1 + 60 * (0.25 * (put((volau + volad)/el2) - 1 + "
"((get(1) - 1) ** 2 + el3 * get(1)) ** 0.5)))"
)

for f_id in ["fd1", "fd2"]:
if emmebank.function(f_id):
emmebank.delete_function(f_id)
Expand Down
14 changes: 10 additions & 4 deletions tm2py/components/network/highway/highway_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def run(self):
iteration = self.controller.iteration
warmstart = self.controller.config.warmstart.warmstart
assign_classes = [
AssignmentClass(c, time, iteration, calculate_reliability, warmstart)
AssignmentClass(
c, time, iteration, calculate_reliability, warmstart
)
for c in self.config.classes
]
if iteration > 0:
Expand All @@ -163,7 +165,7 @@ def run(self):
assign_spec = self._get_assignment_spec(
assign_classes, path_analysis=False
)

with self.logger.log_start_end(
"Run SOLA assignment without path analyses", level="INFO"
):
Expand All @@ -177,7 +179,9 @@ def run(self):

exf_pars = scenario.emmebank.extra_function_parameters
vdfs = [
f for f in scenario.emmebank.functions() if f.type == "VOLUME_DELAY"
f
for f in scenario.emmebank.functions()
if f.type == "VOLUME_DELAY"
]
for function in vdfs:
expression = function.expression
Expand All @@ -198,7 +202,9 @@ def run(self):
"(@static_rel+" + reliability_expr,
{"link": "vdf=%s" % function.id[2:]},
)
net_calc("@reliability_sq", "@reliability**2", {"link": "all"})
net_calc(
"@reliability_sq", "@reliability**2", {"link": "all"}
)

assign_spec = self._get_assignment_spec(
assign_classes, path_analysis=True
Expand Down
10 changes: 5 additions & 5 deletions tm2py/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class WarmStartConfig(ConfigItem):
Note that the components will be executed in the order listed.
Properties:
warmstart: Boolean indicating whether warmstart demand matrices are used.
warmstart: Boolean indicating whether warmstart demand matrices are used.
If set to True, the global iteration 0 will either assign warmstart demand for highway and transit, or skip the assignment and just use warmstart skims.
If set to False, the global iteration 0 will assign zero demand for highway and transit.
warmstart_skim: Boolean indicating whether to use warmstart skims. If set to True, then skips warmstart assignment in iteraton 0.
Expand Down Expand Up @@ -952,10 +952,10 @@ class HighwayConfig(ConfigItem):
to the free-flow speed, capacity, and critical speed values
interchange_nodes_file: relative path to the interchange nodes file, this is
used for calculating highway reliability
reliability: bool to skim highway reliability. Default to true. If true, assignment
will be run twice in global iterations 0 (warmstart) and 1, to calculate reliability,
assignment will be run only once in global iterations 2 and 3,
reliability skim will stay the same as global iteration 1.
reliability: bool to skim highway reliability. Default to true. If true, assignment
will be run twice in global iterations 0 (warmstart) and 1, to calculate reliability,
assignment will be run only once in global iterations 2 and 3,
reliability skim will stay the same as global iteration 1.
If false, reliability will not be calculated nor skimmed in all global
iterations, and the resulting reliability skims will be 0.
"""
Expand Down

0 comments on commit e8ae3f3

Please sign in to comment.