Skip to content

Commit d920327

Browse files
authored
Fixed @CCost to exclude change in DWT (#231)
1 parent a6c6989 commit d920327

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

TMGToolbox/src/XTMF_internal/tmg_transit_assignment_tool.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,14 @@ def _SaveResults(self, network, stsu_att):
12551255
for segment in line.segments():
12561256
volume = float(segment.voltr)
12571257
congestionTerm = self._CalculateSegmentCost(volume, capacity, segment)
1258-
baseTime = float(segment.uncongested_time) - float(line.segment(i + 1).base_dwell_time)
1259-
segment.transit_time = (baseTime + float(line.segment(i + 1).dwell_time)) * (1 + congestionTerm)
1260-
segment["@ccost"] = segment.transit_time - baseTime
1258+
# we don't want dwell time included in @ccost so that it is
1259+
# exclusively the congestion penalty from congested assignment.
1260+
next_segment = line.segment(i + 1)
1261+
next_base_dwell_time = float(next_segment.base_dwell_time)
1262+
next_dwell_time = float(next_segment.dwell_time)
1263+
baseTime = float(segment.uncongested_time) - next_base_dwell_time
1264+
segment.transit_time = (baseTime + next_dwell_time) * (1 + congestionTerm)
1265+
segment["@ccost"] = segment.transit_time - baseTime - (next_dwell_time - next_base_dwell_time) * congestionTerm
12611266
i += 1
12621267
attributeMapping = self._AttributeMapping()
12631268
attributeMapping["TRANSIT_SEGMENT"]["@ccost"] = "@ccost"

0 commit comments

Comments
 (0)