Large Scale
The service is available 24h per day, 7 days a week.
The vehicles are ranging from minivans to minibuses (approximately 6 to 12 passengers)
The service works without fixed stations
Taxis can be taken on the fly (smart phones)
Price and utility parameters based on those of other modes in MATSim-T
Available to all agents at every point in time and space
No capacity restrictions (unlimited capacity)
Michal Maciejewski is looking into using MATSim to generate realistic instances of the dynamic vehicle routing problem (DVRP). If one wants to avoid that the DVRP program can "cheat", requests for service should not come out of MATSim before their time. There seem to be the following types of requests:
Let me first look at taxis (i.e. persons make requests for themselves).
The first seems to be relatively easy to model: The leg mode would be "taxi"; the person would end its activity, go into the corresponding departure handler, which would request a taxi and then put the person into the departure queue (presumably, the same as there is for pt, although I am not sure if there is one per link or just one per pt stop).
The second is more difficult. Sending out the request when the activity starts is too early, and the DVRP may use that to its advantage. Possibilities that come to my (kn's) mind:
Option 1. seems plausible at first glance. Yet, it looks like it will cause additional headaches if this is ever combined with within-day replanning (because matsim would need to check which pre-scheduled events an agent has left around when it changes its plan). Given our past experiences with such "quick fixes", this does not sound like a great idea.
Option 2. seems plausible (to me). Within-day agents might be contacted, say once a minute, and asked if they want to call taxi for a pre-scheduled time in the future.
Option 3. seems a plausible fix for the meantime (to me). It will produce wrong results with respect to agent scoring, but at least it will generate correct taxi requests.
Now courier service.
Seems to me that I don't know enough about this. Freight, at this point, is planned to be plugged into matsim by using "truck drivers". I.e. from the point of view of matsim, the transportation of goods will just be a side effect of a driver moving a vehicle from A to B, and that vehicle being loaded with certain goods.
Clearly, we can still make up courier requests without following the goods. For this, once more the within-day agents seems like the most consistent option.
Once there are requests, there need to be taxis. Personally, I would start with a single taxicab. In terms of implementation, this would probably inherit from what is currently (may'11) called ExperimentalBasicWithindayAgent.
(Using delegation/composition instead of inheritance is difficult with matsim agents, since "this" inside some delegated logic points to the delegate, not to the composing object. Yet, the "this" is used to remove the agent from data structures, and insert it into others (e.g. at-activity data structure, wait data structure, in-vehicle data structure).)
As a first step, I would make the taxi agent, every time it arrives somewhere, generate a next activity location and then drive there.
As a second step, I would try to make that taxi agent pick up a waiting passenger and deliver it.
After some thinking, my intuition is that I would stay away from the pt code. Picking up passengers can as well be done with regular arrival, I would think, and that would be much less intrusive.
Update (jul'11): There is an "AdapterAgent" in Michael Z.'s playground, and Michal M. has started using that for his taxicab prototype.