Commit Graph

1356 Commits

Author SHA1 Message Date
Dustin Carlino
3c27255479 15 min tool: Optionally don't allow walking on shoulders. #393 2020-12-24 15:52:00 -08:00
Bruce
3be45b8221
Add a Variable phase (#433)
* Add a Variable phase

Variable provides a min duration, a delay duration, and an additional duration. The maximum cycle time is min + additional. Once min has been exhausted, if there is demand, the cycle is extended by delay until there isn't any demand or the additional duration has been consumed.

#295
2020-12-24 12:33:47 -08:00
Dustin Carlino
d917008f2e Lift SimpleState to widgetry, since it doesn't depend on any details of
the App at all. Use it in the experiment a bit.
2020-12-17 12:23:57 -08:00
Dustin Carlino
0831d112ed Simplify the trace API even more -- everyone but the simulation deals with unmodified paths and wants the original start 2020-12-16 16:14:33 -08:00
Dustin Carlino
d00e7f7bca Simplify path trace API -- nobody needs dist_ahead. I think that was originally meant to be a performance trick to only draw the next little bit of a route 2020-12-16 16:09:11 -08:00
Dustin Carlino
d4fa67ac87 Make the one-mode path guesses more precise in their start/end locations. Noticeable effect is in the freeform agent spawner, the paths actually go between buildings now, instead of lane starts. 2020-12-16 15:49:03 -08:00
Dustin Carlino
7c973ecacf Expose continuous distance crossed for vehicles. #392 2020-12-16 15:29:55 -08:00
Dustin Carlino
b39aa2a45f Expose continuous distance crossed for pedestrians. #392 2020-12-16 15:09:06 -08:00
Dustin Carlino
a5b62cd454 Simplify CreateCar, using the PathRequest embedded in the router's Path 2020-12-16 13:23:33 -08:00
Dustin Carlino
f36854cc5b Simplify TripPhase now that PathRequest is embedded in the Path 2020-12-16 13:02:59 -08:00
Dustin Carlino
fccc98205c Refactor: Store the input PathRequest inside the resulting Path. This
saves lots of callers from cloning the request and separately plumbing
around the requested start/end distance. Also a step towards exposing
more granular distance crossed in a path for #392.

Still a few more places to simplify, but will do in a separate, smaller
change.
2020-12-16 12:55:57 -08:00
Dustin Carlino
e8f7e7444c Treat vehicles waiting to spawn as active. #392 2020-12-16 12:05:15 -08:00
Dustin Carlino
2b4b92664e Much needed refactor: map.pathfind() returns a Result, stating the failed request. Many call sites were cloning the request and doing this anyway. 2020-12-16 10:06:12 -08:00
Dustin Carlino
a0555d1df5 Add an API call to estimate the best-case duration of a trip. #392 2020-12-16 09:42:50 -08:00
Michael Kirk
375e0caeb8
integrate census scenario (#426)
#424
2020-12-14 20:27:57 -08:00
Dustin Carlino
fb9635e8c8
Copy some pieces of the proletariat robot model into the new popdat pipeline: (#419)
- mode choice
- going off-map when there's no building on-map to satisfy a particular
  activity
2020-12-10 14:51:36 -08:00
Dustin Carlino
544dda9c5c When looking for turn conflicts, treat reserved turns (created before
starting an uber-turn) the same as accepted turns, updating the
blocked-by graph and allowing a movement to start if a cycle is
detected.

No effect in montlake or lakeslice, and very slight progress at the
Krakow roundabout for #382 -- increasing a tiny 26 trips by 7:20 am.
2020-12-03 10:56:42 -08:00
Dustin Carlino
5dba8f5896 Make the blocked-by graph used for debugging and the API detect problems
from somebody about to start an uber-turn.
2020-12-03 10:21:43 -08:00
Dustin Carlino
69b14e444f Simpler abstutil APIs: return string errors immediately, don't make callers transform. We don't need to distinguish different error types anywhere. 2020-12-02 08:44:07 -08:00
Michael Kirk
ddfaf73eae Improve lane changing vis-a-vis uber turns.
1. Allow lane changing in an uber turn. Because of the way uber turns
   work, we lock in and commit to all the lane changes just before
   entering the uber turn.
2. Avoid overzealous lane changing by combining number-of-lanes-crossed
   and numer-of-vehicles-in-lane into a single cost, rather than always
   preferring the least  number-of-vehicles-in-lane.
3. Don't lane-change unless the candidate lane's cost is strictly better
   than the current lane cost.
2020-12-01 19:20:53 -08:00
Dustin Carlino
30ce82bd3c Collapse get_pathfinding_request from TripSpec into start_trip. Avoids double-calculating paths (for driving trips, because of capping) and consolidates logic a bit more. #258 2020-12-01 16:42:36 -08:00
Dustin Carlino
14fd697282 Collapse/consolidate some logic involving DrivingGoal and TripEndpoint. #258 2020-12-01 16:04:48 -08:00
Dustin Carlino
d0b25d3530 Slightly refactor spawning cars during trip transitions #258 2020-12-01 15:30:17 -08:00
Dustin Carlino
4f764d6b87 Plumb options for delaying capped trips, instead of cancelling. Don't actually handle it yet. #325 2020-12-01 14:37:55 -08:00
Dustin Carlino
57963126fa Fold number of housing units into Building; ditch the extra file approach. 2020-12-01 12:43:19 -08:00
Dustin Carlino
2ebaf99e0d A fresh attempt at finding the root causes of gridlock map-wide 2020-12-01 10:50:05 -08:00
Dustin Carlino
b5ea263fc1 Expose the blocked-by graph through the API, and add root-cause analysis
to the UI debugger. #392
2020-11-30 17:01:15 -08:00
Dustin Carlino
8501ec70f9 Make the blocked-by graph more exploreable. Remove older debug code that
did something similar. #392
2020-11-30 15:15:13 -08:00
Dustin Carlino
6dd14c8bed Don't crash when jumping to nonexistent trip or when clicking
follow/unfollow for a trip without an agent.
2020-11-30 14:20:37 -08:00
Dustin Carlino
3eda17627b Handle binary or JSON scenarios 2020-11-30 14:00:19 -08:00
Dustin Carlino
72e54c68d8 Fix a bug with TripManager's spawn_ped -- it wasn't actually cancelling trips when pedestrians don't have a path for the second leg of their trip. #258 2020-11-25 10:34:53 -08:00
Dustin Carlino
903eab1bc4 Remove some old savestating optimizations from the simulation. The
optimizations avoided serializing Analytics and paths of to-be-created
agents, to reduce the file size. The logic to manage all of this isn't
worth the complexity anymore, because:

1) We don't queue up a bunch of spawn commands anymore; we defer
pathfinding until the last minute anyway.

2) We're not using savestates except for occasional manual debugging.
Previously, there was an idea to quickly preview prebaked traffic
mid-day. That idea was never fleshed out.
2020-11-24 15:38:20 -08:00
Dustin Carlino
ab88010ed0
Refactor PathRequest creators that go between two buildings. #176 (#404) 2020-11-24 13:21:44 -08:00
Dustin Carlino
0dd246c83f Remove the old --num_agents flag, used for debugging spawning agents 2020-11-22 18:27:25 -08:00
Dustin Carlino
47d09d61f0 Plumb the intended TripMode for cancelled trips; instead make the trip duration optional. Breaking change for anyone using the API. Makes way more sense. [rebuild] [release] 2020-11-22 11:21:44 -08:00
Dustin Carlino
9b018e42a1 Make the blocked-by graph also understand target queue being full. Still
not handling all cases yet. #392
2020-11-20 14:48:56 -08:00
Dustin Carlino
e43f551af6 New query and debug viewer to get the full graph of agents waiting on others. #392 2020-11-20 14:19:19 -08:00
Dustin Carlino
4690ea36cd Reduce visibility of some sim crate stuff. #258 2020-11-19 14:53:27 -08:00
Dustin Carlino
3905131fe4 Track and expose total trip distance in the API. #392 2020-11-19 10:40:00 -08:00
Dustin Carlino
cb4b84873b Refactor code into person_finished_trip for all trip transitions. #258 2020-11-18 19:05:44 -08:00
Dustin Carlino
37ae02352e Just reorganize TripManager code a bit. #258 2020-11-18 18:30:03 -08:00
Dustin Carlino
e6e7ec42ff Collapse two methods in TripSpawner. While we validate a TripSpec, also produce the TripLegs. Also get rid of the stateful TripSpawner entirely. #258 2020-11-18 15:08:06 -08:00
Dustin Carlino
915e12ff7e Remove PersonID from Scenario; the simulation will assign IDs sequentially. They're redundant. #258
Slightly reduces scenario file size, and simpler code to construct
scenarios.
2020-11-18 14:13:25 -08:00
Dustin Carlino
4ab98b1477 Compact the schedule in Scenario by just storing each TripEndpoint. #258
The schedule validation changes slightly. No-op trips between the same
origin/destination are now an error and get filtered out.

huge_seattle scenario goes from 129MB to 110MB with the redundant
endpoints removed.
2020-11-18 11:13:09 -08:00
Dustin Carlino
739e33ec3e We do need to fill out trip legs for TripSpec::SpawningFailure; smoke tests in other maps hit it. #258 2020-11-17 18:02:48 -08:00
Dustin Carlino
82c7cd1e8f At last, collapse the OD -> SpawnTrip -> TripSpec function into one thing. #258 2020-11-17 17:55:29 -08:00
Dustin Carlino
7741ea79b5 Refactor starting trips -- caller passes in TripInfo. Stop inferring
TripEndpoints from TripLegs. #258

NOW regenerate scenarios. I'm confident this sweeping refactor didn't
break behavior, because prebaked data didn't budge. huge_seattle
scenario went from 147MB to 129MB. Not bad!
2020-11-17 16:59:37 -08:00
Dustin Carlino
8d80668a56 The big cutover: a Scenario's trips are now just start/endpoints and mode, not the old SpawnTrip structure with a bunch of different cases and details picked out. #258
Not regenerating scenarios yet...
2020-11-17 16:28:52 -08:00
Dustin Carlino
8d28274736 Simplify the old ScenarioGenerator, mostly by removing OriginDestination
in favor of Option<TripEndpoint>. The bike/car contention tutorial stage
has to be tweaked manually, since there's no longer a nice way to spawn
vehicles at a non-border intersection and force them to use a certain
DirectedRoad. #258
2020-11-17 15:51:30 -08:00
Dustin Carlino
0599d4b47b Whittle down places constructing SpawnTrip manually. #258 2020-11-17 14:10:47 -08:00