Smart Taxi System

Smart Taxi System is used to coordinate the activities of a group of taxis in a city.  We assume that the city is subdivided in patches forming a grid. Two kinds of agents populate the system: taxis and users.
Each taxi stay can either stay in a patch, waiting for user requests, or move to another patch.  Users randomly arrive at different patches with a rate that depends on the specific time of day. After arrival, a user waits for a taxi and then moves to another patch.

In our running example the collective will be used to model the behaviour of taxis and users, while the environment will be used to model the city context where these agents operate.

To model our smart taxi system  Carma we need two kinds of components: One for each of the two groups of agents involved in the system, taxis and users.  Both the kind of components use the local store to publish the relevant data that will be used to represent the state of the agent. Another component will be used to model the arrival of new users in the system.

The local store of components associated to taxis contains the following attributes:

  • loc: identifies current taxi location;
  • occupancy: ranging in {0,1} describes if a taxi is free (occupied=0) or engaged (occupied=1);
  • dest: if occupied, this attribute indicates the destination of a taxi journey.

Similarly, the local store of components associated with users contains the following attributes:

  • loc: identifies user location;
  • dest: indicates user destination.

The prototypes of the three components is the following:

The smart taxi system can be instantiated by considering two different specifications for the environment:

  1. Users arrive in all the patches at the same rate;
  2. At the beginning users arrive with a higher probability to the patches at the border of the grid; subsequently, users arrive with higher probability in the centre of the grid.

In both the scenarios users in the border will use the taxi to go to the centre, while users
from the centre will use the taxi to go to any other location (the destination is probabilistically selected). In both scenarios, we assume that the movement rate is constant and is proportional to the number of patches to be traversed to reach the destination, and collectives have the following structure:

Above, indicates the number of taxis located at the beginning in the different patches, while SIZE indicates the number of rows/columns of the grid dividing the city.

The environment for the first scenario is:

Where auxiliary functions are:

To model the second scenario, the following environment can be used:

The complete code for the scenario can be found at the following link.