You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an output population to which I want to add new agents before the next run. It is important to me that all agents have fully specified routes before I start the next simulation. The routes should be based on the travel times of my last iteration. So far, I'm using PrepareForSimImpl to assign routes like so:
var injector = Injector.createMinimalMatsimInjector(scenario.getConfig(), scenario);
var prepareForSim = injector.getInstance(PrepareForSim.class);
prepareForSim.run();
However, prepareForSim.run() assigns routes based on the empty network. I would like to extend my example so that the Router has travel times from the last iteration of my previous simulation run. E.g., I would like to parse the events file to update travel times in the router and then execute prepareForSim.run() something like the following:
var injector = Injector.createMinimalMatsimInjector(scenario.getConfig(), scenario);
var manager = injector.getInstance(EventsManager.class);
EventsUtils.readEvents(manager, "/path/to/events.xml");
// here the travel time listener should have updated travel times according to events
var prepareForSim = injector.getInstance(PrepareForSim.class);
prepareForSim.run();
Unfortunately, I can't really see how I am supposed to combine all the moving parts.
The text was updated successfully, but these errors were encountered:
Ok, after stepping through the code I suspect that this might just work?
When creating the minimal injector, everything is set up, including the TravelTimeCalculator which is the events handler that keeps track of travel times. Now, the question is, whether the AStarLandmarks router, which takes TraveTime as constructor argument works on live TravelTimes provided by TravelTimeCalculator which is bound as a Provider<TravelTime> in the injector. It doesn't really look like that because there is a preprocessing call in the constructor.
I have an output population to which I want to add new agents before the next run. It is important to me that all agents have fully specified routes before I start the next simulation. The routes should be based on the travel times of my last iteration. So far, I'm using
PrepareForSimImpl
to assign routes like so:However,
prepareForSim.run()
assigns routes based on the empty network. I would like to extend my example so that the Router has travel times from the last iteration of my previous simulation run. E.g., I would like to parse the events file to update travel times in the router and then executeprepareForSim.run()
something like the following:Unfortunately, I can't really see how I am supposed to combine all the moving parts.
The text was updated successfully, but these errors were encountered: