In this project we aim to show that collaboration between taxis can be beneficial both for the taxi drivers and passengers. In multiple settings and under fuel limits we show that the success-rate of passengers arrival at their destination increases significantly when taxis are collaborating and can transfer a passenger from one taxi to the other. Moreover, we showed that even if the passenger can't be brought to the destination, the average distance of the passenger from the destination is decreased.
Our implementation allows the user to run different experiments that demonstrate the usefulness of collaboration both in a centralized and decentralized control settings.
A wrapper for a single taxi object. Allows to represent and control a single taxi and move it in the environment. The taxi wrapper includes two classes:
- EnvGraph Class: This class converts the original string representation of the grid to a graph representation of the Networkx library. Using the graph representation, multiple computations and path calculations can be performed such as shortest path between two points, etc. When initializing an EnvGraph object, the map that is converted to a graph is the map with which the original TaxiEnv object was initialized.
- Taxi Class: This class wraps a single taxi. The class can be used to control a single taxi object, and includes functions allowing to send the taxi to pickup a certain passenger from a given location and dropoff a passenger at a given point. Moreover, it includes function that allow multiple taxis to communicate using a messaging system.
When initializing a Taxi object the following arguments should be passed:
- The current environment.
- The index of the taxi this object represents.
- (optional) The list of passengers indices that this taxi is responsible of.
The taxi_wrapper_demo.py
includes a simple example how to use the taxi class.
The controller wrapper implements the Controller
class which includes functions that allow the user to control the
taxis in a centralized manner. The class includes functions that compute the transfer point of a passenger between
taxis. The transfer point can be computed according to the following 3 options:
- Optimal transfer-point: check all points on the grid and select the point that minimizes the distance of the passenger from the destination after the transfer.
- Heuristic 1: bring the passenger as close as possible to the path of the second taxi to the destination (the taxi that should deliver the passenger to the destination).
- Heuristic 2: bring the passenger as far as possible on her shortest path to the destination. This heuristic doesn't depend on the location of the second taxi.
When initializing a Controller object the following arguments should be passed:
- The current environment .
- A list with all taxis that the controller should control.
The controller_wrapper_demo.py
includes a simple example how to use the controller class to control the taxis and
make them collaborate in a centralized manner.
As mentioned above, the controller wrapper allows the user to control the taxis and make them collaborate in a
centralized manner. In the Decentralized_Control_Example.py
file we show how the collaboration between taxis can
be done in a decentralized manner, i.e. taxis communicate with each other in order to decide which taxis should
pickup the passenger and deliver her to the destination, and where the transfer should happen.
In the Collaboration_Experiment.py
file we demonstrate the significance of collaboration. In this experiment we
compare the percentage of successful passenger deliveries to the destination and the distance of the passenger from
the destination under 4 different settings:
- No collaboration - taxis are not allowed to collaborate with each other.
- Collaborating using a naive optimal solution.
- Collaborating using heuristic 1.
- Collaborating using heuristic 2. See the Controller Wrapper section for more information about the different heuristics.
The graphs below show the different results achieved when using the 4 different methods mentioned above.
Success Rate | Distance From Destination |
---|---|
On the left graph, we can see that when taxis are allowed to collaborate, the success-rate of passenger deliveries is significantly higher under different fuel limitations. On the right graph, we can see that the average distance of the passenger from the destination is smaller when using taxi collaboration.