Traffic Simulator
traffic-simulation.de
traffic-simulation.de
https://www.youtube.com/watch?v=yITr127KZtQ (https://news.ycombinator.com/item?id=17182008) (https://www.reddit.com/r/CitiesSkylines/comments/7h6zr0/traf...)
https://www.youtube.com/c/BiffaPlaysIndie/search?query=lane+...
This is frequently posted here on HN. E.g. https://news.ycombinator.com/item?id=25632642.
Wait a second. Ah well, point still stands.
E: It was a joke...
To do so use the yellow+red circles tool, pick a road node and press Shift+S. Repeat until traffic goes smoothly.
Another method he uses with that mod is to sometimes not allow changes anywhere on the road. Then he forces them to pick a lane when they cross an intersection that connects to the road.
Also along main roads with lots of intersections he has all the feeder roads yield and tells all the intersections to go on through.
https://github.com/dabreegster/abstreet#ab-street
If someone is looking for interesting Rust project to contribute (also as a beginner) I really recommend it. Author is great, friendly to PRs (what includes PRs made be programmers with no Rust experience).
The cars in the demo seem much much smarter.
EDIT: typos.
This way, agents would adapt their attributes to maximize their own local advantage, and therefore could see how large scale trends develop. I've driven in many countries and regions within countries, and it's just wild how "driving cultures" vary so much. Some places the drivers are so polite to the point it really makes things dangerous, other places the drivers are vindictive (distinct from being aggressive driver). It would be interesting to model how driving cultures emerge.
Edit: I guess the short story is I'm really curious why some places, like Bangkok driving is chaotic, dangerous, gridlocked, and no one adheres to traffic laws much or yields to pedestrians, but relatively devoid of road rage (and people will let you merge over if you need to). In DC, people carefully adhere to red lights, stop signs, pedestrians, etc but will go far, far out of their way to block you from changing lanes once they see your turn signal go on.
Also, exploring the game theoretic (probably prisoner's dilemma?) aspects of tailgating and how that seriously depends on the driving culture. When someone tailgates, the tailgatee can slow down (everyone loses), speed up or move out of the way (tailgater wins/tailgatee loses), etc. If everyone slowed down when tailgated, there would be no benefit of tailgating; if enough people give in when tailgated, that keeps rewarding the behavior. Anyway, that would be something fun to explore in one of these traffic simulations.
> Some places the drivers are so polite to the point it really makes things dangerous
I've known people like this, who will approach a 4-way intersection and stop even when they don't have a stop sign and the perpendicular street does.
Driving decisively is more important to overall safety than driving defensively.
That is, don't deliberately be mean, but don't extend any courtesy where doing so would come at the cost of being predictable.
if you have the right of way, and you do not take the right of way, in most cases you are effectively disobeying traffic rules and disrupting the flow of traffic.
When there is traffic you giving up the right away is impolite to the person behind you and shouldn't be done. unless traffic is so heavy that you won't be able to move, and so you should give you your right away to someone who can go.
Why does living in a rural area make someone more likely to have a reason to drive below the speed limit?
Not the main point but I never liked how traffic signs aren't affirmative sometimes. In the case of the 4-way usually the stopping direction have a stop sign with a missing "All Way" sign below it. But thats not required in all jurisdictions. Nor is the non-stopping direction 100% sure their stop sign is still visible (shrubs, weather, etc) and can proceed at regular speed.
I'm sure there are a ton of reasons for the way things are, I just think the outcome is you can't really ever be 100% sure what the correct thing to do is without slowing down and observing.
I live in a small town that has extra polite drivers. It was really confusing for a while. Eventually I realized that it was a practical response to the overall street layout, with a limited number of main streets, and different areas of town not being well connected. Stopping to let others cross improves the overall traffic flow - if no one did it, traffic would just be backed up for miles.
Based on my experience of living in different countries, differences in behaviour and car culture are often underlined by hidden aspects of legislation which support those differences. I'm thinking more in terms of who is liable in the event of a crash, rather than the actual traffic rules.
>Some places the drivers are so polite to the point it really makes things dangerous
I think the danger you are talking about generally comes from the lack of anticipation and lack of meeting expectations, rather than the politeness.
If you shock a driver's expectations, that will at least appear dangerous, because they have to consciously react (or crash). A Bangkok-style driver in DC is dangerous, just as a DC-style driver in Bangkok is the dangerous one.
The last part, yes, but the first half has very much not been my experience here in DC. I usually see at least one driver blow a stop sign, red light, or one-way street before I make it 2 blocks from my house. The other thing I found amazing is that it's totally normed that you can just park in the traffic lane whenever you want — not just FedEx/Amazon but I've seen people park downtown at rush hour, get their dry cleaning, and get back in their car as if it was normal.
I think the main cause here is that we have a bunch of poorly-trained commuters from suburbs where they're used to high speed limits and wide, less used roads but the traffic means they're lucky to average 5mph on their commute into the city and a certain fraction of people cut any corner they can because they think they're owed a higher average speed. They're “running late” every day because they don't want to admit that their “30 minute commute” is off by a factor of 2-3. I'm curious whether the pandemic will lead to people trying to stay at 100% telework after realizing how much better life is without spending a couple hours a day stuck in traffic.
Where are you seeing this?
Normally all those things you said would result in accidents. If the simulators randomly added delays for cars braking or starting up, and then kept a death count, it would be more accurate...
The bigger problem was that this type of behavior was the norm to the point where at slow speed intersections with stoplights (e.g. city streets around college campuses), only a single digit number of cars would be able to go through per green light.
Indeed, the most influential slider in the simulation seems to be the “max acceleration” one... if people accelerate quickly up to their max speed it seems to prevent traffic waves from propagating backwards. It meshes well with my observations 213929387 years ago when I used to drive in traffic.
So you would have various transition probabilities of a car driver moving from an attentive state into various inattentive states, with drivers having different reactions in each state.
It would also help to have a level of "variance" in individual drivers. So instead of having a bunch of drivers who are just as likely to make mistakes, you have some who transition far more easily into inattentiveness and some whose likelihood of damage/nuisance is higher than the standard driver when inattentive.
It seems entirely doable. (famous last words)
The observation on acceleration does make me wonder whether teaching proper merging etiquette better (reach freeway speeds before you're at the merge junction) would make a significant difference if properly followed.
Probably impossible, since it would cause heaps of rear ending accidents. Maybe if driver assist features both prevent lane changes and optimize avg. speed.
I'm beginning to delve into this space and I've not managed to get any satisfactory answers to these questions, despite my month(s) long search.
1) How does one build a traffic (i.e state-space system), forgetting the visualization aspect of things ? Just generating sparse matrices, and adding elements to interact (add/subtract) from these matrices would be a great start! Any way to do this in a compiled language ?
2) Are there any libraries out there that help you simulate traffic in an existing network of roads, extracted from OpenStreetMaps perhaps?
IIRC you could import maps from from open street map, but I'm not sure if it has a "headless" mode, without all the visualisation.
2) Another option with much less detailed traffic simulation, but much more UI focus, is abstreet.org
- Passing on the right
- Taking an exit from the passing lane (cutting everyone off)
- Couch in the middle of the highway
*Things have got better year on year, though. I have f+r dashcams - rarely needed, nowadays. If anything, they do ensure I drive better.
https://en.wikipedia.org/wiki/Induced_demand#Induced_traffic...
Rush hour is like pouring a 5gal bucket into a sink. You can't reasonably handle that all at once will have some water in it until it all makes its way through the pipe. But you have to be insane to use that as an argument against making the pipe bigger. Increasing the max capacity of the pipe (so more lanes, in the case of highways) means that it can have normal flow before it starts backing up. The "induces" demand because at the margins some people who were voluntarily changing their usage times to avoid the peak hours will commute at peak hours.
I am intentionally trying to use generic language here because this isn't a unique phenomenon to highways.
But even absent that, you want surface, collector, and feeder streets to be the natural "rate-limiting" parts of the network (in that order).
It's why it's especially egregious to wave-in people from a driveway or parking lot into traffic on an already congested street. It breaks the natural rate limiting.
The right-of-way rules are surprisingly well-thought out, from a systems perspective.
But the point is that you increase capacities where you can, and that it's better to start large with freeways, etc and work your way down, even if freeway capacity then exceeds feeder capacity (which then exceeds collector capacity, exceeds surface capacity).
Induced demand means that when you make the drain pipe bigger, the bucket gets bigger as well, so the sink gets even more full. This is not sustainable.
In the case of things like roads, rails and bus stops more utilization means more economic activity which is a good thing.
Also, land used for roads cannot be used for other economic activities.
If Traffic was the primary problem then the solution would be to eliminate roads.
Ever since cities were invented, people have refused to have commutes longer than ~30 minutes each way, on average.
The utility of the city increases with the number of people in the city.
The purpose of the transit system (roads, trains, buses, bike lanes, side walks, ferries, etc., etc) is to increase the usefulness of the city by increasing the number of people that can commute to the city.
If adding more roads, trains, etc leads to more commuters, that means the city is bottlenecked on the transit system, and you need to expand it even more.
The core argument of induced demand is that more roads won’t make your commute shorter. This observation shouldn’t be surprising, since commute times are a function of humans tolerance for long commutes, and have been mostly constant for > 3000 years.
I'd expect something more like 2 m/s/s (0-100 kph in 14 seconds) if it's a safety-related threshold and at least 1 m/s/s if it's a general operation setting.
That it's set so far away from that makes me wonder if I don't understand what it's used for.
You'll notice that traffic is actually a longitudinal wave that travels through the system. The cars are particles and traffic is crests in the wave.
The wave usually travels backwards against the direction of the cars. The worst type of traffic is when you get a standing wave where the crest of the wave just stays in the same place.
Take a look at the simulation with this knowledge in mind. Then you will actually see the wave.
An elegant solution to alleviating traffic would be to then take techniques that dampen waves in materials and translate them into techniques that work for traffic.
I do this in tunnels with heavy traffic where I know someone can merge in front of me. I keep a large space so I can prevent breaking and keep a constant speed. I get to the other end at the same time but everyone behind me gets a benefit from my constant speed instead of speeding up and breaking (wave).
Ultimately, the task is producing a good model of your domain and then organizing the data in such a way that you can quickly mutate a very large number of instances with each tick (if you are seeking real-time).
If you are not seeking real-time, you could probably do whatever the hell you want.
It's a system of ODEs that describes the dynamics of each driver. So the inputs are: the parameters of the model and the inflow of cars in the section of road
Which makes sense since those are basically the ideal conditions for reducing the number of obstructions low speed (merging, exiting, trucks on grade) traffic poses to higher speed traffic and reduces the effective road area of the obstruction.
Wish I could find it again.
ETS2 only comes with trucks as driveable vehicles. A lot of the skills are the same as driving normal cars, but trucks have more gears, are larger, and accelerate more slowly. Truck cabs also don't have rear-view mirrors; to look backward you have to either use side mirrors or stick your head out the window.
I have seen mods that add normal cars to drive. I downloaded one of those mods but haven't tried installing it. I'm not sure if those mods unlock the cars from the start or if you have to first save up for and buy five trucks to unlock the in-game online vehicle ordering catalog (which takes many hours of gameplay).