nrel.hive.model.request
Submodules
Package Contents
Classes
A ride hail request which is alive in the simulation but not yet serviced. |
|
A rate structure for a request. |
- class nrel.hive.model.request.Request[source]
Bases:
nrel.hive.model.entity.EntityA ride hail request which is alive in the simulation but not yet serviced. It should only exist if the current sim time >= self.departure_time. It should be removed once the current sim time >= self.departure_time + config.sim.request_cancel_time_seconds. If a vehicle has been dispatched to service this Request, then it should hold the vehicle id and the time that vehicle was dispatched to it.
- Parameters:
id – A unique id for the request.
origin – The geoid of the request origin.
destination – The geoid of the request destination.
departure_time – The time of departure.
passengers – A tuple of passengers associated with this request.
membership – the membership of the fleet.
dispatched_vehicle – The id of the vehicle dispatched to service this request.
dispatched_vehicle_time – Time time which a vehicle was dispatched for this request.
- property geoid
returns the geoid of the entity
- Returns:
the geoid of the entity
- property origin
- property destination
- id: nrel.hive.util.typealiases.RequestId
- membership: nrel.hive.model.membership.Membership
- destination_position: nrel.hive.model.entity_position.EntityPosition
- departure_time: nrel.hive.model.sim_time.SimTime
- passengers: nrel.hive.util.typealiases.Tuple[nrel.hive.model.passenger.Passenger, Ellipsis]
- allows_pooling: bool
- value: nrel.hive.util.units.Currency = 0
- dispatched_vehicle: nrel.hive.util.typealiases.VehicleId | None
- dispatched_vehicle_time: nrel.hive.model.sim_time.SimTime | None
- classmethod build(request_id: nrel.hive.util.typealiases.RequestId, origin: nrel.hive.util.typealiases.GeoId, destination: nrel.hive.util.typealiases.GeoId, road_network: nrel.hive.model.roadnetwork.roadnetwork.RoadNetwork, departure_time: nrel.hive.model.sim_time.SimTime, passengers: int, allows_pooling: bool, fleet_id: nrel.hive.util.typealiases.MembershipId | None = None, value: nrel.hive.util.units.Currency = 0) Request[source]
- classmethod from_row(row: Dict[str, str], env: nrel.hive.runner.environment.Environment, road_network: nrel.hive.model.roadnetwork.roadnetwork.RoadNetwork) nrel.hive.util.typealiases.Tuple[Exception | None, Request | None][source]
takes a csv row and turns it into a Request
- Parameters:
row – a row as interpreted by csv.DictReader
env – the static environment variables
road_network – the road network
- Returns:
a Request, or an error
- assign_dispatched_vehicle(vehicle_id: nrel.hive.util.typealiases.VehicleId, current_time: nrel.hive.model.sim_time.SimTime) Request[source]
allows the dispatcher to update the request that a vehicle has been dispatched to them. this does not signal that the vehicle is guaranteed to pick them up.
- Parameters:
vehicle_id – the vehicle that is planning to service the request
current_time – the current simulation time
- Returns:
the updated Request
- unassign_dispatched_vehicle() Request[source]
removes any vehicle listed as assigned to this request :return: the updated request
- assign_value(rate_structure: nrel.hive.model.request.RequestRateStructure, road_network: nrel.hive.model.roadnetwork.roadnetwork.RoadNetwork) Request[source]
used to assign a value to this request based on it’s properties as well as possible surge pricing.
- Parameters:
rate_structure – the rate structure to apply to the request value
road_network – the road network used for computing distances
- Returns:
the updated request
- class nrel.hive.model.request.RequestRateStructure[source]
Bases:
NamedTupleA rate structure for a request.
- base_price: nrel.hive.util.units.Currency = 0
- price_per_mile: nrel.hive.util.units.Currency = 0
- minimum_price: nrel.hive.util.units.Currency = 0
- classmethod from_row(row: Dict[str, str]) RequestRateStructure[source]