MarcusPope.com


Blog » 2013 » How Programmers Solve Real Life Problems

Sit tight boys and girls because this is my introductory homage to Steve Yegge and Les Orchard. Also realize this is a WIP, I just kept so much of it in my head that I had to dump it out, in no particular order, and without all of the supporting arguments that are to come.

Alex Sexton tweeted a link to this stackoverflow page that really speaks volumes about how entrenched programmers can get when dealing with inefficiencies. At first I mockingly laughed at all of the responses until I realized how I do the same thing, just with other routine chores in my life. My solution to the above problem is to buy and wear only black socks. I tend to buy in bulk, and I recycle them all once more than just a few have worn out. Then it's back to Target for a bunch more. If I could efficiently and socially do this with clothes I probably would, but I get enough heat for wearing the same hoodie every day.

For hanging clothes, I don't fold inside out before putting them on a hangar, makes a tedious process excruciating for me. And I can just as quickly put on a shirt that is inside out as one that is right side in, so I actually save some time. I always add all my newly washed clothes to the right side of my closet. This is a natural filter to weed out shirts that I don't like wearing anymore (for various reasons including vanity.) About once a year I take everything past the midpoint and donate it, then I buy replacements over the coming months depending on what's in season/style. This also reduces the time I spend each morning deciding what to wear. Only an aggregate of minutes per week mind you but still, optimized as much as I reasonably can for something I do almost every day of my life. I used to be ridiculous and fold inside out and consistently facing one direction (left) so I could more quickly decide, but the real problem wasn't that I couldn't decide without seeing the front, but that I had too many choices and many of those choices weren't really options I'd consider. Which ultimately drove my final optimization of moving all of my winter clothes to a spare closet during summer and vice versa.

I approach many menial tasks in my life with the same rigor. Not all of them and only if the process is particularly boring to me or if there's plenty to be optimized or if it's a process that I will have to do every day of my life. For instance, I don't untie my shoes, and I double knot them to make sure they don't come undone. My parents used to hate it, but it takes seconds for me to slip on and off my shoes and I don't deal with shoelaces coming undone twice a day or more. Had this site/the internet existed when I started leaving my shoes tied, I might not have saved the estimated 100 hours of my life lost to shoelaces. (*My estimate did not count the phase of my life where I wore flip flops every day for three years.)

I've optimized the hell out of my development process too, but I won't go into that. Because today I want to discuss traffic. This is the first of a long series, perhaps book (I'm looking at you O'Reilly, "Driving Hacks" much?), of knowledge that I will divulge as my armchair scholar's guide to solving traffic. This will mostly be a brain dump so bear with me.

I think I can solve traffic in Austin. We have a particularly bad degree of traffic for both our size and our geography. Being the second fastest growing city in the US right now doesn't help. Our inane naming conventions and organically driven growth, and our speed trap happy police force are not conducive to free flowing traffic. Being a long time Austinite and a delivery driver at points in my life as well, my first piece of advice to newcomers is get a gps device. Even iOS6 will do. Some of the optimizations I'd make could be implemented now. Others would require actual innovation from car manufacturers, but given the constraints put in place on the auto industry not even a good idea could make it into the manufacturing process... at least not for the enhancements I'd make.

Ultimately I plan to live the rest of my life in Austin, but between traffic and allergies, life isn't always so wonderful in this city. Fortunately science will ultimately solve both of those problems via advanced medicines only years away, and self driving cars which are almost here (thx google you rock.) But until then I'm dedicating about 5% of my life to solving traffic.

Rules that exist today could solve our problem. In Texas, most roads follow the constraint that the left lane is for passing. Under this law, you're not supposed to drive in the left lane unless you are passing someone in the right or are approaching a left turn. Even in the later case, we have what are called suicide lanes which are a single lange outlined in half dashed double yellow lines. People from both sides of the road are expected to share the middle turn lane. And in reality there are no set rules for sharing and in some cases the roads are 65mph, hence the term suicide. But generally in these cases the distance between two turns is significant and turns are typically only one sided so you don't have people merging at the same spot - typically. But with these turn lanes, you are supposed to enter the turn lane, then begin using your brakes. Braking in the left lane before entering the suicide lane defeats the purpose of the turn lane's purpose of keeping traffic moving while still allowing people to wait for heavy traffic before crossing a road. It's a really good first stage solution that tells you where to install a traffic light when traffic starts to back up into the left lane at specific spots.

