Commit Graph

1323 Commits

Author SHA1 Message Date
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
Dustin Carlino
7bb1d5b59c Switch the UI's spawn_agents_around intersection to go through Scenarios instead of reaching into internal sim spawning gunk. Lock down visibility of some sim spawning things. #258 2020-11-17 11:13:42 -08:00
Dustin Carlino
2abeebc55e Add a third TripEndpoint case to appear at an exact Position (lane + distance). This is a necessary step before simplifying Scenario's IndividTrip to use TripEndpoints and mode instead of SpawnTrip. #258 2020-11-17 10:50:42 -08:00
Dustin Carlino
5ea3c2ba6f Remove support for remote trips, and stop plumbing off-map locations. A
remote trip goes between two locations off-map, specified just by a GPS
coordinate. The trips aren't simulated at all. They were originally
added to support Orestis's pandemic model, to handle transmission
off-map in shared buildings. This work has died off, there are no other
anticipated use cases for remote trips, and they complicate bigger
refactorings. #258

This also has the nice side effect of substantially reducing scenario
size -- huge_seattle from 177MB to 147MB. That unused metadata was
expensive!
2020-11-17 10:14:23 -08:00
Dustin Carlino
32dea68f5d Measure how many simulation events actually result in something
changing. #368
2020-11-16 11:51:24 -08:00
Dustin Carlino
3433fd99e0 Smarter traffic recorder. Capture the exit point when the vehicle crosses the entry point. Otherwise, in the Krakow scenario of interest, the vehicles piling up and making poor LCing decisions actually get blocked by other gridlock and never make it to the exit. #382 2020-11-16 09:59:43 -08:00
Dustin Carlino
754749a578 Parallelize part of scenario spawning. One of the code paths calls
biking_connection, which does a slow graph floodfill.

Prolet robot in Krakow: from 22.6s to 10.1s

Because Krakow now uses separate sidewalks and they're not properly
connected to the road graph yet, biking_connection has to search very
far. The speedup isn't noticeable in other cases.
2020-11-16 09:36:48 -08:00
Dustin Carlino
b9ff94f275 Fix crash in krakow with a biking trip that should get converted to a walking trip, but isn't 2020-11-15 19:59:31 -08:00
Dustin Carlino
24e1a48d75 Generalize TripSpec::NoRoomToSpawn to handle trips that're impossible to instantiate. Hitting this with 'random traffic' in krakow. #258 2020-11-15 17:52:54 -08:00
Dustin Carlino
d3aa81d2d2 new tool to record a scenario consisting of all traffic around some intersections, to help with producing a better test case for #382 2020-11-15 16:57:33 -08:00
Dustin Carlino
22cef74aec Always allow blocking a degenerate intersection. Visually inspected on
the lane-changing test map. #382

Also abandon sim.run_until_done; the only caller was the LC test, and it
uses 30s steps inappropriately anyway.
2020-11-12 11:34:17 -08:00
Dustin Carlino
62135ffc26 Allow blocking the intersection at another Green lake case, and trigger a [rebuild] 2020-11-12 10:37:21 -08:00
Dustin Carlino
3583d068a6 Fix a bug introduced in e3b9c42506 on the proposal saver, and allow blocking-the-box on another Ballard intersection 2020-11-11 13:20:56 -08:00
Dustin Carlino
e5ff76e00c Working on gridlock in the Ballard map. Allow blocking-the-box near the
famous Green Lake intersection, and add a little debug tool to see
current queue reservation length.
2020-11-11 12:43:28 -08:00
Dustin Carlino
07ac288e72 Refactor: rename Pt2D::from_gps to just gps.to_pt(bounds) 2020-11-10 12:00:43 -08:00
Dustin Carlino
e15efa9002 Organize raw maps by city. With this, data/input/ is totally namespaced by city! Nothing prevents us from having a map named "downtown" in multiple cities now. #326 2020-11-05 14:58:28 -08:00
Dustin Carlino
cda586dfc9 Cleanup by moving some methods to belong to MapName. #326 2020-11-05 14:18:13 -08:00
Dustin Carlino
4f2cda8d53 Reorganize data/system/ files by city! The only interesting change is
abstutil::path_all_maps becoming abstutil::list_all_maps. #326
2020-11-05 14:05:48 -08:00
Dustin Carlino
67530bec07 Future-proof file organization by changing map_name from a string to a
struct. Whatever choices we make next about naming cities hierarchially
or not can be managed in just one place. #326

