Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: interaction activities in withinday replanning #2969

Merged
merged 4 commits into from
Dec 2, 2023

Conversation

sebhoerl
Copy link
Contributor

I just noticed something interesting: I'm working with within-day replanning and I'm using RoutingModules to replace certain parts of the agent schedule at the beginning of the simulation. The predefined RoutingModules may create InteractionActivitys which I then integrate into the modifiable plan of an agent. This is a problem, because BasicAgentImpl eventually will call setStartTime on the activity one the agent arrives there, but this method is not defined for the specialized InteractionActivity. The reason why things work normally is that upon simulation start-up all InteractionActivity are automatically copied into a classic Activity that is used in the modifiable plan of the agent during the QSim.

This means that whenever we use RoutingModules and insert the results in an ongoing agent plan within-day, we need to be able to manually convert the interaction activities to standard activity objects. This PR adds this functionaity:

  • PopulationUtils.convertInteractionToStandardActivity converts an activity to a standard one if it is an interaction activity
  • WithinDayAgentUtils.convertInteractionActivities fixes a list of plan elements coming from a routing module if necessary

@sebhoerl sebhoerl requested a review from mrieser November 28, 2023 11:04
@tschlenther
Copy link
Contributor

tschlenther commented Nov 28, 2023

Nice!
A remark: I recently came across the EVNetworkRoutingModule, where similar things happen:

Activity chargeAct = PopulationUtils.createStageActivityFromCoordLinkIdAndModePrefix(selectedChargerLink.getCoord(),
	selectedChargerLink.getId(), stageActivityModePrefix);
// createStageActivity... creates a InteractionActivity where duration cannot be set.
chargeAct = PopulationUtils.createActivity(chargeAct);

That use case is a little special, I guess, because it wants to define an interaction activity that has a non-zero duration and therefore does this hacky copying... Maybe should be adopted using your suggested method ??

@kainagel
Copy link
Member

kainagel commented Nov 28, 2023 via email

@sebhoerl
Copy link
Contributor Author

@kainagel probably @mrieser can explain if there was a big performance impact :)

@sebhoerl sebhoerl enabled auto-merge (squash) December 2, 2023 17:37
@sebhoerl sebhoerl merged commit 820ef8f into master Dec 2, 2023
48 checks passed
@sebhoerl sebhoerl deleted the feat/withinday-interaction-activities branch December 2, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants