A list,

1. The definition and application scope of cellular automata are different from general dynamics models. Cellular automata are not determined by strictly defined physical equations or functions, but are composed of rules constructed by a series of models. Any model that satisfies these rules can be regarded as a cellular automata model. Therefore, cellular automata is a general term for a class of models, or a method framework. Its characteristic is that time, space and state are discrete, each variable only takes a finite number of states, and its state change rules are local in time and space.

Cellular automata – applications to forest fire and infectious disease scenarios. Recently, I have come into contact with cellular automata models, have done some data searching, and have studied. I recommend this article in Australia. Why are Australia’s bushfires so difficult to control? The following is a record of what you have learned.

Principle of cellular automata in cellular automata models, Spaces are discrete into grids, and each grid is called a cell. Forest fire cells have three states: tree, fire (burning tree) and empty (vacant) state. The update rules of cellular state at the next moment are as follows: Tree becomes fire: a tree whose upper and lower states are fire will become fire at the next moment. Or a tree hit by lightning, and the next moment it turns into fire. Because the probability of encountering a lightning blaze is small.

Fire becomes empty: Fire becomes empty at the next moment.

Empty tree: A new tree will grow at a low rate of Pgrowth at any given moment.

The modified model takes into account whether the diagonal position of the tree is on fire. Or consider the direction of the wind (for example, if the fire blows from east to west), the west side of the fire is more likely to catch fire (downwind), and the east side of the fire is less likely to catch fire (upwind).



Figure A is the basic cellular automata, Figure B is the cellular automata considering the diagonal, and Figure C is the cellular automata blowing the west wind.

Here, I simulate three models of basic cellular automata, cellular automata considering the diagonal case, and cellular automata considering the westerly wind. The simulation results are as follows:





Ii. Source code

P=[];
for m=1:10
clear D T fire_time_lightning fire_time_itself aspect tdata Index;
%% Orginal 
%the first 3Dimension is RGB, R is the fire, G is the tree. %Black is the meaning of no tree. global n D T Y fire_time_lightning fire_time_itself fire_time_demend pull aspect count_1 tdata Pull_times n=500;      % the length of the forest matrix
D=zeros(n);
T=zeros(n);
Y=zeros(n,n,3); % draw the picture by matrix Y (RGB) fire_time_lightning=0;
fire_time_itself=0;
fire_time_demend=0;
times=1;
pull=1/times;     % the rate of pull the fire out 
aspect=ceil(rand(1) *4);  % 1 is right,2 is up,3 is left and 4 is down.
count_1=0;
tdata=[];     % the day by each fire happened.
Pull_times=0;
f1=1/1000;     % f1 is the probability in ceil when it being struck by lightning. 
f2=1/500;     % f2 is the probability in ceil when it being fired itself. 
Z=Terrain();
[scale_b,S]=Forest(Z);
Tem=S;
Yi=imshow(Y);
set(gcf,'DoubleBuffer'.'on');
% set up the double cache to prevent the flash in palying animation constantly
t=0;
tp=title(['T = ',num2str(t)]);
%ap=title(['aspect = ',num2str(aspect)]);
%while 1
%    t=t+1;
for t=1:2400
%% Fire in the early time
if rem(t,50) = =0&&t<1000
   Fire_Demand(S); 
end
%% Lightning
if rand<f1          %Is there happen sth with lightning?
    OriginFireLightning(S);     
    set(Yi,'CData',Y);
end
%% Fire itself
if t>10
    OriginFireCritical(S,t,f2);
    set(Yi,'CData',Y);
end
%% FireRule1
[a,b]=FireRule1(S);
%% FireRule2
S=FireRule2(S,a,b);
 
set(Yi,'CData',Y);
set(tp,'string'['T = ',num2str(fix(t/(24))),'D = ',num2str(t),'h '])
%set(ap,'string'['aspect = ',num2str(aspect)])
pause(2e-6)
end
scale_n=sum(sum(Y(:,:,2))); fire_count=fire_time_itself+fire_time_lightning; Lost_area=scale_b-scale_n; Lost_rate_all=Lost_area/scale_b; Lost_rate_average=Lost_rate_all/(fire_count); Tem=Tem-S; Tem=Tem.*Tem; %Lost_Value=sum(sum(Tem)); %N=[pull Lost_rate_all Lost_rate_average fire_count] P=[P; fire_time_demend Pull_times Lost_rate_all fire_time_itself fire_time_lightning] %figure (2)
%plot(tdata(:,1),tdata(:,2));
end
 
Copy the code

3. Operation results



Fourth, note

Version: 2014 a