24
Team # 55420 Page 1 of 24 For office use only T1 ________________ T2 ________________ T3 ________________ T4 ________________ Team Control Number 55420 Problem Chosen C For office use only F1 ________________ F2 ________________ F3 ________________ F4 ________________ 2017 MCM/ICM Summary Sheet Improved Method of Cellular Automata to Study Effects of Self-Driving and Cooperating Cars Summary Based on NS cellular automata and Monte-Carlo method, we build a space-continuous model to study the positive effect of self-driving and cooperating car could have on highway. We are curious about how these cars interacting with the existing traffic flow. Therefore, special parameters are previously set in the program to study how they interact: traffic flow, proportion of self-driving car, highway length, self-driving lanes and total number of lanes. By changing these parameters, we can observe how the two cars interact with each other and give possible suggestions. We break down actions that could happen on highway into 4 parts and establish corresponding sub-models: safe distance model, lane-switching model, car-moving model and car-entering model. Continuous spacing is adapted to enhance accuracy and be more close to reality. We simulate the traffic on given number of lanes, each with definite traffic flow. The length of highway is omitted because it is considered as not so important as to average passing time per length. Specifically, in view of high traffic flow during rush hours, we also change traffic flow for highway with different lanes (2 to 5 lanes). Based on our analysis, some interesting observations are drawn. Firstly, 75% is the tipping point where the slope of average passing time per length is the largest. That’s to say, taking both the cost and benefit of self-driving car into considerations, 75% is the best proportion. The second observation is a little surprising. It turns out that lanes dedicating to self-driving car is unnecessary as we compare all conditions. Nonetheless, the mixture of self-driving cars and normal cars are remarkably better as mentioned previously. In view of future development, the improvement of proportion of self-driving car might not be a problem. In that case, the more the better.

Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 1 of 24

For office use only T1 ________________ T2 ________________ T3 ________________ T4 ________________

Team Control Number 55420

Problem Chosen

C

For office use only F1 ________________ F2 ________________ F3 ________________ F4 ________________

2017 MCM/ICM

Summary Sheet

Improved Method of Cellular Automata to Study Effects of Self-Driving and Cooperating Cars

Summary Based on NS cellular automata and Monte-Carlo method, we build a space-continuous model to study the positive effect of self-driving and cooperating car could have on highway. We are curious about how these cars interacting with the existing traffic flow. Therefore, special parameters are previously set in the program to study how they interact: traffic flow, proportion of self-driving car, highway length, self-driving lanes and total number of lanes. By changing these parameters, we can observe how the two cars interact with each other and give possible suggestions. We break down actions that could happen on highway into 4 parts and establish corresponding sub-models: safe distance model, lane-switching model, car-moving model and car-entering model. Continuous spacing is adapted to enhance accuracy and be more close to reality. We simulate the traffic on given number of lanes, each with definite traffic flow. The length of highway is omitted because it is considered as not so important as to average passing time per length. Specifically, in view of high traffic flow during rush hours, we also change traffic flow for highway with different lanes (2 to 5 lanes). Based on our analysis, some interesting observations are drawn. Firstly, 75% is the tipping point where the slope of average passing time per length is the largest. That’s to say, taking both the cost and benefit of self-driving car into considerations, 75% is the best proportion. The second observation is a little surprising. It turns out that lanes dedicating to self-driving car is unnecessary as we compare all conditions. Nonetheless, the mixture of self-driving cars and normal cars are remarkably better as mentioned previously. In view of future development, the improvement of proportion of self-driving car might not be a problem. In that case, the more the better.

Page 2: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 2 of 24

A Letter to the Governor’s Office Dear Governor:

People all over the world are faced with more and more critical traffic jam problems of different degrees and these issues will also become one of the most severe challenges.

In the case of road congestion, ghost traffic jam phenomenon is very common. On a crowded road, it is likely that a short pause is caused just because a driver has suddenly braked, changed lanes or overtook, and then it will cause a series of congestion behind the car. Even if the first car can start after only 2 seconds, it may need several tens of minutes for the last one to start. While the non-self-driving cars can achieve information sharing through the network, which can greatly reduce the reaction time. While changing the number of the lanes is not easy. The introduction of the non-self-driving cars is a very effective way to ease traffic congestion

Therefore, we study the relationship between the proportions of the non-self-driving cars and the degree of easing the traffic jam and whether should we open the lanes dedicated to the non-self-driving cars based on the traffic volume data of Interstates 5, 90, and 405, as well as State Route 520.So according to the study, we propose some suggestions as bellow. According to our study, we can roughly conclude that the higher the proportion coefficient of self-driving cars, the shorter the average time that all the cars pass through the road, which means that the road is smoother. But we also find that if the proportion of the self-driving cars increases to a value 0.75, the reduction of the average time for all the cars to pass through the road will become smaller and smaller. So controlling the proportion of the non-self-driving cars to the value p can make sure that the self-driving cars play the role of easing the traffic jam to the maximum degree without causing waste. So in summary, we suggest that you should control the proportion of self-driving cars to the value 0.75. On the other hand, on the basis of setting the proportion of the self-driving cars to the value 0.75, we do a lot of experiments with different traffic volume. The simulation statistics show that opening a lane dedicated to the self-driving cars increases the average time for all the cars to pass through the road instead and makes more traffic jam. So we suggest that you don’t need to open the lane dedicated to the elf-driving cars.

We base our decision on precise calculation and simulate every experiment for 10 times according to the Monte Carlo method. We put forward our advice under specific investment and accurate statistics. Adopting our suggestions can ease the traffic jam effectively and is also well to the sustainable development.

Your sincerely,

Team 55420

Page 3: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 3 of 24 1 Introduction

Traffic capacity is limited in many regions of the United States due to the number of lanes of roads. In the case of road congestion, ghost traffic jam phenomenon is a very common phenomenon. On a crowded road, it is likely that a short pause is caused just because a driver has suddenly braked, changed lanes or overtook and it will cause a series of congestion behind the car. Even if the first car can start after only 2 seconds, it may require several tens of minutes when the last car to be start. While non-self-driving cars can achieve information sharing through the network, which can greatly reduce the reaction time. So the introduction of non-self-driving cars is a very effective way to ease traffic congestion. Our model mainly solves the following problems: When the proportion of non-self-driving cars changes? How the road condition changes? Under what conditions, if any, should lanes be dedicated to the non-self-driving cars?

The NS model based on the cellular automaton is the basis to solve the problem, and we introduce the “safe distance” model to change the NS model from space-discrete to space-continuous, which can make sure that the simulation is more realistic and accurate. In the meanwhile, we also include the “random slow” to simulate the possibly unstable condition.

2 Assumptions l Conditions of all the cars are the same, such as length, maximum acceleration and

deceleration, etc. We estimate these values according to FMVSS [1]. l The values of reaction time of all drivers are the same. We set the reaction time at

0.5s, which is a reasonable value [2]. l To avoid collisions with the preceding cars, all drivers will make sure that the

distance to the preceding cars is sufficient, that is, beyond the safe distance. All drivers can estimate the safe distance according to their observations and experience.

l All drivers obey the traffic rules. They will never drive over the speed limit (60 miles per hour) or drive into lanes dedicated to self-driving cars.

l The reaction time of self-driving systems is negligible. The sensors in the car are advanced and will never make mistakes.

l During the time period we study, the traffic volume is stable. That is, the expected value of the number of cars entering the road in a time interval will not change by time.

l There are no accidents on the roads.

3 Notations and Descriptions Table 1. Constants Notations Descriptions Values Units

∆𝑡 Time interval (equal to reaction time of drivers) 0.5 s 𝑇 Total time (the time period we study) 7200 s

𝑎%&' Maximum acceleration 8 ft/(s2) 𝑎%() Minimum acceleration

(maximum deceleration) -14 ft/(s2)

𝑑%() Minimum distance between two cars 16 ft 𝑣%&' Maximum velocity 88 ft/s 𝑝 Randomization probability 0.2

Page 4: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 4 of 24 Table 2. Variables Notations Descriptions Units

𝑠 Position ft 𝑣 Velocity ft/s 𝑠. Position of the preceding car ft 𝑣. Velocity of the preceding car ft/s ∆𝑠 Displacement(position increment) ft ∆𝑣 Velocity increment ft/s

𝑣/,%&' Maximum possible velocity after a time interval ft/s 𝑑 Distance between two cars ft 𝑑1 Safe distance ft

∆𝑠%&' Maximum displacement ft 𝑝1 Percentage of self-driving cars 𝑣2 Velocity after the time interval ft/s 𝑛4 Expected value of the number of cars entering the road in total

time

𝑛∆2 Expected value of the number of cars entering the road in a time interval

𝑣5,%&' Maximum velocity when entering ft/s 𝑡 Time for a car to pass through the road s 𝑡 Average time for cars to pass through the road s 𝑇1 Simulation time s 𝑚 Number of cars leaving the road during the simulation time 𝑘 Number of cars leaving the road before the system becomes

balanced

𝐿 Length of the road ft 𝑁 Number of lanes on the road 𝑁1 Number of lanes dedicated to self-driving cars on the road

4 Model Building 4.1 Safe Distance Model

§ Key points: safe distance is calculated considering all possible situations to ensure no crash. Different type of cars (self-driving cars and non-self-driving car) have different safe distance.

The safe distance (𝑑1) is the minimum distance between two cars beyond which the car

can avoid a collision with the preceding car. The driver should make sure that the distance to the preceding car is larger than 𝑑1.

𝑑 ≥ 𝑑1 𝑣, 𝑣., 𝑡𝑦𝑝𝑒 where 𝑑1 is a function of the velocity of the car (𝑣) and the velocity of the preceding

car (𝑣.). And the function depends on the type of car (self-driving or cooperating car). For a non-self-driving car, when the preceding car decelerates suddenly, trying to stop,

the driver cannot react immediately. After reaction time, the driver will realize that the preceding car has decelerated, and then decides to decelerate the car. To facilitate the simulation, we make the time interval (∆𝑡) in our simulation equal to the reaction time of drivers. In this case, the parameters of the function of safe distance, the velocity of the preceding car, should be the velocity of the preceding car in last time interval.

Page 5: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 5 of 24 Before the driver reacts, the car could possibly be accelerating. So we should calculate

