Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a simulation in Python. Network of cars going in a square (4*4) so 12 possible segment locations. Coded as points on a graph i.e.

Create a simulation in Python.

Network of cars going in a square (4*4) so 12 possible segment "locations". Coded as points on a graph i.e. segment 0= (0,0), segment 1= (1,0) etc.

Write a method which runs for every simulated the following three:

1.creating cars: in every unoccupied segment, set the state to occupied with default probability= 0.1 (Represents new cars joining the road).

2.death of cars.: in every occupied segment set the state to unoccupied with default probability =0.1 (Represents cars leaving the network)

3.normal traffic: every occupied road segment can move on to the next segment provided it is free

Create a class to hold the state of the car so about what segment the cars are on (i.e. store the data).

An additional method should plot the square network with road segments that are occupied by a car in red and those that are empty in green.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions