Optimizing a vehicle’s route in an on-demand ridesharing system in which users might walk