But how many cars - 5 cars parked 100 ft from each other or 4 cars with 50ft in between ? You can see how this gets tricky ...
This is what I meant by what are all the conditions when the car should drive towards the center rather than left. Undoubtedly there are others.
Now the question is - how do you implement all this without hardcoding. After all you want a generic solution where the cost-optimizer chooses the best path.
The thing that comes up again and again is context. The car needs to know the context of the road it is driving on to understand how best to optimize safety, and still get to the destination efficiently.
For myself, the 2 mile road I drive on every day is a good example of needing to basically have it all. It is 1.5 unmarked lanes for half of it, and 2 narrow marked lanes for the rest. There are several small landslides, where the road is either partially missing or the dirt is so far on the road that you must drive over the double yellow or scratch the car/hit a ditch.
The speed limit is 30-35 mph. Most people do less than that, especially where it's very bad. We also have a "temporary" bridge made of 2 train cars. I expect this bridge to be temporary forever.
For the first 0.5 miles the right and left are pretty rough, so staying right in the middle is common. Most everyone slows down here because of the blind corners.
The next 0.5 miles are very windy, so people usually try to position the car where they have best visibility. This can be either the left or right sides depending on location.
The next 0.5 miles start with the bridge crossing, where the car needs to put 2 wheels on each train car, and slow down for the speedbumps. At this point after the bridge, the road has lines, but almost immediately you come to a place where 1/3 of the road is missing and a pair of construction barricades is the only warning that you must cross into the oncoming lane.
The final 0.5 miles has a landslide where 1/3 of the road is missing, and several other parts are slightly too narrow, so many people drive about a foot over the double yellow, to avoid getting the car scratched.
When I look at this road, it really is amazing that the only complaints I currently have, are when it slows too much to 13-15 mph, and it doesn't always know that this corner you really want to be on the inside or outside depending on all the conditions above. Also, sometimes it will cross the double yellow completely on a blind corner.