目录
MESA
Agents
配置智能体类,每一类智能体配置一个类
初始化智能体初始参数
构建智能体行为方法,如move,eat,attack等
Model
配置沙盒模型类
初始化沙盒参数,如width, height, seed等
初始化一些初始属性
初始化沙盒空间
配置dataCollector
(可选)配置环境智能体层
配置各类智能体create_agents
构建模型每个时间步运行函数step,含环境行为、智能体行为,dataCollector收集数据,(可选)对数据进行初步处理
(可选) run_model函数控制时间步
App
配置应用ui参数
配置portrayal指定智能体可视化属性,agent_portrayal指定智能体marker, color, size等,propertylayer_portrayal指定环境智能体可视化属性
使用make_space_component, make_mpl_space_component应用portrayal配置智能体沙盒可视化样式,可以添加后处理函数、配置网络draw_grid
使用make_plot_component将数据收集器收集的数据可视化
model_params字典配置用户可选和固定模型参数,可选type如InputText, Slider, Checkbox
实例化模型
使用SolaraViz配置页面,包含模型,组件,模型参数,模型名称,play_interval等
调用page
其他
Batch Run等功能详细见Quarto笔记