Python is widely used for agent-based modelling because it is accessible and has a mature scientific ecosystem, but object-per-agent execution incurs interpreter overhead that restricts the population sizes feasible in interactive modelling, calibration, and parameter sweeps. This paper presents AMBER, a Python framework that stores agent state in a Polars-backed columnar table and exposes population operations through a compact view API. The framework preserves conventional model and agent abstractions while translating common population updates into compiled column operations; behaviours that do not vectorise remain expressible through a buffered object-oriented path. We evaluate AMBER on wealth transfer, random walk, and spatial SIR benchmarks against Mesa, AgentPy, SimPy, Melodie, Agents.jl, and AMBER's own loop path, using invariant checks to verify comparable model outputs before timing. Across the tested workloads, AMBER has the lowest execution time among Python-hosted implementations and achieves speedups of up to $1118\times$ over Mesa; on the largest SIR benchmark it is also faster than the Julia-based Agents.jl implementation.
翻译:Python因其易用性和成熟的科学计算生态而被广泛用于智能体建模,但基于对象-智能体的执行方式会产生解释器开销,从而限制了交互式建模、校准和参数扫描中可行的种群规模。本文提出AMBER,一种Python框架,它将智能体状态存储在基于Polars的列式表中,并通过紧凑的视图API暴露种群操作。该框架在保留传统模型和智能体抽象的同时,将常见种群更新转化为编译后的列操作;无法向量化的行为仍可通过缓冲的面向对象路径表达。我们在财富转移、随机游走和空间SIR基准测试中,将AMBER与Mesa、AgentPy、SimPy、Melodie、Agents.jl以及AMBER自身的循环路径进行对比评估,通过不变性检验验证模型输出可比性后计时。在测试工作负载下,AMBER在所有Python实现的方案中执行时间最低,且相比Mesa实现高达1118倍的加速比;在最大规模的SIR基准测试中,其速度甚至优于基于Julia的Agents.jl实现。