See I got ahead of myself already, first we need to cover some definitions.

Cutting Someone Off

A majority of people think cutting someone off means you cut over into their lane really close to the front of the vehicle being passed (or cut off.) This scenario alone doesn't not qualify as cutting someone off. It's rude, and dangerous sure, but unless the driver forces this person to use their brakes, they were simply passing another vehicle. Being cut off means someone with the right of way had to unreasonably brake via either an amount of brake applied or when otherwise no braking would have been required. So if you enter a highway at below the highway's speed limit and you make traffic on the highway slow down, you essentially cut off a lot of people behind you. If you pull out from a parking lot and force someone to slow down until you pick up enough speed to be in sync with traffic, you cut them off. Today somone crossed a solid white line in a turn lane because their lane was too long for their preference, meanwhile I had to slam on my brakes from 65mph down to 20mph, I was cut off.

Ping Balling

This is a term I use for people who can't seem to find the right speed to travel. So they constantly speed up too much and then have to brake, but they brake too much and so they have to speed up. Sometimes it's not an issue of maintaining a constant speed, sometimes it's due to delayed reaction times in bumper to bumper traffic. These drivers will either not be paying attention when the person in front of them has moved forward quite some distance, or they are simply slow to react. In either case they ultimately end up acclerating when the the person in front of them is already slowing down, forcing them to brake late, in many cases they will brake to a stopping point even though the person in front of them was already driving forward again. Like a ping pong ball bouncing between two paddles.

Synchronized traffic

When vehicles are all driving at the same speed with nominal distances between each vehicle. This isn't always a good thing, especially when people behind you want to travel faster.

Shadow Tailing

This is a method of advanced driving where by you actually react not to the person directly in front of you but to the person in front of them. In cases where you cannot see around the person in front of you, you typically can see the shadow of the vehicle two cars ahead, perhaps more. By watching how close these shadows come together and what direction they are moving you can more accurately assess how much acceleration/deceleration is needed to maintain flow.

California Stop

Slowing a vehicle down to almost a stop and pausing long enough that it should really be considered a stop despite the fact that the wheels never actually stopped moving. This is a practice used by manual stick shift drivers in San Francisco on really steep hills, and south side drivers because hey there's too much sun and beach and beuatiful people to worry about actually stopping. Just make sure the coast is clear and no cops are in view. Always consider this practice in parking lots where cops do not have legal jurisdiction to enforce stop signs.

Lead Time

How much gap you put between you and the car in front of you, or their lead time. Highschool's teach something like 6 seoconds or even up to 14 on the highway. This is a ludicrous amount derrived from both the brake technology of the average drum brake equipped vehicle in 1970 and the notion that it will take you that long to come to a complete stop, so you'll need that length of gap to avoid an accident. Besides modern disc brakes and lighter vehicals requiring shorter stopping lengths, accidents due to this problem are only going to occur in the universe that doesn't abide by our current verse's physics or in a world where you don't pay attention while driving, neither of those worlds should ever exist. 2 - 3 seconds is very reasonable and is regularly practiced by a substantial portion of rush hour drivers. Experienced drivers can do sub 2 second lead times, but that will really annoy the person in front of them, so it is not recommended.

Visual Lead Time

This is the distance down the road you should be looking at most while driving. Typically 10 to 15 seconds depending on the road, meaning you are looking at a spot that you will reach in 10 to 15 seconds. This gives you time to adhere to road signs, avoid debris in the road, and avoid accidents before they happen.

Blind Spots

This is actually a myth these days. Virtually no vehical manufactured in the last two decades intended for class C drivers has blind spots. My worst offender was a 2003 mitsubishi eclipse spyder which had a tiny oval rear window built into the soft top, and no rear passenger seat windows, just black canvas all around. Even on that car, with only my driver and passenger side windows, side view mirrors and rear view mirror, I was able to see if a lane was clear simply by checking my mirrors and glancing left or right. If the person was not in my mirrors and not visible to the left or right of me, they were not there. Car's have federal stipulations to negate the blindspot of older classics. What ultimately happens is people set their side view mirrors incorrectly which produces an artificial blindspot.

