├── main.m ├── new_cars.m ├── create_pixel.m ├── go_forward.m ├── red_light_on.m ├── show_pixel.m ├── clear_boundary.m ├── create_street.m ├── compare_diff_xiaoqu.m ├── 2019-02-23-11.40.16.gif ├── .gitattributes └── README.md /main.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/main.m -------------------------------------------------------------------------------- /new_cars.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/new_cars.m -------------------------------------------------------------------------------- /create_pixel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/create_pixel.m -------------------------------------------------------------------------------- /go_forward.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/go_forward.m -------------------------------------------------------------------------------- /red_light_on.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/red_light_on.m -------------------------------------------------------------------------------- /show_pixel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/show_pixel.m -------------------------------------------------------------------------------- /clear_boundary.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/clear_boundary.m -------------------------------------------------------------------------------- /create_street.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/create_street.m -------------------------------------------------------------------------------- /compare_diff_xiaoqu.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/compare_diff_xiaoqu.m -------------------------------------------------------------------------------- /2019-02-23-11.40.16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanring/Cellular-Automata-Traffic-Simulation/HEAD/2019-02-23-11.40.16.gif -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cellular-Automata-Traffic-Simulation 2 | Research on The Impact of Road Traffic Around on Opening Residential Community Based on Cellular Automaton 3 | 基于元胞自动机的城市小区开放对周边道路通行的影响研究 4 | 5 | 本题为2016年高教杯数学建模大赛B题代码,获国家一等奖 6 | 7 | 编写环境:Matalab R2016a 8 | 已在Matalab R2014a中测试,可以正常运行. 9 | 10 | 程序主文件:main.m 11 | 12 | 功能:运行main.m 可以对其所指定参数的模型进行模拟仿真,以时步为单位显示车辆在地图中的运动过程,并统计数据与绘图。参数设置位置在程序中已给出。 13 | 14 | 参数: 15 | 16 | * red_light_time = 60;%红灯时间 17 | 18 | * green_light_time = 40;%绿灯时间 19 | 20 | * fresh_frequency = 0.01;%刷新速率 21 | 22 | * num_of_street = 3;%小区道路的数量,也就是交叉口的数量 23 | 24 | * global pixellength;%定义全局变量车道长度 25 | 26 | * pixellength = 30;%主道的长度 27 | 28 | * side_length = 25;%小区边长 29 | 30 | 注意:主道长度不能小于小区边长! 31 | 32 | 33 | 比较不同小区的情况的文件:compare_diff_xiaoqu.m 34 | 35 | 功能:运行compare_diff_xiaoqu.m可以对其小区大小的数组进行设置,然后可以对每一种大小小区进行仿真及统计数据。最后每一种小区都会绘出其在设置不同数量的道路下的车辆平均速度与拥堵度。 36 | 37 | 参数:diff_xiaoqu_size不同小区的大小数组,默认为diff_xiaoqu_size=[25 50 70]。主路长度与小区边长的默认比值为1.4 38 | 39 | 运行main.m 40 | 41 | 不同的小区开放情况下产生的结果: https://yanring-1252048839.cos.ap-guangzhou.myqcloud.com/img/2019-02-23-11.40.16.gif 42 | 43 | ![](https://github.com/yanring/Cellular-Automata-Traffic-Simulation/blob/master/2019-02-23-11.40.16.gif) 44 | 45 | 46 | --------------------------------------------------------------------------------