Question: Use python to code this problem. This task requires physics modelling and computer science knowledge. 2. The Nagel-Schreckenberg cellular automata ( 30 points) (a) (20

Use python to code this problem. This task requires physics modelling and computer science knowledge.

Use python to code this problem. This task requires physics modelling and

computer science knowledge. 2. The Nagel-Schreckenberg cellular automata ( 30 points) (a)

2. The Nagel-Schreckenberg cellular automata ( 30 points) (a) (20 pts) Starting from the simple bulding blocks for a traffic model discussed in the lecture, write a code implementing the rules of the Nagel-Schreckenberg model (see page 11 of the lecture notes). We want to consider, in particular, a model with 100 cells which are periodically connected. The maximally allowed velocity is 5 in units of cells. (b) (10 pts) As initial state, place 10,20,50 cars at equal distances, all with velocity 1 . Consider a randomization p=0.3 (probability that velocity is reduced by 1). To implement the randomization of the velocities you can use the np.random routines, see numpy documentation. Plot the time evolution for 100 time steps in the three cases. In which cases do traffic jams occur? Nagel, K.; Schreckenberg, M. (1992). "A cellular automaton model for freeway traffic", Journal de Physique I. 2 (12): 2221.: The following four actions are conducted in order from first to last, and applied to all cars. - Acceleration: All cars not at the maximum velocity have their velocity increased by one unit. - Slowing down: Check if distance between a car and the car in front (in units of cells) is smaller than its current velocity. If the distance is smaller than the velocity, the velocity is reduced to the number of empty cells in front of the car to avoid a collision. - Randomization: The speed of all cars that have a velocity of at least 1 , is now reduced by one unit with a probability of p. - Car motion: Finally, all cars are moved forward the number of cells equal to their velocity

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!