Skip to content

Commit

Permalink
Adds fix to issue #3746. PersonAgentTripCostTest is flaky at this sta…
Browse files Browse the repository at this point in the history
…ge meaning there are other sources for cost discrepancy.
  • Loading branch information
HoneyTauOverTwo committed Jul 12, 2023
1 parent ee2921c commit 1efad39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/beam/agentsim/agents/PersonAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -957,22 +957,22 @@ class PersonAgent(
_,
_,
_,
_,
currentCost,
_,
_,
_,
enrouteData
)
) =>
val (trip, cost) = if (enrouteData.isInEnrouteState) {
log.debug("ReadyToChooseParking, enroute trip: {}", currentTrip.toString())
// if enroute, keep the original trip and cost
(currentTrip, currentCost.toDouble)
(currentTrip, currentCost)
} else {
log.debug("ReadyToChooseParking, trip: {}", restOfCurrentTrip.toString())
// "head" of the current trip is travelled, and returning rest of the trip
// adding the cost of the "head" of the trip to the current cost
(restOfCurrentTrip, currentCost.toDouble + headOfCurrentTrip.cost)
(restOfCurrentTrip, currentCost + headOfCurrentTrip.cost)
}

goto(ChoosingParkingSpot) using data.copy(
Expand Down

0 comments on commit 1efad39

Please sign in to comment.