Skip to content

Commit

Permalink
Merge pull request #254 from barisdemirdelen/fix_vdf_not_calculated_l…
Browse files Browse the repository at this point in the history
…ast_iteration

Fix vdf not calculated last iteration of assignment
  • Loading branch information
janzill committed May 25, 2021
2 parents 2b1867d + 7985c40 commit 71c2ec1
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions aequilibrae/paths/linear_approximation.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,15 @@ def execute(self):
# This needs to be done with the current costs, and not the future ones
converged = self.check_convergence() if self.iter > 1 else False

self.vdf.apply_vdf(
self.congested_time,
self.fw_total_flow,
self.capacity,
self.free_flow_tt,
*self.vdf_parameters,
self.cores,
)

self.convergence_report["iteration"].append(self.iter)
self.convergence_report["rgap"].append(self.rgap)
self.convergence_report["warnings"].append("; ".join(self.iteration_issue))
Expand All @@ -415,6 +424,13 @@ def execute(self):
self.convergence_report["beta1"].append(self.betas[1])
self.convergence_report["beta2"].append(self.betas[2])

for c in self.traffic_classes:
c._aon_results.reset()
if self.time_field not in c.graph.skim_fields:
continue
idx = c.graph.skim_fields.index(self.time_field)
c.graph.skims[:, idx] = self.congested_time[:]

logger.info(f"{self.iter},{self.rgap},{self.stepsize}")
if converged:
self.steps_below += 1
Expand All @@ -423,22 +439,6 @@ def execute(self):
else:
self.steps_below = 0

self.vdf.apply_vdf(
self.congested_time,
self.fw_total_flow,
self.capacity,
self.free_flow_tt,
*self.vdf_parameters,
self.cores,
)

for c in self.traffic_classes:
c._aon_results.reset()
if self.time_field not in c.graph.skim_fields:
continue
idx = c.graph.skim_fields.index(self.time_field)
c.graph.skims[:, idx] = self.congested_time[:]

for c in self.traffic_classes:
c.results.link_loads /= c.pce
c.results.total_flows()
Expand Down

0 comments on commit 71c2ec1

Please sign in to comment.