元胞自动机更新规则 Mathematica
我正在尝试建立一些关于元胞自动机的规则。在每个细胞中,我没有一种元素(捕食者/猎物),但我有一定数量的人口。为了实现群体之间的移动,我可以每次将每个单元格与其邻居之一进行比较吗?或者我是否必须将该单元与其所有邻居进行比较并添加一些条件。
我正在使用摩尔邻域和以下更新功能,
update[site,_,_,_,_,_,_,_,_]
我试图让它们根据所有邻居移动,但它非常复杂,我想知道是否通过简化它并单独与所有邻居检查它会是错误的。
谢谢
I am trying to built some rules about cellular automata. In every cell I don't have one element (predator/prey) I have a number of population. To achieve movement between my population can I compare every cell with one of its neighbours every time? or do I have to compare the cell with all of its neighbours and add some conditions.
I am using Moore neighbourhood with the following update function
update[site,_,_,_,_,_,_,_,_]
I tried to make them move according to all of their neighbours but it's very complicated and I am wondering if by simplify it and check it with all of its neighbours individually it will be wrong.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为一般建议,我建议不要使用 Mathematica 中的模式识别技术来指定 CA 中的规则表,它们往往很快就会失控。
使用 CA 进行捕食者-被捕食者类型的模拟有点棘手,因为在每一步中(与传统 CA 不同)中心单元的值随着相邻单元的值而变化!
这将导致问题,因为当将转换函数应用于邻居单元时,它将再次为自己计算一个新值,但它还需要“记住”之前当它是邻居时对其所做的更改。
在使用 CA 的流体动力学模拟中,他们遇到了这样的问题,他们使用了一个不同的邻域,称为 Margolus 邻域。在 Margolus 邻域中,CA 网格被分成不同的块,并且更新规则应用于每个块。在下一步中,块边界发生变化,并且转换规则应用于新边界,因此信息传输发生在块边界上。
As a general advice I would recommend against going down the pattern recognition technique in Mathematica for specifying the rule table in CA, they tend to get out of hand very quickly.
Doing a predator-prey kind of simulation with CA is a little tricky since in each step, (unlike in traditional CA) the value of the center cell changes ALONG WITH THE VALUE OF THE NEIGHBOR CELL!
This will lead to issues since when the transition function is applied on the neighbor cell it will again compute a new value for itself, but it also needs to "remember" the changes done to it previously when it was a neighbor.
In fluid dynamics simulations using CA, they encounter problems like this and they use a different neighborhood called Margolus neighborhood. In a Margolus neighborhood, the CA lattice is broken into distinct blocks and the update rule applied on each block. In the next step the block boundaries are changed and the transition rules applied on the new boundary, hence information transfer occurs across block boundaries.
在我给出最佳答案之前,您必须意识到您的问题措辞很奇怪。你的元胞自动机的更新规则是你指定的,所以我不知道你是否有额外的条件需要实现。
我认为您问的是选择邻域的最佳方法是什么,您可以使用“部分”来执行此操作:
这将选择适当的摩尔邻域,包括附加的中心单元,您可以在调用更新函数时将其过滤掉。
具体来说,要执行元胞自动机的更新步骤,必须同时更新所有单元。在现实世界中,这意味着创建一个单独的数组,并将更新的值放在那里,然后废弃原始数组。
有关更多详细信息,请参阅我关于元胞自动机,其中包括 Conway 的生命游戏在 Mathematica 中的实现。
Before I give my best attempted answer, you have to realize that your question is oddly phrased. The update rules of your cellular automaton are specified by you, so I wouldn't know whether you have additional conditions you need to implement.
I think you're asking what is the best way to select a neighborhood, and you can do this with Part:
This will select the appropriate Moore neighborhood, including the additional central cell, which you can filter out when you call your update function.
Specifically, to perform the update step of a cellular automaton, one must update all cells simultaneously. In the real world, this means creating a separate array, and placing the updated values there, scrapping the original array afterward.
For more details, see my blog post on Cellular Automata, which includes an implementation of Conway's Game of Life in Mathematica.