VehicleState
The VehicleState
class holds a vehicle’s Stoplist. It exposes two methods:
fast_forward
fast-forwards the state to a new point in time.
handle_transportation_request_single_vehicle
computes the cost for serving a
TransportationRequest
with this vehicle.
- class VehicleState(*, vehicle_id, initial_stoplist, space, dispatcher, seat_capacity)[source]
Single vehicle insertion logic is implemented here. Can optionally be implemented in Cython or another compiled language.
- Parameters:
vehicle_id – id of the vehicle to be created.
initial_stoplist (Stoplist) – stoplist to start out with, MUST contain CPE as first element.
space (TransportSpace)
dispatcher (Dispatcher) – see the docstring of
FleetState
.seat_capacity (int) –
- the maximum number of
TransportationRequest
s that can be in a vehicle at the same time.
- the maximum number of
- stoplist: List[Stop]
The list of
Stop
objects specifying the planned future actions to be undertaken by this vehicle.
- handle_transportation_request_single_vehicle(request)[source]
The computational bottleneck. An efficient simulator could do the following:
Parallelize this over all vehicles. This function being without any side effects, it should be easy to do.
Implement as a c extension. The args and the return value are all basic c data types, so this should also be easy.
- Parameters:
request (TransportationRequest) – Request to be handled.
- Returns:
The
SingleVehicleSolution
for the respective vehicle.- Return type:
ridepy.data_structures.SingleVehicleSolution