Skip to content

Commit

Permalink
Hotfix/headways (#376)
Browse files Browse the repository at this point in the history
* Add writing of headway attribute
when beginning congested transit assignment

* Fix congested assignment test

* Add testing of end assignment

* Update version number
  • Loading branch information
Jens West committed Oct 1, 2021
1 parent 4a49110 commit 985f94b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Scripts/assignment/assignment_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ def _assign_transit(self):
def _assign_congested_transit(self):
"""Perform congested transit assignment for one scenario."""
log.info("Congested transit assignment started...")
network = self.emme_scenario.get_network()
headway_attr = self.extra("hw")
for line in network.transit_lines():
line.headway = line[headway_attr]
self.emme_scenario.publish_network(network)
specs = self._transit_specs
for tc in specs:
specs[tc].transit_spec["journey_levels"][1]["boarding_cost"]["global"]["penalty"] = param.transfer_penalty[tc]
Expand Down
2 changes: 1 addition & 1 deletion Scripts/assignment/emme_bindings/mock_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def congested_assignment(self, transit_assignment_spec, class_names,
"TRANSIT_SEGMENT", "@base_timtr", "", 1.0,
overwrite=True, scenario=scenario)
report = {
"stopping_criterion": "MAX_ITERATIONS",
"stopping_criteria": "MAX_ITERATIONS",
"iterations": [{"number": 1}],
}
return report
Expand Down
2 changes: 1 addition & 1 deletion Scripts/dev-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"HELMET_VERSION": "v4.1.0-alpha.3",
"HELMET_VERSION": "v4.1.0-alpha.4",
"LOG_LEVEL": "INFO",
"LOG_FORMAT": "TEXT",
"RUN_AGENT_SIMULATION": false,
Expand Down
3 changes: 2 additions & 1 deletion Scripts/tests/unit/test_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_assignment(self):
context.modeller.emmebank.scenario(scenario_id).get_network(),
fares)
ass_model = EmmeAssignmentModel(
context, scenario_id, save_matrices=True)
context, scenario_id)
ass_model.prepare_network()
peripheral_cost = numpy.arange(10).reshape((1, 10))
ass_model.calc_transit_cost(fares, peripheral_cost)
Expand All @@ -49,6 +49,7 @@ def test_assignment(self):
"van": car_matrix,
}
ass_model.init_assign(demand)
ass_model.assignment_periods[0].assign(demand, "last")
resultdata = ResultsData(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"..", "test_data", "Results", "test"))
Expand Down

0 comments on commit 985f94b

Please sign in to comment.