[−][src]Constant game::pregame::built_info::BUILT_TIME_UTC
pub const BUILT_TIME_UTC: &str = "Fri, 04 Sep 2020 18:27:07 +0000";
The built-time in RFC2822, UTC
+[−][src]Constant game::pregame::built_info::BUILT_TIME_UTC
pub const BUILT_TIME_UTC: &str = "Fri, 04 Sep 2020 18:34:28 +0000";
The built-time in RFC2822, UTC
[−][src]Function sim::make::activity_model::rand_time
fn rand_time(rng: &mut XorShiftRng, low: Time, high: Time) -> Time
[−][src]Function sim::make::activity_model::rand_time
fn rand_time(rng: &mut XorShiftRng, low: Time, high: Time) -> Time
[−][src]Function sim::make::activity_model::select_trip_mode
fn select_trip_mode(distance: Distance, rng: &mut XorShiftRng) -> TripMode
[−][src]Function sim::make::activity_model::select_trip_mode
fn select_trip_mode(distance: Distance, rng: &mut XorShiftRng) -> TripMode
[−][src]Module sim::make::activity_model
Functions
+[−][src]Module sim::make::activity_model
Functions
border_person | |
rand_time | |
robot_person | |
select_trip_mode |
use crate::{ IndividTrip, PersonID, PersonSpec, Scenario, ScenarioGenerator, SpawnTrip, TripEndpoint, @@ -483,25 +489,20 @@ fn select_trip_mode(distance: Distance, rng: &mut XorShiftRng) -> TripMode { // TODO Make this probabilistic // for example probability of walking currently has massive differences - // at thresholds, it would be nicer to change this graduall + // at thresholds, it would be nicer to change this gradually // TODO - do not select based on distance but select one that is fastest/best in the // given situation excellent bus connection / plenty of parking / // cycleways / suitable rail connection all strongly influence // selected mode of transport, distance is not the sole influence // in some cities there may case where driving is only possible method // to get somewhere, even at a short distance + + // Always walk for really short trips if distance < Distance::miles(0.5) { return TripMode::Walk; } - if rng.gen_bool(0.005) { - // low chance for really, really dedicated cyclists - return TripMode::Bike; - } - if rng.gen_bool(0.3) { - // try transit if available, will - // degrade into walk if not available - return TripMode::Transit; - } + + // Sometimes bike or walk for moderate trips if distance < Distance::miles(3.0) { if rng.gen_bool(0.15) { return TripMode::Bike; @@ -510,6 +511,17 @@ return TripMode::Walk; } } + + // For longer trips, maybe bike for dedicated cyclists + if rng.gen_bool(0.005) { + return TripMode::Bike; + } + // Try transit if available, or fallback to walking + if rng.gen_bool(0.3) { + return TripMode::Transit; + } + + // Most of the time, just drive TripMode::Drive }