Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 velocityStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started