8 ms·
Traffic Simulator
- vwcx 5y agoRelated - Gridlock vs Bottleneck Simulator: https://setosa.io/blog/2014/09/02/gridlock/ https://setosa.io/blog/2014/09/02/gridlock/
- dang 5y agoThat looks good- you should submit it to HN sometime! Just not right away—it's best to wait for the hivemind caches to clear. If you do post it, email us at hn@ycombinator.com so we can put it in the second-chance pool (https://news.ycombinator.com/pool https://news.ycombinator.com/pool, explained at https://news.ycombinator.com/item?id=26998308 https://news.ycombinator.com/item?id=26998308), so it will get a random placement on HN's front page.
- mejackreed 5y agoThis is a lot of fun! It took me a minute to realize you could drag in traffic lights, hazards, and speed changes. The source for this project is available here: https://github.com/movsim/traffic-simulation-de https://github.com/movsim/traffic-simulation-de
- a1371 5y agoThis is delightful! As someone with urban planning background, my friends often stubbornly bring up in the conversation that "why doesn't the city just build more lanes on the roads?". I have to explain how that's not how it works and the more lanes cause more turbulence. You can try it with this! In one of the road scenarios make lots of lanes. Then give the system a "shock". I.e. move one of the sliders until you cause a traffic, then move it back. See how long it takes for it to clear up. The problem is that cars start changing lanes and cause mayhem. Lots of failure of this kind in the USA.
- sdoering 5y agoIf you let the system play and then just change the politeness so that many cars switch lanes you create turbulence and the average speed drops down. I found it very interesting to see.
- throwaway5486nv 5y agoThis is unintuitive and quite interesting. Whats your background?
- cinntaile 5y ago> urban planning background He just said it. The argument that I usually hear against more lanes is induced demand, but when I looked at some of the data this problem was very overblown. Going from 2 -> 3 or 3 -> 4. This is quite different from increasing 5 lanes to 6 though, then I can imagine it becomes chaotic and other problems such as the ones mentioned start to dominate.
- kqr 5y agoWell, the fixed parameter is people's tolerance for driving time. Everything else (including number of users) will scale up practically indefinitely. So if you give people more capacity, they will use it until they're back to their trip time tolerance, which is roughly at the same level of congestion. Is that not the case?
- bobthepanda 5y agoIt is, in the case where roads are free to use. Price is an extremely effective means of restoring flow to a congested system. Usually, how this works out is that a toll is placed on, say, an existing bridge to finance a parallel or upgraded replacement, and then magically traffic tends to disappear to the point where the new span is no longer needed. Of course, tolling untolled roads is extremely unpopular.
- kqr 5y agoRight, of course! Price is a fantastic general way to reduce demand for limited resources so it matches supply. (It's also a great way to ensure the rich get richer, but that doesn't detract from your point.)
- throwaway0a5e 5y ago
- leonry 5y agoThat would be another instance of the Braess paradox (https://en.wikipedia.org/wiki/Braess%27s_paradox#Traffic https://en.wikipedia.org/wiki/Braess%27s_paradox#Traffic), correct?
- anta40 5y agoBraess's paradox?
- mrfusion 5y agoThere are lots of options like express lanes or secondary roads. On the other hand hitting Georgia on 95 south really shows the advantage of adding a third lane. Hard to argue with that example.
- op00to 5y agoIt shows the short term advantages of adding a lane. It pays no mind to what sort of development the new, higher traffic flow will bring, and how that will eventually doom that third lane addition to be just as congested as before. The solution isn’t adding more capacity to roads, it’s getting more people and things off the roads and onto alternative means of transportation.
- sokoloff 5y agoMake alternative means better (chiefly faster or overall cheaper) and people will adopt them. People might not all be geniuses, but they’re not stupid.
- anamax 5y agoYou're assuming that satisfying demand is not a good. You're also arguing that we should wear a hair-shirt until the rapture. (If the alternatives can't compete with relatively good traffic, if they're only used when nothing else works, how good are they.)
- scrose 5y ago
- girafffe_i 5y agoI haven't heard about more Lanes causing more turbulence, but I would bet on it at face value. The main argument for not widening roads is that it creates induced-demand for more traffic on general, which doesn't solve your problem.
- dang 5y agoPast related threads: Traffic Simulator - https://news.ycombinator.com/item?id=25669316 https://news.ycombinator.com/item?id=25669316 - Jan 2021 (140 comments) Microsimulation of Traffic Flow - https://news.ycombinator.com/item?id=19670831 https://news.ycombinator.com/item?id=19670831 - April 2019 (159 comments) Traffic Simulation - https://news.ycombinator.com/item?id=11881964 https://news.ycombinator.com/item?id=11881964 - June 2016 (21 comments)
- Tempest1981 5y agoIncreasing "Max Accel a" results in much happiness. Faster cars, and more aggressive drivers?
- kqr 5y agoThat's not too surprising. One of the reasons we get traffic jams that persist is that when the car ahead of you accelerates out of it at the other end, you wait a little until there's some distance between you until you accelerate out of it. So effectively, by waiting for separation before speeding up, you're transmitting the congestion upstream. Of course, real people can't just floor it at the same time as the person ahead of them. When the military drives in tight convoys, they use things like hand signals to make everyone throttle up at the same time and maintain the distance between them. It's frightening the first few times you do it because it goes against all instincts. So yes, that works. No, it's not a practical solution.
- josephcsible 5y agoAren't the things you're describing more like "Time Gap T" than "Max Accel a"?
- kqr 5y agoI guess I'm hand-wavily referring to both. The time gap might be the actual delay, but after waiting for some separation, most people also don't aggressively maintain that separation -- they let the distance grow longer for a little while to get even more separation. I guess that's the max accel.
- swinglock 5y agoOne of few good reasons for connected cars.
- rixed 5y agoCars seem to be able to switch line even when slowed down to ridiculously low speed. Is there a parameter to control minimum speed for a line change that I'm failing to see?
- sdoering 5y agoWhen I'm stuck in a traffic jam on the autobahn in Germany and it's almost impossible to move forward at all, I see it all the time that people want to change lanes in the hope that they can gain a few meters there. In return, they cause a traffic jam in the new lane to the rear. Therefore, I would report from anecdotal experience that lane changes are possible even at near standstill.
- capableweb 5y agoAgree! If anything, people seem to be more likely to change lanes the slower traffic is. If the traffic is flowing, people tend to stay in the lane that matches their preferred speed.
- rixed 5y agoTrue, but on the simulation some cars look like they move laterally. Maybe I should just assume that the scale of the rendering is not 1:1.
- goplayoutside 5y agoCGP Grey: The Simple Solution to Traffic. https://youtu.be/iHzzSao6ypE https://youtu.be/iHzzSao6ypE
- false-mirror 5y agoThe ACTUAL Solution to Traffic - A Response to CGP Grey https://youtu.be/oafm733nI6U https://youtu.be/oafm733nI6U
- jacquesm 5y agoTrains are fine for inter-city traffic > 20 km or so, below that, if you can, take a bicycle. It is a much better solution than a train for door-to-door.
- JanNash 5y agoI’ve wanted to play with something like this for ages. Really nice, thx :)
- capableweb 5y agoRelated project that goes more in depth with modelling a whole city section (with focus on realistic traffic patterns: https://github.com/a-b-street/abstreet https://github.com/a-b-street/abstreet - Transportation planning and traffic simulation software for creating cities friendlier to walking, biking, and public transit Very interesting project which I played around with a bit and tried hacking on it to add cities I live in, but the slow Rust build times makes it kind of chore so never really managed to create something good with it.
- dkrajzew 5y agoWhen being interested in traffic simulations, you may try https://www.eclipse.org/sumo/ https://www.eclipse.org/sumo/ as well.
- foooobaba 5y agoThis looks very cool, thanks for sharing!
- npteljes 5y agoFreeways is also an excellent sandbox where you can try your prowess in highway design. https://captaingames.itch.io/freeways https://captaingames.itch.io/freeways (not affiliated, I just had a good time playing)
- adhesive_wombat 5y agoOne thing that really annoys me is "elephant racing" where trucks battle to overtake at very small relative speeds (probably because they're both on their limiters but one has a slight calibration advantage). Especially on 2 lane roads where they block everyone while doing so. Say a truck has a length of 16m, and starts the overtake 10m behind another one, and merges back in 10m in front. So that's an overtake distance of 36m. At 1mph relative speed, this takes 80 seconds. Meanwhile, the cars behind the truck have all had to drop out of cruise and are now doing 10mph under their preferred speed (car speed limit is 70, lorries are 60). So that 80 seconds and 10mph under is 10 seconds of overall journey time. Not enormous, but it multiplies across all the cars in the queue, and across the number of lorries making this move in a journey. However, the point is that if the overtaken lorry could just ease off the throttle by a single mph, he'd halve the overtake time, at a cost to himself of 1mph less for 40 seconds, which is less than a second of journey time. So, when overtaken, a very minor "altruistic" gesture on the part of the shower lorry pays back dozens or hundreds of times over to other road users. And that's without considering the travelling waves that linger after dozens of cars slow down from a rolling roadblock and can make the whole road slower for everyone for a long time.
- vladvasiliu 5y agoWhile I agree with your overall point, I think there's even lower hanging fruit that's still not picked up. In France, at least, when there are more than two lanes, basically no one drives on the rightmost lane. Yes, I know about the traffic law requiring staying in your lane if there is dense traffic. I'm specifically talking about the case when there is little to no traffic.
- adhesive_wombat 5y agoThat's a huge issue too in the UK, especially on three lane roads and wider, where you can just sit in lane two forever, if your skin is thick enough, and everyone will just have to over- and under-take you. It's actually been illegal for some years and can get you a £100 fine, though I don't know if that's ever actually happened: you'd have to have the bad luck to encounter traffic police who do anything other than speed-gun free-flowing motorways from bridges.
- FabHK 5y agoIf you want to understand some of the theory behind this, and applications (some of them counterintuitive - slow down the traffic at specific points to achieve higher throughput overall, etc.), I can recommend this edX course: https://www.edx.org/course/intro-to-traffic-flow-modeling-and-intelligent-tra https://www.edx.org/course/intro-to-traffic-flow-modeling-an...
- belter 5y agoThe best lesson here, is how much tuning the "Politeness" parameter impacts the creation of traffic jams. Maybe public authorities could take the hint, and use it in public campaigns to reduce congestion? Edit - The book behind the site: "Traffic Flow Dynamics" http://traffic-flow-dynamics.org/ http://traffic-flow-dynamics.org/
- dasKrokodil 5y agoI love the 'politeness' slider :)