[][src]Struct sim::trips::TripManager

pub(crate) struct TripManager {
    trips: Vec<Trip>,
    people: Vec<Person>,
    active_trip_mode: BTreeMap<AgentID, TripID>,
    unfinished_trips: usize,
    car_id_counter: usize,
    events: Vec<Event>,
}

Manages people, each of which executes some trips through the day. Each trip is further broken down into legs -- for example, a driving trip might start with somebody walking to their car, driving somewhere, parking, and then walking to their final destination. https://dabreegster.github.io/abstreet/trafficsim/trips.html describes some of the variations.

Fields

trips: Vec<Trip>people: Vec<Person>active_trip_mode: BTreeMap<AgentID, TripID>unfinished_trips: usizecar_id_counter: usizeevents: Vec<Event>

Implementations

impl TripManager[src]

pub fn new() -> TripManager[src]

pub fn new_person(
    &mut self,
    orig_id: Option<OrigPersonID>,
    ped_speed: Speed,
    vehicle_specs: Vec<VehicleSpec>
) -> &Person
[src]

pub fn new_car_id(&mut self) -> usize[src]

pub fn new_trip(
    &mut self,
    person: PersonID,
    info: TripInfo,
    legs: Vec<TripLeg>
) -> TripID
[src]

pub fn start_trip(
    &mut self,
    now: Time,
    trip: TripID,
    spec: TripSpec,
    ctx: &mut Ctx<'_>
)
[src]

pub fn collect_events(&mut self) -> Vec<Event>[src]

impl TripManager[src]

pub fn agent_starting_trip_leg(&mut self, agent: AgentID, t: TripID)[src]

pub fn car_reached_parking_spot(
    &mut self,
    now: Time,
    car: CarID,
    spot: ParkingSpot,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_parking_spot(
    &mut self,
    now: Time,
    ped: PedestrianID,
    spot: ParkingSpot,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_ready_to_bike(
    &mut self,
    now: Time,
    ped: PedestrianID,
    spot: SidewalkSpot,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

pub fn bike_reached_end(
    &mut self,
    now: Time,
    bike: CarID,
    bike_rack: SidewalkSpot,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_building(
    &mut self,
    now: Time,
    ped: PedestrianID,
    bldg: BuildingID,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_bus_stop(
    &mut self,
    now: Time,
    ped: PedestrianID,
    stop: BusStopID,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>,
    transit: &mut TransitSimState
) -> Option<BusRouteID>
[src]

If no route is returned, the pedestrian boarded a bus immediately.

pub fn ped_boarded_bus(
    &mut self,
    now: Time,
    ped: PedestrianID,
    bus: CarID,
    blocked_time: Duration,
    walking: &mut WalkingSimState
) -> (TripID, PersonID)
[src]

pub fn person_left_bus(
    &mut self,
    now: Time,
    person: PersonID,
    bus: CarID,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_border(
    &mut self,
    now: Time,
    ped: PedestrianID,
    i: IntersectionID,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

pub fn transit_rider_reached_border(
    &mut self,
    now: Time,
    person: PersonID,
    bus: CarID,
    ctx: &mut Ctx<'_>
)
[src]

pub fn car_or_bike_reached_border(
    &mut self,
    now: Time,
    car: CarID,
    i: IntersectionID,
    blocked_time: Duration,
    distance_crossed: Distance,
    ctx: &mut Ctx<'_>
)
[src]

fn trip_finished(&mut self, now: Time, id: TripID, ctx: &mut Ctx<'_>)[src]

fn start_delayed_trip(&mut self, now: Time, id: PersonID, ctx: &mut Ctx<'_>)[src]

fn spawn_ped(
    &mut self,
    now: Time,
    id: TripID,
    start: SidewalkSpot,
    ctx: &mut Ctx<'_>
)
[src]

fn maybe_spawn_car(
    &mut self,
    ctx: &mut Ctx<'_>,
    now: Time,
    trip: TripID,
    req: PathRequest,
    car: CarID
) -> Result<Path, String>
[src]

Returns the path to use if successful. Caller is responsible for handling both the success and failure case.

impl TripManager[src]

pub fn cancel_unstarted_trip(&mut self, id: TripID, reason: String)[src]

Cancel a trip before it's started. The person will stay where they are.

pub fn cancel_trip(
    &mut self,
    now: Time,
    id: TripID,
    reason: String,
    abandoned_vehicle: Option<Vehicle>,
    ctx: &mut Ctx<'_>
)
[src]

Cancel a trip after it's started. The person will be magically warped to their destination, along with their car, as if the trip had completed normally.

pub fn trip_abruptly_cancelled(&mut self, trip: TripID, agent: AgentID)[src]

impl TripManager[src]

pub fn active_agents(&self) -> Vec<AgentID>[src]

pub fn active_agents_and_trips(&self) -> &BTreeMap<AgentID, TripID>[src]

pub fn num_active_agents(&self) -> usize[src]

pub fn trip_to_agent(&self, id: TripID) -> TripResult<AgentID>[src]

pub fn agent_to_trip(&self, id: AgentID) -> Option<TripID>[src]

This will be None for parked cars and buses. Should always work for pedestrians.

pub fn debug_trip(&self, id: AgentID)[src]

pub fn num_trips(&self) -> (usize, usize)[src]

pub fn num_agents(&self, transit: &TransitSimState) -> Counter<AgentType>[src]

pub fn num_commuters_vehicles(
    &self,
    transit: &TransitSimState,
    walking: &WalkingSimState
) -> CommutersVehiclesCounts
[src]

pub fn num_ppl(&self) -> (usize, usize, usize)[src]

pub fn is_done(&self) -> bool[src]

pub fn trip_info(&self, id: TripID) -> TripInfo[src]

pub fn all_trip_info(&self) -> Vec<(TripID, TripInfo)>[src]

pub fn finished_trip_details(
    &self,
    id: TripID
) -> Option<(Duration, Duration, Distance)>
[src]

pub fn trip_blocked_time(&self, id: TripID) -> Duration[src]

pub fn bldg_to_people(&self, b: BuildingID) -> Vec<PersonID>[src]

pub fn get_person(&self, p: PersonID) -> Option<&Person>[src]

pub fn get_all_people(&self) -> &Vec<Person>[src]

pub fn trip_to_person(&self, id: TripID) -> Option<PersonID>[src]

pub fn all_arrivals_at_border(
    &self,
    at: IntersectionID
) -> Vec<(Time, AgentType)>
[src]

pub fn generate_scenario(&self, map: &Map, name: String) -> Scenario[src]

Recreate the Scenario from an instantiated simulation. The results should match the original Scenario used.

Trait Implementations

impl Clone for TripManager[src]

impl Debug for TripManager[src]

impl<'de> Deserialize<'de> for TripManager[src]

impl Serialize for TripManager[src]

Auto Trait Implementations

impl RefUnwindSafe for TripManager

impl Send for TripManager

impl Sync for TripManager

impl Unpin for TripManager

impl UnwindSafe for TripManager

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,