I'm looking at a scenario where a vehicle is available to take members of a household to their activities with or without members of the household inside. So, like a chauffeur or a household-owned automated vehicle.
It seems that the existing taxi module would work for this, if I could restrict the taxi to only being available to a set of individual ID's. Any ideas on how I might go about implementing this?
great to hear from you!
I would also understand it the way Michal proposes.
I've implemented something similar where a certain person group (in our case: wheelchair users) can only get a certain type of taxi.
The priniciple, however, is the same (IDs of passengers and taxis are matched). For an idea how to implement this, see:
To see how it is all plugged together, there is a Run script https://github.com/matsim-org/matsim/tree/f83ea1d00a0e00d79cdeb6328393e9d5c09d0e03/playgrounds/jbischoff/src/main/java/playground/jbischoff/taxi/inclusion
Hi Joschka! I'll definitely have a look at what you've done; it seems like a melding of Michal's and Kai's, where you dispatch taxis only to a particular subpopulation.
An alternative might be to use "subpopulations". With that, you could have some agents have "taxi" or "av" as mode alternative, and others not.
RunSubpopulationsExample contains an example of how to use subpopulations in Java. One can use subpopulations also from files only (i.e. without programming java), but I don't think that you can use different sets of mode by subpopulation from file only.
In this case, I would need as many subpopulations as households with an AV; could this make the solution more complex than the Michal proposal?
I would start with a slightly customised version of RuleBasedTaxiOptimizer that
Please let me know if this is the way you would like to move on with your project/scenario. If yes, I can adapt the taxi code so that you can start coding your dispatching.
This definitely seems like the logical way forward. So, to be clear: I write an interface to the taxi optimizer that only dispatches taxis to individuals with a particular set of ID's? I guess I need to dig into the taxi code, then?
Yes, that would require some amount of coding. But the current taxi code is close to what you need, so I will prepare some extension points where you can easily plug your dispatching strategy. Will let you know when it is ready.
Michal, is there anything I can do to help with the coding? I am on a tight-ish timeline (of my own making, as usual), but I'm happy to help.
I prepared a starting point for you: https://github.com/matsim-org/matsim/commit/203f2c1bdf76c39a117705b4531b6fe1adef6ab5You need to implement PrivateAVDispatchFinder (it is just a template now).Because a small change in RuleBasedTaxiOptimizer was necessary, I put the new code on a separate branch: privateAT https://github.com/matsim-org/matsim/compare/privateATBesides writing your dispatch finder, you need to switch off pre-filtering of requests and vehicles, as I wrote before.Please follow Joschka's example on how to plug a non-standard optimizer into matsim simulation.Hope that helps
And yet another possibility: Add some penalty term to the scoring function for people using the "taxi" modes when they are not allowed to use it. Examples with scoring functions are in RunSubpopulationsExample and RunExampleIndividualizedScoring.
Given the nature of MATSim, this may be the easiest way to do this. But also given the nature of MATSim, you will probably always have a small number of "disallowed" agents trying the "taxi" mode in spite of the high penalty.
I see this as a way to keep people from using taxis in general, but what I hope to do is model a household-owned AV, so there will be a vehicle that only two or three people have access to at all. Other households may have their own AV's, but the "taxi" and the household are linked.