Question: There are four traffic intersections in a square. 1 2 3 4 Cars enter at 4 coming from the south, and exit at 1, going

There are four traffic intersections in a square.

1 2

3 4

Cars enter at 4 coming from the south, and exit at 1, going north. The drivers can choose to turn left at 4, then turn right at 3, or go straight at 4, then left at 2, then right at 1. Right turn is allowed, after a stop, which adds 5 seconds to time to exit at 1. The lights at 2 and 4 have left turn arrows, and left turn is allowed on green.

Lights are left turn arrow, green, and red with the following number of seconds, all independent of each other, so the probability of getting a left arrow, green light, or red light will be the relative probabilities of each possibility.

Coming from the south:

Left arrow Green light Red light

1 10 40 40

2 15 30 50

3 15 55 30

4 10 40 35

Coming from the east, approaching 1 and 3, the times are

1 50 50

3 30 70

Left turn on green is permitted, with the probability 50% of being delayed 10 seconds by oncoming traffic.

Write a PYTHON program to simulate 10,000 cars traveling through the square and exiting, recording average time to transit the square. Assume it takes exactly one minute to drive the side of the square, adding the time required to wait at each light. Tally average time to transit the square according to each policy, the the decision to turn left at intersection 4 every time, go straight every time, or choose the best option at intersection 4.

There are three strategies:

1.Always turn left at 4

2.Always go straight at 4

3.Go straight at the light if it is green, otherwise turn left (possibly waiting for the turn arrow)

Determine the optimal strategy.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!