Question: python Dynamic programming code, find the minimum cost path in 2d array of: 1 2 3 4 entering from 4 (south) and exiting out of

python Dynamic programming code, find the minimum cost path in 2d array of:

1 2

3 4

entering from 4 (south) and exiting out of 1, after entering we can go straight to 2 and then to 1, or we can go to 3 and then to 1. it is possible ot go right but it will cost 5 seconds extra time to exit to 1.

left turn arrow, green light and the ref light, there are probebalities that you may land on one of each lights,

if you are coming from number 4

python Dynamic programming code, find the minimum cost path in 2d array

if you enter from east and try to get to 1 and 3,

of: 1 2 3 4 entering from 4 (south) and exiting out

Also , left on the green is allowd, but the probability is %50 of getting a 10 seconds delay by the coming traffic.

Write a 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:

Always turn left at 4

Always go straight at 4

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

Determine the optimal strategy.

Coming from the south: Left arrow 10 15 15 10 Green light Red light 40 50 30 35 40 30 2 3 4 40 Coming from the south: Left arrow 10 15 15 10 Green light Red light 40 50 30 35 40 30 2 3 4 40

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!