the maximum possible velocity after a time interval (𝑣/,%&'). 𝑣/,%&' = min 𝑣 + 𝑎%&'∆𝑡, 𝑣%&'

To avoid a collision when two cars both decelerate, we should make sure that when two cars both stop finally, the distance between them should be larger than the minimum distance between two cars (𝑑%()).

𝑑 ≥ 𝑑%() +𝑣 + 𝑣/,%&' ∆𝑡

2 +𝑣/,%&'D − 𝑣.D

−2𝑎%()

To avoid a collision before the driver react, we should make sure that after reaction time,

the distance between two cars should be larger than 𝑑%().

𝑑 ≥ 𝑑%() +𝑣 + 𝑣/,%&' ∆𝑡

2 − 𝑣.∆𝑡 −12𝑎%()∆𝑡

D Of course, 𝑑1 should be larger than 𝑑%().

𝑑1 𝑣, 𝑣. = max 𝑑%() +𝑣 + 𝑣/,%&' ∆𝑡

2 +𝑣/,%&'D − 𝑣.D

−2𝑎%(),

𝑑%() +𝑣 + 𝑣/,%&' ∆𝑡

2 − 𝑣.∆𝑡 −12𝑎%()∆𝑡

D, 𝑑%()

For a self-driving car, when the preceding car decelerates suddenly, trying to stop, the

sensors in the car will react rapidly. The reaction time of self-driving systems is much smaller than the reaction time of human drivers, so we can assume that the reaction time of self-driving systems is negligible. In the case that many other self-driving cars follow the first self-driving car, the reaction time of self-driving systems will not accumulate, because self-driving, cooperating cars communicate and exchange data with other self-driving cars, that is, the following self-driving cars will react simultaneously.

To avoid a collision when two cars both decelerate, we should make sure that when two cars both stop finally, the distance between them should be larger than the minimum distance between two cars (𝑑%()).

𝑑 ≥ 𝑑%() +𝑣D − 𝑣.D

−2𝑎%()

Of course, 𝑑1 should be larger than 𝑑%().

𝑑1 𝑣, 𝑣. = max 𝑑%() +𝑣D − 𝑣.D

−2𝑎%(), 𝑑%()

To make sure that the distance to the preceding car is beyond the safe distance, we can calculate the maximum displacement for a car in a time interval (∆𝑠%&'). For a non-self-driving car, the position of the preceding car (𝑠.) should be the position in last time interval. While for a self-driving car, 𝑠. is the position of the preceding car in the same time interval.

∆𝑠%&' 𝑣, 𝑣., 𝑠, 𝑠. = 𝑠. − 𝑠 − 𝑑1 𝑣, 𝑣. In a time interval, the car should not cover a distance more than that.

4.2 Lane-switching Model Under some circumstances, changing to a new lane may be a good choice to drive faster.

However, it may be dangerous, for it changes the position and the safe distance after moving to a new lane, and then the distance between two cars could be insufficient. Here we build a model to help the cars to make their decisions to or not to change their lanes.

Page 6: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 6 of 24 Safety is of paramount importance. Only when the safe distance condition is met can the

car change to a new lane. 𝑠. − 𝑠 ≥ 𝑑1 𝑣, 𝑣.

And we can use ∆𝑠%&' to reflect that. ∆𝑠%&' 𝑣, 𝑣., 𝑠, 𝑠. ≥ 0

Calculate ∆𝑠%&' of the following cars in adjacent lanes. If the safe distance condition is not met in both adjacent lanes, the car will not change the lane. If the safe distance condition is met in one or two adjacent lanes, we calculate ∆𝑠%&' of the car in the adjacent lanes and the previous lane. To drive faster, the car should choose the lane which ∆𝑠%&' is maximal.

4.3 Car-Moving Model § Key points: the distance for every car to move forward every time step is

calculated according to the distance to its front car and velocity.

After all cars make their decisions to or not to change their lanes, they cannot change their lanes in the same time interval. Now we go through every car from head to tail in every certain lane to move the car forward.

For a non-self-driving car, under special circumstances, the driver may try to slow the car down without a good reason. It reflects the fluctuation of a non-self-driving car. We use a method called randomization to simulate it. Randomization “is essential in simulating realistic traffic flow since otherwise the dynamics is completely deterministic” [3]. With a probability of 𝑝, the car slow down under maximum acceleration in the time interval.

𝑣2 = max 𝑣 + 𝑎%()∆𝑡, 0 Under normal circumstances, a car tends to go as far as possible in a time interval,

within the safe distance limit and the speed limit. The displacement of the car is determined by the velocity before the time interval (𝑣) and the velocity after the time interval (𝑣2).

∆𝑠 =𝑣 + 𝑣2 ∆𝑡

2 The driver or the self-driving system should keep the car beyond the safe distance. Here

we use the maximum possible velocity after reaction time (𝑣/,%&') to calculate the maximum displacement.

∆𝑠 ≤ ∆𝑠%&' 𝑣/,%&', 𝑣., 𝑠, 𝑠. And 𝑣2 should not exceed the velocity under maximum acceleration or the speed limit.

𝑣2 = min2∆𝑠%&' 𝑣/,%&', 𝑣., 𝑠, 𝑠.

∆𝑡 − 𝑣, 𝑣/,%&'

4.4 Car-Entering Model

§ Key points: the cars entering the road contains two origins:newly randomized cars and cars leaving this road to simulate cars passing through roads.

In our simulation, there are no cars on the road at first. The expected value of the number of cars entering the road in total time (𝑛4) reflects the traffic volume. In every time interval, the number of cars entering the road is randomized, and the expected value (𝑛∆2) of the number is determined by 𝑛4.

𝑛∆2 =𝑛4∆𝑡𝑇

To make the distribution of two types of cars (self-driving and non-self-driving) in different lanes more balanced on the whole road in our simulation, we use the same lane number, the velocity and the type of the car which has just left this road (if there is one) to

Page 7: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 7 of 24 create the corresponding parameters of the car ready to enter. If there isn’t one, we create these corresponding parameters randomly (the non-self-driving cars will not appear in lanes dedicated to self-driving cars), and the probability of the self-driving type of the car equals to percentage of self-driving cars (𝑝1).

After creating a car ready to enter, we should check whether the safe distance condition is met. We calculate ∆𝑠%&' 𝑣, 𝑣., 0, 𝑠. to check it.

If ∆𝑠%&' 𝑣, 𝑣., 0, 𝑠. ≥ 0, the car enters the lane successfully. If not, we should check whether the car can enter the road in another lane or at a lower speed. We calculate maximum velocity when entering (𝑣5,%&') of every lane to check it.

𝑣5,%&' = min2∆𝑠%&' 𝑣%&', 𝑣., 0, 𝑠.

∆𝑡 − 𝑣%&', 𝑣%&'

If 𝑣5,%&' in every lane is below zero, the car fails to enter. If not, the car will choose the lane where 𝑣5,%&' is maximal. The velocity of the car is randomized, which will not exceed 𝑣5,%&'.

4.5 Indicator of Traffic Capacity

To increase traffic capacity, we want a larger number of cars to pass the road under a given traffic density, that is, we want the average velocity of cars to be larger. For a given part of a road, we can note time for every car to pass through the road (𝑡), and we use the average time (𝑡) as the indicator of traffic capacity. A smaller 𝑡 indicates a better traffic capacity.

In our simulation, we cannot use 𝑡 of every car to calculate 𝑡. There are no cars on the road at first, so the cars entering early drive under a low traffic density, and they can use much smaller 𝑡 to pass through the road. After a period of time, the system becomes balanced, and 𝑡 of cars fluctuates around the real 𝑡 that we want.

When there are 𝑚 cars leaving the road during the simulation time, we can get a series of values: 𝑡K, 𝑡D, 𝑡L, … , 𝑡%. In our simulation, we find the first 𝑡M whose average value of 21 𝑡 values nearby is larger than the average of 𝑡 after it, and regard this 𝑘 as the number of cars leaving the road before the system becomes balanced.

121 𝑡(

MNK5

(OMPK5

≥1

𝑚 − 𝑘 𝑡(

%

(OMNK

And we use the average of 𝑡 after it as the real 𝑡 we want.

𝑡 =1

𝑚 − 𝑘 𝑡(

%

(OMNK

We should make sure that the simulation time (𝑇1) is sufficient for the system to become balanced. After the first simulation, we check the array of 𝑡 to see whether the 𝑇1 is sufficient. If 𝑡 does not become balanced before our simulation ends, we use a larger 𝑇1 to simulate, until it is sufficient.

5 Model Solving 5.1 Method

We use Monte Carlo method to solve the problems. In our model, there are many random events, so the average time for cars to pass through the road (𝑡) is a random variable. For each case, we run simulation 10 times and use the average value of each 𝑡 as the simulation result.

For each case in our simulation, we need to set these parameters: length of the road (𝐿), number of lanes on the road (𝑁), number of lanes dedicated to self-driving cars on the road (𝑁1), expected value of the number of cars entering the road per hour (𝑛4), percentage of self-driving cars (𝑝1) and simulation time (𝑇1).

Page 8: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 8 of 24

In our model, 𝐿 is not an important factor to influence the results. For a certain road under a certain traffic density, the number of cars to pass through the road per hour will not change markedly by solely changing the length of the road. We calculate the average of length of the roads of interest: 4336ft, and we use it as 𝐿 for each case in our simulation.

As discussed in chapter 4.5, 𝑇1 depends on how much time the system needs to get balanced.

There are four important factors in our model: 𝑁, 𝑁1, 𝑛4, 𝑝1. 𝑁 is given for a certain road. For the roads of interest, 𝑁 can be 2, 3, 4 or 5. And 𝑁1

should be less than 𝑁. We should simulate each possible 𝑁 to give our conclusion.

5.2 Effects of Changing Percentage of Self-Driving Cars The first problem we want to solve is how the effects change as the percentage of

self-driving cars (𝑝1) increases. We aim to work out the recommended 𝑝1 for the government. We give our conclusion under average traffic flow, that is, we use the average value of 𝑛4 in our simulation to solve this problem. Considering that 𝑛4 in roads with more lanes may be larger, we calculate the average value of 𝑛4 in roads with different 𝑁. To give a comprehensive conclusion, we calculate the percentage of roads with different 𝑁.

Table 3 Average value of 𝑛4 in roads with different 𝑁 and percentages of these roads 𝑁 𝑛4 Roads Percentages

2 2189 68 15.18% 3 2720 252 56.25% 4 3636 107 23.88% 5 3938 21 4.69%

For each possible 𝑁, we will simulate each possible 𝑁1. And we choose the minimal 𝑡

among different 𝑁1 as the 𝑡 we want, because we can choose the optimal 𝑁1 for the road. For roads with different 𝑁, the effects may be different, so we calculate the weighted mean values, using percentages of roads with different 𝑁 as weight coefficients. Then we can see how 𝑡 changes as 𝑝1 increases to find out whether equilibria exist and whether there is a tipping point where performance changes markedly.

Table 4 How the effects change as the percentage of self-driving cars increases 𝑝1 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100

% 𝑁 = 2 360 323 291 261 229 186 153 114 82 61 51 𝑁 = 3 351 323 279 242 208 177 134 104 75 61 51 𝑁 = 4 380 344 301 259 226 180 137 101 75 59 51 𝑁 = 5 355 308 271 235 195 144 124 88 65 56 51

Weighted Mean

360 327 286 249 215 178 137 104 76 61 51

Linear Fitting

361 324 287 250 213 176 139 103 66 29 -8

Page 9: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 9 of 24

Figure 1 How the effects change as the percentage of self-driving cars increases

According to Figure 1, we can conclude that the larger percentage of self-driving cars is,

the better effects there will be. As 𝑝1 increases, the average time for cars to pass through the road is almost on a line at first. When 𝑝1 increases to about 80%, the value begin to deviate from the line. With linear fitting method, we draw a line using values from 0% to 70%. Based on that, we estimate the tipping point to be 75%. So the recommended 𝑝1 for the government is 75%.

5.3 When to Set Lanes Dedicated to Self-Driving Cars The second problem we want to solve is when to set lanes dedicated to self-driving cars.

We may give different suggestions for different road under different traffic flow, that is, under different𝑛4. Here we use the recommended 𝑝1 we have worked out (75%) in our simulation to solve this problem. 5.3.1 Roads with 5 Lanes

Table 5 How 𝑡 changes as 𝑛4 increases 𝑛4 500 1500 2500 3500 4500 5500 6500 7500 8500 9500

𝑁1 = 0 52.9 56.5 64.1 70.0 77.4 93.3 104.2 159.8 163.1 166.8 𝑁1 = 1 52.3 58.9 64.5 73.8 89.7 104.2 116.4 178.2 182.5 185.2

Figure 2 How 𝑡 changes as 𝑛4 increases

0

50

100

150

200

250

300

350

400

Averagetimeforcarstopassthroughtheroad

WeightedMean

LinearFitting

0.0

20.0

40.0

60.0

80.0

100.0

120.0

140.0

160.0

180.0

200.0

500 1500 2500 3500 4500 5500 6500 7500 8500 9500

Ns=0

Ns=1

Page 10: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 10 of 24

We find out that no matter how 𝑛4 changes, that is, no matter how traffic volume changes, dedicate a lane to self-driving cars cannot be a good idea. 5.3.2 Roads with 2, 3 or 4 Lanes

Setting lanes dedicated to self-driving cars is good for self-driving cars, but it has a bad effect on non-self-driving cars, because the lanes non-self-driving cars can drive become fewer. The fewer lanes the road has, the worse effect it will be. So we don’t need to simulate roads with 2, 3 or 4 lanes. Our conclusion is that setting no lanes dedicated to self-driving cars is better when the percentage of self-driving cars is 75%. Of course, when the percentage of self-driving cars is less than 75%, we can get the same conclusion.

6 Conclusions § The larger percentage of self-driving cars is, the better effects there will be. Equilibria

do not exist. § There is a tipping point where performance changes markedly. We estimate the

tipping point to be 75%. § Under no conditions should lanes be dedicated to self-driving cars when the

percentage of self-driving cars is less than 75%. § To increase capacity of highways, we suggest the government to make some policies

to offer incentives for the use of self-driving cars. In the first few years (maybe decades), try to increase the percentage of self-driving cars to 75%. After economies and technologies develop to a higher stage, try to increase the percentage to more than 75%. Only then will the government need to consider whether to dedicate a lane to self-driving cars.

7 Strengths and weaknesses 7.1 Strengths

§ Our model is continuous in space. This ensures a car moves forward according to its velocity and the car before most accurately in every time step. Since our simulation is essentially based on how car moves, space-continuous is a large optimization compared to traditional NS model (space discrete).

§ Reflect the real world driving situation Ghost traffic jam is considered by adding random slow in moving- forward model. In addition, the cars entering the highway every time step stems from two part: cars leaving the previous road segment and newly car entering the highway.

§ Monte-Carlo method improves realness Monte-Carlo method is based on randomization in a given probability. This is exactly what happens in the real world.

7.2 Weaknesses § Can be more accurate

Each situation is simulated 10 times. To be more accurate, more times could be adapted.

§ Method to calculate safe distance might be too strict We consider all situations (accelerating, decelerating, etc.) when calculating safe distance, but for a given car with its accelerator set, safe distance could be smaller. But for simplicity, we use a stricter algorithm.

§ Time step could be a little shorter so that it would be more accurate.

Page 11: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 11 of 24

8 References [1] U.S. Department of Transportation. "Federal Motor Vehicle Safety Standards." https://one.nhtsa.gov/cars/rules/import/FMVSS/index.html [2] Triggs, T. J., and W. G. Harris. "Reaction time of drivers to road stimuli." Drivers (1982). [3] Kai, Nagel, and M. Schreckenberg. "A cellular automaton model for freeway traffic." Journal of Physics I France 2.12(1992):2221-2229. 9 Appendix

Effects of Changing Percentage of Self-Driving Cars Road with 2 lanes - Mean of Average daily traffic counts Year_2015: 105059 Road with 2 lanes - 0 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 699 735 690 717 779 738 724 732 666 727 721 10 665 630 649 625 636 663 627 640 637 681 645 20 580 555 594 573 633 590 583 586 581 554 583 30 514 558 506 507 508 523 537 511 521 537 522 40 434 466 501 471 451 452 466 432 450 454 458 50 405 351 356 369 371 357 388 371 357 388 371 60 317 350 310 319 291 275 277 306 331 278 305 70 225 224 230 220 203 199 229 265 220 262 228 80 176 158 173 146 168 157 158 185 146 168 163 90 127 128 115 124 123 129 119 120 121 120 123 100 102 102 102 101 101 102 102 101 102 102 102 Road with 2 lanes - 1 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 730 773 750 716 772 767 760 736 768 735 751 10 702 684 673 732 657 682 676 680 691 736 691 20 649 632 644 630 645 648 659 619 620 629 637 30 598 556 544 536 585 650 532 572 612 605 579 40 533 513 534 550 478 533 512 544 523 480 520 50 463 450 469 438 477 448 455 455 463 449 457 60 356 356 360 346 341 360 325 339 340 358 348 70 242 242 251 317 276 271 261 287 257 247 265 80 180 217 206 200 216 197 189 194 186 186 197 90 179 182 191 205 172 171 196 180 189 193 186 100 101 102 102 101 101 101 102 101 101 102 101

Road with 3 lanes - Mean of Average daily traffic counts Year_2015: 130563 Road with 3 lanes - 0 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 741 715 716 668 662 716 697 660 751 702 703 10 653 608 660 623 621 663 648 646 670 668 646 20 563 541 527 606 598 596 560 519 538 534 558 30 495 442 457 480 507 495 495 445 532 495 484 40 432 431 418 420 382 379 384 442 428 452 417 50 329 349 374 369 337 324 358 381 361 357 354 60 295 274 287 264 244 265 246 297 261 244 268 70 180 223 241 194 229 182 240 213 185 184 207

Page 12: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 12 of 24

80 157 147 138 163 153 156 152 143 137 149 149 90 122 117 116 116 122 118 161 128 116 122 124 100 102 102 101 102 102 102 102 102 102 102 102 Road with 3 lanes - 1 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 707 740 743 709 743 728 708 731 794 760 736 10 696 673 696 696 658 720 736 706 670 647 690 20 616 617 668 650 585 622 607 630 568 649 621 30 532 477 570 504 544 538 583 552 495 545 534 40 477 521 471 480 527 524 497 476 490 474 494 50 388 414 405 399 400 389 381 359 396 395 393 60 331 336 347 343 317 333 323 315 322 336 330 70 250 236 238 252 249 237 222 225 235 243 239 80 172 178 158 163 169 168 167 187 162 183 171 90 120 126 120 124 123 124 119 125 122 125 123 100 102 102 102 102 103 103 102 102 102 102 102

Road with 4 lanes - Mean of Average daily traffic counts Year_2015: 174542 Road with 4 lanes - 0 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 762 722 763 775 788 795 730 744 778 752 761 10 722 669 706 655 653 676 729 686 681 697 687 20 563 554 613 556 665 598 648 630 583 600 601 30 495 545 524 512 530 502 521 500 511 534 517 40 461 425 456 490 421 484 449 465 411 452 451 50 376 357 414 345 330 403 348 350 350 338 361 60 262 280 272 318 286 255 271 277 254 260 273 70 202 167 220 194 265 166 224 174 199 202 201 80 144 150 155 139 124 163 142 176 153 163 151 90 108 119 117 124 134 114 120 115 118 119 119 100 102 104 102 103 102 102 103 102 103 102 102 Road with 4 lanes - 1 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 820 769 785 812 786 810 793 736 805 783 790 10 735 718 749 699 689 691 709 694 727 713 712 20 639 632 635 638 663 637 644 628 675 638 643 30 576 571 605 554 573 569 544 552 572 578 569 40 463 476 487 456 484 493 492 465 485 537 484 50 417 440 403 404 410 438 414 396 439 412 417 60 307 366 328 305 341 326 299 302 337 313 323 70 231 219 227 218 234 219 230 249 253 238 232 80 165 159 141 166 150 153 164 170 163 164 160 90 114 118 121 117 122 126 119 121 115 119 119 100 102 103 103 103 102 102 102 102 102 102 102

Road with 5 lanes - Mean of Average daily traffic counts Year_2015: 189048 Road with 5 lanes - 0 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 694 753 704 716 690 702 708 699 718 715 710 10 619 598 616 608 610 640 612 609 634 624 617

Page 13: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 13 of 24

20 537 539 524 566 548 547 552 538 518 542 541 30 462 438 465 501 455 448 448 510 495 472 469 40 354 405 420 374 389 378 411 370 391 400 389 50 259 314 290 284 287 253 293 328 297 282 289 60 251 222 286 255 238 218 247 240 263 253 247 70 170 176 192 144 165 189 183 169 192 170 175 80 135 129 123 136 130 132 143 127 122 134 131 90 113 111 111 115 113 112 113 111 111 113 112 100 102 102 102 102 103 102 101 102 102 102 102 Road with 5 lanes - 1 lane dedicated to Self-Driving Cars (Unit: 0.5s) Percentage T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 0 722 730 712 734 717 714 739 728 709 723 723 10 684 655 675 652 633 667 679 682 644 677 665 20 601 598 609 568 572 565 582 639 618 559 591 30 498 509 543 510 502 500 500 520 512 530 512 40 442 416 444 434 418 425 434 430 424 405 427 50 349 377 371 361 323 310 354 346 372 344 351 60 287 301 295 229 305 252 289 306 277 280 282 70 228 230 197 185 200 191 190 209 214 186 203 80 152 145 141 165 141 135 150 138 143 131 144 90 115 114 116 116 119 115 119 115 108 116 115 100 102 102 102 102 101 101 102 102 102 102 102

When to Set Lanes Dedicated to Self-Driving Cars The percentage of self-driving cars: 75% Road with 5 lanes - 0 lane dedicated to Self-Driving Cars (Unit: 0.5s) nT T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 500 104 105 107 108 106 104 106 106 106 106 106 1500 119 110 108 111 116 113 115 115 110 112 113 2500 121 120 116 148 136 119 141 120 130 130 128 3500 142 140 143 147 136 141 140 133 140 138 140 4500 149 169 147 138 153 158 151 170 156 156 155 5500 198 182 180 187 196 206 176 182 175 183 187 6500 214 238 223 187 208 176 216 201 209 212 208 7500 300 347 323 280 333 305 307 319 332 351 320 8500 322 345 303 349 325 315 318 331 310 341 326 9500 342 348 296 331 339 329 339 333 332 347 334 Road with 5 lanes - 1 lane dedicated to Self-Driving Cars (Unit: 0.5s) nT T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 Average 500 105 104 105 103 104 105 105 106 104 108 105 1500 113 121 113 119 118 119 121 119 113 122 118 2500 136 137 137 120 120 124 131 133 123 130 129 3500 141 142 138 148 169 151 137 153 155 142 148 4500 168 199 186 184 169 175 176 195 165 177 179 5500 201 216 208 211 211 204 218 242 195 178 208 6500 242 265 231 227 193 202 234 260 227 247 233 7500 342 363 357 352 372 365 382 321 379 332 356 8500 337 414 386 375 379 344 385 328 334 367 365 9500 372 333 357 401 380 400 341 390 359 371 370

Page 14: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 14 of 24

main.m

%% Specifications % Car's attribution: 1*4 matrix % velocity v; % distance s; % self-driving car / normal car: 1:self-driving car,0:normal car; % Entering time. %% main function [i,m] = main() clc; clear; close all; B=5; % The number of the lanes iterations=2000; % global plazeLen; % length of path global plaza; % all car on this cell global acc; % acceleation global dacc; % decrease acceleration (negative) global vmax; % speed limit global dt; % time step global sd_lane; % self_driving lanes chosen global probc; % probability to generate a car global prob_self_car; % proportion of self-driving car global prob_slow; % probability of random slow global slow_acc; % decrease acceleration of random slow global carLen; % length of car global stream; % average daily traffic counts global t; % time plazeLen = 4336; plaza = cell(B,1); acc = 8; dacc = -14; vmax = 88; dt = 0.5; sd_lane = [0]; prob_self_car = 1; prob_slow=0.3; slow_acc = 0.8; carLen = 16; stream = 174540; probc = stream/(24*2*7200); out_flow = zeros(1, iterations/100); in_flow = zeros(1, iterations/100); cars = zeros(1000000,1); car_ind = 1; for t = 1: iterations fprintf('%d \n',t); % Step1: switch lane switch_lane();

Page 15: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 15 of 24 % Step2: move forward out = move_forward(); out_flow(floor((t-1)/100)+1) = out_flow(floor((t-1)/100)+1)+size(out,1); if size(out,1) ~= 0 cars(car_ind:car_ind + size(out,1)-1) = t-out(:,4); car_ind = car_ind + size(out,1); end % Step3: enter new cars cars_num = new_cars(out); in_flow(floor((t-1)/100)+1) = in_flow(floor((t-1)/100)+1)+cars_num; end fprintf('= = = = = = = = = = = = = = = = = = = \nSimulation finished!\n'); figure(1) plot(out_flow); title('Out-flow'); figure(2); plot(cars(1:1000)); title('Cars time'); figure(3); plot(in_flow); title('In-flow'); % Note: 1:1000 should be ajusted according to the car generated within % given iterations [i, m] = find_equilibria(cars(1:car_ind-1)); fprintf('Equilibria point: %d\nMean: %f\n',i,m); end

test.m

data = zeros(10,2); for i = 1:10 [a,b] = main(); data(i,:) = [a,b]; end

switch_lane.m

function switch_lane() global plaza; % all car on this cell global sd_lane; % self_driving lanes chosen W = size(plaza,1); switch_ = 0; for lanes = 1:W cars = cell2mat(plaza(lanes)); num = size(cars,1); if num == 0 continue; end car_ind = 1; %for car_ind = 1: num while car_ind <= num

Page 16: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 16 of 24 type = cars(car_ind,3); pos = cars(car_ind,2); if car_ind ~= 1 dist = cars(car_ind-1,2)-pos; else car_ind = car_ind + 1; continue; end cars_l = []; cars_r = []; if lanes ~= 1 && lanes ~= W % not left most or right most cars_l = cell2mat(plaza(lanes-1)); cars_r = cell2mat(plaza(lanes+1)); % check nearest car and car after index [la, lb] = find_nearest_car(pos, cars_l); [ra, rb] = find_nearest_car(pos, cars_r); % compute safe distance if la ~= 0 safe_l = safe_distance(cars(car_ind,1), cars_l(la,1), type); end if ra ~= 0 safe_r = safe_distance(cars(car_ind,1), cars_r(ra,1), type); end % check car after distance % 1. no pre car la = 0 2. no post car lb = 0 if la == 0 l_dist = inf; if lb ~= 0 && (after_dist_available(cars(car_ind,:), cars_l(lb,:)) ~= 1) l_dist = 0; end else l_dist = pre_available(cars_l(la,2), pos, safe_l); if lb ~= 0 && (after_dist_available(cars(car_ind,:), cars_l(lb,:)) ~= 1) l_dist = 0; end if (size(find(lanes-1 == sd_lane),2) ~= 0) && type == 0 l_dist = 0; end end if ra == 0 r_dist = inf; if rb ~= 0 && (after_dist_available(cars(car_ind,:), cars_r(rb,:)) ~= 1) r_dist = 0; end else r_dist = pre_available(cars_r(ra,2), pos, safe_r); if rb ~= 0 && (after_dist_available(cars(car_ind,:), cars_r(rb,:)) ~= 1)

Page 17: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 17 of 24 r_dist = 0; end if (size(find(lanes+1 == sd_lane),2) ~= 0) && type == 0 r_dist = 0; end end % find smallest in dist, l_dist, r_dist [d, ind] = max([dist l_dist r_dist]); if (ind == 2 && (r_dist ~= l_dist)) ||... % left is better and not draw (r_dist == l_dist &&... % draw type == 1 &&... % self-driving car la ~= 0 && cars_l(la,3) == 1) % front is self-driving car % switch to left lane switch_ = 1; if la ~= 0 if lb ~= 0 cars_l = [cars_l(1:la, :); ... cars(car_ind, :);... cars_l(lb:size(cars_l,1),:)]; else cars_l = [cars_l(:,:); cars(car_ind,:)]; end else cars_l = [cars(car_ind,:);cars_l(:,:)]; end cars(car_ind, :) = []; elseif ind == 3 switch_ = 1; % switch to right lane if ra ~= 0 if rb ~= 0 cars_r = [cars_r(1:ra, :); ... cars(car_ind, :);... cars_r(rb:size(cars_r,1),:)]; else cars_r = [cars_r(:,:); cars(car_ind,:)]; end else cars_r = [cars(car_ind,:);cars_r(:,:)]; end cars(car_ind, :) = []; end elseif lanes == 1 cars_r = cell2mat(plaza(lanes+1)); % check nearest car and car after index [ra, rb] = find_nearest_car(pos, cars_r); if ra == 0 r_dist = inf; if rb ~= 0 && (after_dist_available(cars(car_ind,:), cars_r(rb,:)) ~= 1) r_dist = 0; end else

Page 18: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 18 of 24 safe_r = safe_distance(cars(car_ind,1), cars_r(ra,1), type); r_dist = pre_available(cars_r(ra,2), pos, safe_r); if rb ~= 0 && (after_dist_available(cars(car_ind,:), cars_r(rb,:)) ~= 1) r_dist = 0; end if (size(find(lanes+1 == sd_lane),2) ~= 0) && type == 0 r_dist = 0; end end % find smallest in dist, l_dist, r_dist [d, ind] = max([dist r_dist]); if ind == 2 switch_ = 1; if ra ~= 0 if rb ~= 0 cars_r = [cars_r(1:ra, :); ... cars(car_ind, :);... cars_r(rb:size(cars_r,1),:)]; else cars_r = [cars_r(:,:); cars(car_ind,:)]; end else cars_r = [cars(car_ind,:);cars_r(:,:)]; end cars(car_ind, :) = []; end elseif lanes == W cars_l = cell2mat(plaza(lanes-1)); % check nearest car and car after index [la, lb] = find_nearest_car(pos, cars_l); if la == 0 l_dist = inf; if lb ~= 0 && (after_dist_available(cars(car_ind,:), cars_l(lb,:)) ~= 1) l_dist = 0; end else safe_l = safe_distance(cars(car_ind,1), cars_l(la,1), type); l_dist = pre_available(cars_l(la,2), pos, safe_l); if lb ~= 0 && (after_dist_available(cars(car_ind,:), cars_l(lb,:)) ~= 1) l_dist = 0; end if (size(find(lanes-1 == sd_lane),2) ~= 0) && type == 0 l_dist = 0; end end % find smallest in dist, l_dist, r_dist [d, ind] = max([dist l_dist]);

Page 19: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 19 of 24 if ind == 2 switch_ = 1; % switch to left lane if la ~= 0 if lb ~= 0 cars_l = [cars_l(1:la, :); ... cars(car_ind, :);... cars_l(lb:size(cars_l,1),:)]; else cars_l = [cars_l(:,:); cars(car_ind,:)]; end else cars_l = [cars(car_ind,:);cars_l(:,:)]; end cars(car_ind, :) = []; end end if lanes ~= 1 % cars_l plaza(lanes-1) = mat2cell(cars_l, size(cars_l,1), 4); end if lanes ~= W % cars_r plaza(lanes+1) = mat2cell(cars_r, size(cars_r,1), 4); end plaza(lanes) = mat2cell(cars, size(cars,1), 4); num = size(cars,1); if switch_ == 1 car_ind = car_ind-1; end switch_ = 0; car_ind = car_ind + 1; end end end

safe_distance.m

function distance = safe_distance(v_cur, v_pre, type) global acc; % acceleation global dacc; % decrease acceleration (negative) global vmax; % speed limit global dt; % time step global carLen; % length of car if type == 1 % self-driving car len = (v_cur.^ 2 - v_pre.^2)/(-2 * dacc); distance = max([carLen carLen + len]); else % normal car v_rmax = min([v_cur + acc * dt, vmax]); len = (v_cur + v_rmax)*dt/2; distance = max([carLen, ... carLen + len - (v_rmax.^2 - v_pre.^2)/(2*dacc), ... carLen + len - v_pre*dt - dacc .* dt.^2/2]); end

Page 20: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 20 of 24 end

rand_slow.m

function random_slow() global plaza; % all car on this cell global dt; % time step global slow_acc; % decrease acceleration of random slow W = size(plaza, 1); for lanes=1:W cars = cell2mat(plaza(lanes)); num = size(cars,2); for i = 1:num if rand <= probslow cars(i,1) = cars(i,1) - slow_acc*dt; end end end end

pre_available.m

function dist = pre_available(dist_pre, dist_cur, safe) dist = dist_pre - dist_cur - safe; end

new_cars.m

% enter a car randomly function cars = new_cars(in) global probc; % probability to generate a car cars = 0; in_num = size(in,1); success = 0; if in_num ~= 0 while success == 0 in_car = floor(in_num * rand)+1; success = add_car(in(in_car,:)); if success cars = cars + 1; end end end if probc < 1 && success == 0 if rand <= probc if add_car() ~= 0 cars = cars + 1; end end else for i = 1:ceil(probc)-1

Page 21: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 21 of 24 if add_car() ~= 0 cars = cars + 1; end end end end

add_car.m

%% Note: % If all lanes are not available, then enter no car %% function tmp_lane = add_car(in_car) global plaza; % all car on this cell global vmax; % speed limit global sd_lane; % self_driving lanes chosen global prob_self_car; % proportion of self-driving car global t; % time if nargin < 1 W = size(plaza,1); success = 0; visited = zeros(1,W); %!! while success == 0 && (size(find(visited == 1),2) ~= W) tmp_lane = floor(rand*W)+1; if visited(tmp_lane) == 1 continue; end visited(tmp_lane) = 1; cars = cell2mat(plaza(tmp_lane)); % eg. 5 cars should be 5*3 matrix num = size(cars,1); tmp_ty = (rand < prob_self_car); % 1:normal, 0:self-driving tmp_v = rand * vmax; % distance to the last car in chosen lane should be larger than % safe distance if num ~= 0 if cars(num,2) >= safe_distance(tmp_v, cars(num,1), tmp_ty) success = 1; % if a normal car initiated at self-driving lane if tmp_ty == 1 && size(find(sd_lane == tmp_lane),2) ~= 0 success = 0; else plaza(tmp_lane) = mat2cell([cars; [tmp_v 0 tmp_ty t]], num+1, 4); end end else plaza(tmp_lane) = mat2cell([tmp_v 0 tmp_ty t], 1, 4); success = 1; end end if size(find(visited == 1),2) == W tmp_lane = 0; end

Page 22: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 22 of 24 else tmp_lane = in_car(5); cars = cell2mat(plaza(tmp_lane)); num = size(cars,1); type = in_car(3); v = in_car(1); in_car(2) = 0; in_car(4) = t; in_car = in_car(1:4); if size(cars,1) == 0 || ... (cars(num,2) >= safe_distance(v, cars(num,1), type)) plaza(tmp_lane) = mat2cell([cars; in_car], num+1, 4); else tmp_lanes = 0; end end end

move_forward.m

%% function [complete]=move_forward() global plazeLen; % length of path global plaza; % all car on this cell global acc; % acceleation global dacc; % decrease acceleration (negative) global vmax; % speed limit global dt; % time step global prob_slow; % probability of random slow W = size(plaza, 1); complete = []; % Step1: change all cars' acceleration and new velocity % Step2: random slow % Step3: change all cars' position for lanes = 1:W cars = cell2mat(plaza(lanes)); % eg: 5 cars should be 5*4 matrix num = size(cars,1); if size(cars,1) == 0 continue; end % store all velocity pre = cars(:,1:2); i = 1; i_ = 1; while i <= num if i ~= 1 % if i == 13 % cars % num % end type = cars(i,3); if type == 1 del_d = cars(i-1,2) - cars(i,2);

Page 23: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 23 of 24 v_pre = cars(i-1,1); else del_d = pre(i_-1,2) - cars(i,2); v_pre = pre(i_-1,1); end smax = del_d - safe_distance(cars(i,1), v_pre,type); v_new = min([vmax, cars(i,1)+acc*dt, (2*smax/dt - cars(i,1))]); if smax < 0 smax = 0; end if v_new < 0 v_new = 0; end % random slow if type == 0 && rand < prob_slow v_new = max([pre(i_,1) + dacc*dt, 0]); end cars(i,1) = v_new; cars(i,2) = pre(i_,2) + (pre(i_,1) + v_new)*dt/2; else % the first car cars(1,1) = min([pre(i_,1) + acc * dt, vmax]); cars(1,2) = pre(i_,2) + (pre(i_,1) + cars(1,1))*dt/2; if cars(1,2) >= plazeLen complete = [complete; [cars(1, :) lanes]]; % delete the car out cars(1,:) = []; i = i-1; num = num-1; end end i = i+1; i_ = i_+1; plaza(lanes) = mat2cell(cars,size(cars,1),4); end end end

find_nearest_car.m

%% find_nearest_car(dist,cars) % 1. No car .ok ind_a = 0, ind_b = 0 ok % 2. No pre car, but has post car: ind_a = 0 ind_b = 1 ok % 3. No post car, but has pre car: ind_a not 0, ind_b = 0 ok % 4. Normal .ok ind_a != 0, ind_b != 0 ok %% function [ind_a,ind_b] = find_nearest_car(dist,cars) num = size(cars,1); ind_a = 0; ind_b = 0; if num ~= 0 for ind = 1:size(cars,1) if dist >= cars(ind,2) ind_a = ind-1;

Page 24: Improved Method of Cellular Automata to Study Effects of ...math.tongji.edu.cn/model/docs/comap55420jianglh.pdf · Improved Method of Cellular Automata to Study Effects of Self-Driving

Team # 55420 Page 24 of 24 ind_b = ind; else ind_a = ind; end end end end

find_equilibria.m

%% find equilibria in cars, input argument should contain all valid numbers function [i, m] = find_equilibria(cars) num = size(cars); m = mean(cars); for i = 11:num if mean(cars(i-10:i+10)) > m break; end m = (m * (num-i+1) - cars(i))/(num-i); end m = mean(cars(i+1:num)); end

after_dist_available.m

function available = after_dist_available(pre, post) safe = safe_distance(pre(1), post(1), pre(3)); available = (safe < pre(2) - post(2)); end