【元胞自动机】基于元胞自动机模拟交叉口右转机动车过街社会力模型matlab源码
A 简介
1 历史\ 最初的元胞自动机是由冯 · 诺依曼在 1950 年代为模拟生物 细胞的自我复制而提出的. 但是并未受到学术界重视.\ 1970 年, 剑桥大学的约翰 · 何顿 · 康威设计了一个电脑游戏 “生命游戏” 后, 元胞自动机才吸引了科学家们的注意.
1983 年 S.Wolfram 发表了一系列论文. 对初等元胞机 256 种 规则所产生的模型进行了深入研究, 并用熵来描述其演化行 为, 将细胞自动机分为平稳型, 周期型, 混沌型和复杂型.
2 应用
- 社会学: 元胞自动机经常用于研究个人行为的社会性, 流行 现象. 例如人口迁移, 公共场所内人员的疏散, 流行病传播.
- 图形学: 元胞自动机以其特有的结构的简单性, 内在的并行 性以及复杂计算的能力成为密码学中研究的热点方向之一
- 物理学: 在物理学中, 元胞自动机已成功的应用于流体, 磁 场, 电场, 热传导等的模拟. 例如格子气自动机.
3 一维元胞自动机——交通规则\ 定义:
- 元胞分布于一维线性网格上.
- 元胞仅具有车和空两种状态.\
- 元胞状态由周围两邻居决定.
规则:研究的变化对象只是中间的格子,后面的车子要比前面的车子起步延迟1格。\
4 二维元胞自动机——生命游戏\ 定义:
- 元胞分布于二维方型网格上.
- 元胞仅具有生和死两种状态.\
- 元胞状态由周围八邻居决定.
规则:\
骷髅:死亡;笑脸:生存\ 周围有三个笑脸,则中间变为笑脸\ 少于两个笑脸或者多于三个,中间则变死亡。
5 什么是元胞自动机\ 离散的系统: 元胞是定义在有限的时间和空间上的, 并且元 胞的状态是有限.\ 动力学系统: 元胞自动机的举止行为具有动力学特征.\ 简单与复杂: 元胞自动机用简单规则控制相互作用的元胞 模拟复杂世界.\
6 构成要素
| | | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | |
(1)元胞 (Cell)\ \ 元胞是元胞自动机基本单元:
- 状态: 每一个元胞都有记忆贮存状态的功能.
- 离散: 简单情况下, 元胞只有两种可能状态; 较复杂情况下, 元胞具有多种状态.
- 更新: 元胞的状态都安照动力规则不断更新.
(2)网格 (Lattice)\ 不同维网格\
常用二维网格\
(3)邻居 (Neighborhood)\
(4)边界 (Boundary)\ \ 反射型:以自己作为边界的状态\ 吸收型:不管边界(车开到边界就消失)
(5)规则(状态转移函数)\ 定义:根据元胞当前状态及其邻居状况
确定下一时刻该元胞状态的动力学函数, 简单讲, 就是一个状态转移函数.
分类 :
- 总和型: 某元胞下时刻的状态取决于且仅取决于它所有邻居 的当前状态以及自身的当前状态.
- 合法型: 总和型规则属于合法型规则. 但如果把元胞自动机 的规则限制为总和型, 会使元胞自动机具有局限性.
(6)森林火灾\
绿色:树木;红色:火;黑色:空地。\ 三种状态循环转化:\ 树:周围有火或者被闪电击中就变成火。\ 空地:以概率p变为树木
理性分析:红为火;灰为空地;绿是树\ \ 元胞三种状态的密度和为1\ \ 火转化为空地的密度等于空地转换为树的密度(新长出来的树等于烧没的树)\ \ f ff是闪电的概率:远远小于树生成的概率;T s m a x T_{smax}Tsmax是一大群树被火烧的时间尺度
程序实现\ 周期性边界条件\ 购进啊\ \ 其中的数字为编号\ 构建邻居矩阵
\
上面矩阵中的数字编号,对应原矩阵相同位置编号的上邻居编号,一 一对应\ 同样道理:\
(7)交通概念\ 车距和密度\
流量方程\
守恒方程\
时空轨迹(横轴是空间纵轴为时间)
红线横线与蓝色交点表示每个时间车的位置。\ 如果是竖线则表示车子在该位置对应的时间
宏观连续模型:\ \ 最常用的规则:\ \ 红色条表示速度是满的。
1 加速规则:不能超过v m a x ( 2 格 / s ) v_{max}(2格/s)vmax(2格/s)\ 2 防止碰撞:不能超过车距
理论分析:\
结果分析: 密度与流量\ \ 第一个图:横坐标是归一化后的密度,纵坐标是车流量。第二个图:理论值与CA的结果
结果分析: 时空轨迹\ \ 中间的深色区域是交通堵塞的区域。
``` function varargout = renyuanshusan(varargin)
% RENYUANSHUSAN M-file for renyuanshusan.fig
% RENYUANSHUSAN, by itself, creates a new RENYUANSHUSAN or raises the existing
% singleton*.
%
% H = RENYUANSHUSAN returns the handle to a new RENYUANSHUSAN or the handle to
% the existing singleton*.
%
% RENYUANSHUSAN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in RENYUANSHUSAN.M with the given input arguments.
%
% RENYUANSHUSAN('Property','Value',...) creates a new RENYUANSHUSAN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before renyuanshusan_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to renyuanshusan_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help renyuanshusan
% Last Modified by GUIDE v2.5 08-Mar-2014 16:52:27
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
guiState = struct('guiName', mfilename, ...
'guiSingleton', guiSingleton, ...
'guiOpeningFcn', @renyuanshusanOpeningFcn, ...
'guiOutputFcn', @renyuanshusanOutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
guiState.guiCallback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = guimainfcn(guiState, varargin{:});
else
guimainfcn(guiState, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before renyuanshusan is made visible.
function renyuanshusan_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to renyuanshusan (see VARARGIN)
% Choose default command line output for renyuanshusan
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes renyuanshusan wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = renyuanshusan_OutputFcn(~, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(~, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
x=get(hObject,'value');
set(handles.text16,'string',num2str(x));
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit8 as text
% str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
x=get(hObject,'value');
set(handles.text18,'string',num2str(x));
% --- Executes during object creation, after setting all properties.
function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit9 as text
% str2double(get(hObject,'String')) returns contents of edit9 as a double
% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% if Popbeikun> Popbeikun1;
% Popbeikun1=Popbeikun;
set(handles.text27,'string',num2str(Pop_beikun));
% end
if Pop==Popbeikun||sum(sum(DstS))==col*row;
set(handles.text27,'string',num2str(Pop));
break
end
end
hold off
set(handles.text33,'string','仿真结束!!');
return
%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in pushbutton3.
function ExitS=pushbutton3Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function edit11_Callback(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit11 as text
% str2double(get(hObject,'String')) returns contents of edit11 as a double
% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton4.
function pushbutton4Callback(hObject, eventdata, handles,ExitS)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pause off ```
【元胞自动机】基于元胞自动机模拟交叉口右转机动车过街社会力模型matlab源码相关推荐
- matlab和投影寻踪,基于遗传算法的投影寻踪模型Matlab源码
基于遗传算法的投影寻踪模型Matlab源码 %% "投影寻踪+遗传算法优化"的主仿真程序 % GreenSim团队原创作品,转载请注明 % Email:greensim@http: ...
- 【元胞自动机】保守策略元胞自动机三车道(不开放辅路,软件园影响)交通流模型matlab源码
一.元胞自动机简介 1 元胞自动机发展历程 最初的元胞自动机是由冯 · 诺依曼在 1950 年代为模拟生物 细胞的自我复制而提出的. 但是并未受到学术界重视. 1970 年, 剑桥大学的约翰 · 何顿 ...
- 【元胞自动机】激进策略元胞自动机三车道(开放辅路,软件园影响)交通流模型matlab源码
一.元胞自动机简介 1 元胞自动机发展历程 最初的元胞自动机是由冯 · 诺依曼在 1950 年代为模拟生物 细胞的自我复制而提出的. 但是并未受到学术界重视. 1970 年, 剑桥大学的约翰 · 何顿 ...
- 【元胞自动机】激进策略元胞自动机三车道(不开放辅路,软件园影响)交通流模型matlab源码
一.元胞自动机简介 1 元胞自动机发展历程 最初的元胞自动机是由冯 · 诺依曼在 1950 年代为模拟生物 细胞的自我复制而提出的. 但是并未受到学术界重视. 1970 年, 剑桥大学的约翰 · 何顿 ...
- 【非洲秃鹫优化算法】基于非洲秃鹫优化算法求解单目标优化问题(AVOA)含Matlab源码
1 简介 元启发式算法在解决优化问题中起着至关重要的作用.大多数此类算法的灵感来自集体智慧和自然界生物的觅食.在本文中,受非洲秃鹰生活方式的启发,提出了一种新的元启发式算法.该算法被命名为非洲秃鹰优化 ...
- 【白冠鸡优化算法】基于白冠鸡优化算法求解单目标优化问题(COOT)含Matlab源码
1 简介 最近,已经提出了许多智能算法来寻找复杂工程问题的最佳解决方案.这些算法可以搜索易变的多维解空间,并及时找到最优答案.在本文中,提出了一种新的元启发式方法,该方法可以激发称为 Coot 的鸟群 ...
- 【特征选择】基于亨利气体溶解度优化算法求解二进制特征选择问题(HGSO)含Matlab源码
1 简介 最近已经开发了几种元启发式优化算法来解决现实世界的问题.本文提出了一种新的元启发式算法,称为亨利气体溶解度优化 (HGSO),它模仿亨利定律支配的行为来解决具有挑战性的优化问题.亨利定律是一 ...
- 【语音识别】基于结合mfcc和lpc特征、SVM支持向量机实现中英语种识别matlab源码
一.简介 MFCC(Mel-frequency cepstral coefficients):梅尔频率倒谱系数.梅尔频率是基于人耳听觉特性提出来的, 它与Hz频率成非线性对应关系.梅尔频率倒谱系数(M ...
- 【优化求解】基于遗传算法求解多目标配电网重构模型matlab源码
一.故障信息的数学表示 在上图中K表示断路器,每一个断路器上均有一个FTU装置,可以反馈断路器开关是否过流,用表示上传的故障信息,反映的是各分段开关处是否流过故障电流有故障电流为1,否则为0).即: ...
- 【配电网重构】基于粒子群求解配电网重构模型matlab源码
一.故障信息的数学表示 在上图中K表示断路器,每一个断路器上均有一个FTU装置,可以反馈断路器开关是否过流,用表示上传的故障信息,反映的是各分段开关处是否流过故障电流有故障电流为1,否则为0).即: ...
最新文章
- 【Java】面试官灵魂拷问:if语句执行完else语句真的不会再执行吗?
- Science:英国Castrillo组揭示微生物群与根内皮的协调支持植物营养平衡!
- WPF的消息机制(三)- WPF内部的5个窗口之处理激活和关闭的消息窗口以及系统资源通知窗口...
- ASP.NET防止按F5键造成表单重复提交
- Error:org.gradle.api.internal.changedetection.state.FileCollectionSnapshotImpl cannot be cast to org
- 权限组件(4):给动态菜单增加面包屑导航
- 分类型变量预测连续型变量_终于弄清楚java的变量与类型了!
- 基于ASP.NETAJAX的WebPart开发与部署-转
- Genius‘s Gambit(构造)
- 手写字体识别用python实现_Python3实现简单可学习的手写体识别
- 第三方支付和代付区别在哪?
- 在elementUI中sort-orders排序,默认为三种,怎么改成两种
- 自适应Simpson法P4525 【模板】自适应辛普森法1
- 第三版全球干旱指数和潜在蒸散数据发布
- 计算机界面显示不完整,win10系统打开软件界面发现显示不全的方法介绍
- 局部刷新的两种实现方式
- IDC数据:中国VR市场2017预计增幅将达441.2%
- Vmware ubuntu桥接方式联网
- 迅为RK3399开发板Qt实时时钟测试
- 没事别惹程序员_他们可是能毁灭地球的生物
热门文章
- python依赖包安装
- 天堂2芙蕾雅单机版mysql闪退_【图片】天堂2单机版-芙蕾雅。算是我这个老人对天堂2吧友的最后贡献吧!_天堂2吧_百度贴吧...
- 毕业设计——宠物店管理系统
- WordPress主题精美写真图片图集网站源码
- python结巴分词的缺点_Python 结巴分词
- echarts官网的使用方法
- CISSP怎么复习备考
- e580显卡驱动_联想e580网卡驱动下载|联想e580无线网卡驱动官方版_ - 极光下载站...
- YYKit-YYDispatchQueuePool分析
- libxml2的安装及使用