philosophizing on discrete-event sim. disable intersection merging; it's

mostly incorrect and needs lots more thought.
This commit is contained in:
Dustin Carlino 2018-11-28 19:56:32 -08:00
parent 17262063a1
commit d529b006cb
4 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,42 @@
# Discrete simulations
## Why are timesteps bad?
Discrete-time sim has two main problems:
1) It's fundamentally slow; there's lots of busy work.
2) Figuring out acceleration in order to do something for the next tick is complicated.
Discrete-event sim is the real dream. I know when a ped will reach the end of a
sidewalk and can cheaply interpolate between for drawing. If I could do the
same for all agents and states/actions, I could switch to discrete-event sim
and SUPER speed up all of the everything.
This possibly ties into the FSM revamp idea perfectly. Every state/action has
two durations associated with it:
- the best case time, calculated while pathfinding, which assumes no
conflicts/delays due to scarcity
- the actual time something will take, based on state not known till execution
time
## Intent-based kinematics
Instead of picking acceleration in order to achieve some goal, just state the
goals and magically set the distance/speed based on that. As long as it's
physically possible, why go through extra work?
Lookahead constraints:
- go the speed limit
- dont hit lead vehicle (dist is limited by their dist + length + following dist)
- stop by a certain point
## The software engineering question
Is there a reasonable way to maintain both models and use one headless/editor
for them? Seemingly, the entire Sim API needs to just be abstracted. Like the
DrawAgents trait, but a bit more expanded. Except stuff like time travel
applied to discrete-time sim can't support debugging agents or showing their
path. I think time travel with discrete-event would work fine -- just storing
all the previous states with the exact times.

View File

@ -117,3 +117,7 @@ Maybe start by hardcoding the things to merge. Don't worry about detection yet.
- extend two roads with points from the tiny road. delete i283 - extend two roads with points from the tiny road. delete i283
- make sure the road attributes match up - make sure the road attributes match up
- do this first; preprocess raw_data. - do this first; preprocess raw_data.
Ah, the problem with just extending geometry... I think turns need to be
polylines sometimes. Need to do the merging all the way at the end,
unfortunately...

View File

@ -76,3 +76,5 @@ Synthetic editor is awesome. How could it help test setup?
- for sim tests, print a command to run it in the UI - for sim tests, print a command to run it in the UI
Let's experiment and make a new binary crate for all tests! Let's experiment and make a new binary crate for all tests!
- it'd be neat to later integrate with travis.

View File

@ -66,7 +66,9 @@ impl Map {
) -> Map { ) -> Map {
timer.start("raw_map to Map"); timer.start("raw_map to Map");
if false {
make::merge_intersections(&mut data, timer); make::merge_intersections(&mut data, timer);
}
let gps_bounds = data.get_gps_bounds(); let gps_bounds = data.get_gps_bounds();
let bounds = gps_bounds.to_bounds(); let bounds = gps_bounds.to_bounds();