Instead your side mirrors should be angled in such a way that you do not see the side of your vehicle. Almost counterintuitively they need to be angled much further outward. By doing so, you will see a car in your rear view mirror, then in your side mirror, then to the side of you, until they are in front of you. Motorcycles are the only vehicle that comes close to vanishing in between each of those views, but if set correctly you will see at least the tail ends in any one of them and any point.

Situational Awareness

The degree to which you are aware of every vehicle around you. At the extreme high, you know where every car in a 100 yard radius is at and doing. And at an extreme low, you are driving a box truck with blacked out side windows, wearing headphones blasting metallica while crusing with tunnel vision in whatever lane you've chosen. Striving for a high degree of situational awareness means you can confidently react to dangers on the road without needing to check your blind spots before swerving into them.

Compression Wave

This is a potentially deadly consequence of multiple people merging into a single lane, and/or people incorrectly braking to an excessive degree in traffic. When two cars are travelling with only a cars-length buffer between them and someone wants to merge in between the two, one of three things must happen. Either the person in front speeds up, the person in back slows down, or the person wanting to merge does either to find a different merge point. Rarely if ever do people maintain a degree of situational awareness to speed up in front. I do about 80 percent of the time, but even I will block a person from exiting a side street by accident every now and then.

Since most people don't notice when a car is pulling in behind them, and since most people merging into a lane take the "jump in without signaling because if I signal they won't let me in" approach the person behind the merging vehicle has* to brake to regain their desired lead time. If 15 people did this at once, and merged into a lane that had 15 people travelling with a 2 second lead time, you would create a compression wave that causes the last person in line to have to virtually come to a stop in order to merge over and anything but highway speeds. This is mainly why traffic comes to a grind when construction reduces a two lane road to one.

Critics of short lead times would argue that this is a good reason to have lengthier lead times. Unfortunately even with 15 second lead times, you would still run into this problem with as little as 15 cars. And if everyone drove with 15 second lead times you wouldn't have the physical road space necessary to accommodate rush hour traffic volumes. And even still, combine naturall compression waves with excessive braking tendencies and the problem is just as ever prominent as it is with two second lead times.

Clutching Gears

This is a term for manual transmission vehicles where by you can control the speed of the vehicle by not just using the gas and brakes but by engaging and disengaging the clutch and relying on engine friction to slow down a vehicle or freeing the friction to enjoy a longer coast.

Entropy (WRT Traffic, not thermodynamics)

This is the delta between the amount of traffic that can flow through any given space, like a city block or just an intersection, and how much actually does. Increased entropy means decreased traffic flow from nominal levels.

Excessive Braking

Braking rates should be a natural sloped curve. The rate should be consistent and nominal for the distance required at any given speed. Ideally it is consistent across all drivers and across all traffic types, but in bumper to bumper traffic people will do a slow crawl to avoid braking or clutching gears. And if people see a red light far down the road they will hit their brakes early and slowly to arrive at their ultimate end point. Excessive braking is when a person brakes harder than the person in front of them. This may be because they are outside of their lead time comfort zone, or perhaps they recently rear ended someone and are being overly cautious. Most of the time it's because they just don't know they are doing it. Because driving occurs in the 4th dimension, when someone in front of you starts braking, your lead time will begin to shrink. When someone is braking in front of you, you only need to slowly reduce your lead time until you are both stopped at your intended end points, where you can "see the persons wheels meet the road in front of you."

Conversely, when accelerating, you should gradually lengthen the lead time until you reach optimal speed and optimal lead time. You'll notice when people don't do this because they will end up with 20 to 30 seconds of lead time, meaning they didn't accelerate with the flow of traffic. Which ultimately means increased entropy.

Nominal Braking

Instead you should practice nominal braking. This means you break at a reasonable steady pace until you stop. The main problem with this approach is if you misjudge with too much braking you end up stopping well short of your end point or with too little force you end up slaming your brakes at the end or colliding with the object in front of you. The latter is obviously far worse, and without practice a plausible result. In lieu of nominal braking people instead do a multiphased brake approach where they lightly brake at first and subsequently readjust their braking rate the closer they get to their destination. This results in increased entropy and causes traffic to build up. But I'll explain how in more detail later.

Fake Braking

Another form of braking is fake braking. In this scenario people are typically lightly touching their brake pedal, perhaps unintentionally, and causing their brake lights to turn on. They aren't actually braking, but other people assume they are and actually brake. If you are just hovering over the brake you shouldn't actually touch the pedal because you will slow down traffic unecessarily.