This is a pretty huge change, but the compiler gives reasonable
confidence it's correct. More bugs are likely to crop up in the next
step, when filenames start being namespaced by the city too.
2020-11-04 17:26:32 -08:00
Dustin Carlino
3ed7e73aa8 Use a u64 RNG seed, not a u8 2020-10-29 09:25:07 -07:00
Dustin Carlino
3b838c1225 Finish formatting distance/duration/speed units nicely. And remove the
number of lanes from trip info; it's misleading and not useful. #331
2020-10-28 11:33:48 -07:00
Dustin Carlino
9dbb156058 Skip wakeup_waiting while we're handling live map edits. Based on the
order of vehicle deletion, we try to ask about stop sign and traffic
signal movements that may be deleted and would be irrelevant anyway if a
different deletion order happened. #312

We should really defer wakeup_waiting until after all cleanup is done,
but for now, willing to risk some stuckness at a stop sign...
2020-10-23 12:15:51 -07:00
Dustin Carlino
3db8fe6669 Also need to clean up vehicles that're laggy heads on live-edited parts
of the map. #312
2020-10-23 11:58:43 -07:00
Dustin Carlino
781604907c While deleting cars for live edits, don't opportunistically lane-change for woen-up followers. They're likely about to be deleted, too. #312 2020-10-23 11:38:21 -07:00
Dustin Carlino
5973da0717 Handle bike trips that wind up with no actual biking portion due to live
edits. #312

... And with this, traffic seitan makes it through an entire day at
montlake! Next up, lakeslice I guess.
2020-10-22 21:39:54 -07:00
Dustin Carlino
773176f321 Handle live edits affecting multiple cars at one stop sign, and cars
turning to/from an edited lane. #312
2020-10-22 21:04:12 -07:00
Dustin Carlino
50c9c3236d Deal with a race condition. #312
1) A car tries to spawn, but fails because there's something in the way
2) The player makes live edits
3) The retry occurs, but the path has become invalid due to edits

Need to make the detection of this more efficient later.
2020-10-22 19:53:49 -07:00
Dustin Carlino
058103b84f Cars in the process of parking were being double-counted for deletion in
live edits! #312
2020-10-22 14:28:16 -07:00
Dustin Carlino
22ae06c3a4 Remove the --pathfinding_upfront option. #312 and #258
Originally, all trips in the entire scenario had their paths calculated
at the beginning of a simulation. The sum time is faster than
calculating them individually, because we could use multiple threads.
But a while ago, this was disabled by default to improve the startup
latency. Especially if a player isn't making it through an entire day
anyway, calculating all of the paths upfront is a waste and slows down
their initial experience.

Now I'm hitting all sorts of bugs with live map edits, because the map
change between initial planning and when a trip starts. Previously, the
PathRequest was calculated up-front and resolved when a trip starts. But
even this PathRequest can become stale. So now always calculate it when
a trip actually starts, looking at the current map. To do this sanely,
totally rip out support for --pathfinding_upfront.

If we really want it later for performance, we could add it back in, and
be very careful about detecting stale PathRequests and recomputing. But
for now, there's no use case for this, so it'd needlessly complicate the
code.
2020-10-22 13:47:03 -07:00
Dustin Carlino
cd62ad26d1 Lazily fix up TripLeg when the exact starting position for somebody
biking changes due to live map edits. #312
2020-10-22 12:47:41 -07:00
Dustin Carlino
83c1c09936 Notify the player how many trips got oofed after live map edits. #312 2020-10-22 11:58:16 -07:00
Dustin Carlino
8e6aa08d59 Breakdown agent counts much more in the tooltips. #331 2020-10-21 14:26:59 -07:00
Dustin Carlino
3d1ca3af9e Handle live map edits that rip away parking while a car is actively parking in it. #312 2020-10-21 13:00:49 -07:00
Dustin Carlino
adcd0f65fe Clean up some of the trips state when abruptly deleting agents. #312 2020-10-21 12:32:14 -07:00