Data Structures

The module contains the data structures FleetState and VehicleState depend on.

Requests

class Request(request_id, creation_timestamp)[source]

A request for the system to perform a task

Parameters:
class TransportationRequest(request_id, creation_timestamp, origin, destination, pickup_timewindow_min=0, pickup_timewindow_max=inf, delivery_timewindow_min=0, delivery_timewindow_max=inf)[source]

A request for the system to perform a transportation task, through creating a route through the system given spatio-temporal constraints.

Parameters:
  • request_id (str | int)

  • creation_timestamp (float)

  • origin (Any)

  • destination (Any)

  • pickup_timewindow_min (float)

  • pickup_timewindow_max (float)

  • delivery_timewindow_min (float)

  • delivery_timewindow_max (float)

class InternalRequest(request_id, creation_timestamp, location)[source]

A request for the system to perform some action at a specific location that is not directly requested by a customer

Parameters:

LocType

class LocType(value)[source]

Represents the kind of location objects the simulator supports. Either of:

  1. R2LOC (for points in \(\mathbb{R}^2\), holds a Tuple[float, float]).

  2. INT (for e.g. graphs).

Note

Use this for simulations using the pure python components. For simulations using cythonic components, the cython version of this enum i.e. data_structures_cython.LocType has to be used.

Stop and Stoplist

class StopAction(value)[source]

Representing actions that the system may perform at a specific location

class Stop(location, request, action, estimated_arrival_time, occupancy_after_servicing=0, time_window_min=0, time_window_max=inf)[source]

The notion of an action to be performed in fulfilling a request. Attached are spatio-temporal constraints.

Parameters:
  • location (Any) – location at which the stop is supposed to be serviced

  • request (Request)

  • action (StopAction)

  • estimated_arrival_time (float)

  • occupancy_after_servicing (int)

  • time_window_min (float)

  • time_window_max (float)

The TransportSpace and Dispatcher interfaces

class TransportSpace[source]
abstract d(u, v)[source]

Return distance between points u and v.

Parameters:
  • u – origin coordinate

  • v – destination coordinate

Returns:

d – distance

Return type:

int | float

abstract t(u, v)[source]

Return travel time between points u and v.

Parameters:
  • u – origin coordinate

  • v – destination coordinate

Returns:

d – travel time

Return type:

int | float

abstract random_point()[source]

Return a random point on the space.

Returns:

random point

abstract interp_time(u, v, time_to_dest)[source]

Interpolate a location x between the origin u and the destination v as a function of the travel time between the unknown location and the destination t(x, v) == time_to_dest.

Parameters:
  • u – origin coordinate

  • v – destination coordinate

  • time_to_dest – travel time from the unknown location x to the destination v

Returns:

  • x – interpolated coordinate of the unknown location x

  • jump_dist – remaining distance until the returned interpolated coordinate will be reached

Return type:

Tuple[Any, int | float]

Note

The notion of jump_dist is necessary in transport spaces whose locations are discrete (e.g. graphs). There if someone is travelling along a trajectory, at a certain time t one may be “in between” two locations w and x. Then the “position” at time t is ill defined, and we must settle for the fact that its location will be x at t+jump_time.

abstract interp_dist(origin, destination, dist_to_dest)[source]

Interpolate a location x between the origin u and the destination v as a function of the distance between the unknown location and the destination d(x, v) == dist_to_dest.

Parameters:
  • u – origin coordinate

  • v – destination coordinate

  • dist_to_dest – distance from the unknown location x to the destination v

Returns:

  • x – interpolated coordinate of the unknown location x

  • jump_dist – remaining distance until the returned interpolated coordinate will be reached

Return type:

Tuple[Any, int | float]

Note

This is only the abstract base class specifying the interface. Actual TransportSpace classes are available in util.spaces.

SingleVehicleSolution
vehicle_id, cost, (

pickup_timewindow_min, pickup_timewindow_max, delivery_timewindow_min, delivery_timewindow_max,

)

This is what VehicleState.handle_transportation_request_single_vehicle returns. In case no solution is found, the cost is \(\infty\) and the timewindow variables are None.

Dispatcher

Defines the Dispatcher interface. Actual dispatchers are implemented in util.dispatchers.

alias of Callable[[TransportationRequest, List[Stop], TransportSpace, int], tuple[float, List[Stop], tuple[float, float, float, float]]]