Ghost Braking

The final type of braking is caused by a couple factors. Firstly, your brake lights are out - and you hit the brake pedal. The second source is from using gear clutching or tiptronic shifting to simulate braking without using your brakes. This is equally as bad as having broken brake lights. Don't do this either because people will not realize you are braking and may react with excessive braking in response. And don't be the jerk that does it to try and make a tailgater run into you, what kind of psychopath tries to induce an accident even if to just teach someone else a lesson in manners.

There's also just plain inappropriate braking when people brake for seemingly no reason. Nobody in front of them was braking, nothing was in the road, no turns were available, and they have plenty of merge space next to them, yet they press their brakes regardless.... wtf???

Hypermiling

This is an evil entropy-inducing practice of trying to extend your vehicle's MPG ratio to the vehicle's maximum potential. From coasting, to dolphin cresting this community is about as scientifically sound as free energy and perpetual motion enthusiasts. Ultimately they are the hair clog in the drain pipe world of traffic.

Bowing Salute, Braking Dip

These are terms that describe a vehicle's tendency to tilt forward when braking. A bowing salute is what you give a cop when you notice he's radaring you and you brake quickly thinking your reaction time is faster than the speed of sound/light. It's basically a salute to the cop that tells him or her you knew you were speeding. This is just a result of the forces applied to a vehicle's shocks during a braking period. Not all cars will do this, particularly sports cars that have very rigid and responsive shock absorbers.

<< more definitions to come >>

Here are some of my ideas for improving traffic flow.

Enforce Left Lane Passing Only laws

Use Tiered Lane Speeds

Highways should have different lane speeds for each lane. Right lanes should be lowered to 60mph, middle lanes increase by 10mph, and the left most lane should have a 20mph bump. We've already proven that 80mph speed limits in Texas work, so it's only a matter of time before 90 is acceptable. Starting at 60 and assuming a 4 lane per side highway, you would have 60, 70, 80, 100mph max speeds.

Reduce Visiblity of Law Enforcement During Peak Traffic

For some reason they are always travelling 10mph below the speed limit and for yet other unknown reasons people seem afraid to pass them even when the legal speed limit allows.

Excuse Tickets for Speeds Within 10mph of the Posted Limit

Between not knowing the speed limit and the Austin specific problem of variable speed limits per road (where the speed limit just jumps around by as much as 20mph on the same road with the same driving conditions) making people less afraid to speed up will improve driving conditions.

Ticket Those Who Don't Yeild Right to Faster Traffic

It's a good law, start enforcing it!

Increase Traffic Speed Limits During Peak Traffic

Given a fixed amount of road (space), and an increased number of vehicles (pressure), physics solves the problem by moving atoms faster through the space. Traffic must solve this problem in the same way, yet in traffic conditions people tend to drive slower and more defensively. Combined with the above, people will reach their destinations quicker and without impediment of inconsiderate drivers.

Categorize Traffic Speeds In 4 Groups

30 and below, 30 - 50, 50-70 and 70+. 5mph increments are simply too much for the average person to care to keep track of. As a result people typically drive slower than posted limits because they aren't aware of the speed limit. With four speed groups, you could easily color code the roads with repeating patterns of color so that at any point in time a driver can know what the speed limit is. Further still, with only four categories, it means people will generally drive at a safe and comfortable limit due to sheer self preservation.

Implement Brake Lights as Brake Meters

You may have seen some Mustangs that blink their brake lights as they are depressed. Some newer vehicles pulsate their brake lights for rapid decelerations. But a brake meter would tell you not only that someone is braking but how much they are braking. Instead we have to rely on how fast a vehicle is approaching you to determine how much they are braking. You can also watch for vehicle dip, but that can vary depending on the vehicle's shock quality.

Implement Gas Lights as Meters Too

While we're making brake lights meters, we should also embed green lights into the brake panel and light them up according to how much your accelerating. This would aid in knowing if a person far away is traveling at a constant speed or actually accelerating away from you. And it would aid in creating a consistent acceleration speed, where by people aim to accelerate at a 50% meter, assuming all meters are coded the same regardless of the vehicles potential, this would aid synchronized traffic flow and reduce entropy.

<< baby is crying, off to being a parent >>