APES: a Python toolbox for simulating reinforcement learning environments

Aqeel Labash, Ardi Tampuu, Tambet Matiisen, Jaan Aru, Raul VicentearXiv 2018

Abstract

The Artificial Primate Environment Simulator (APES) is a highly customizable Python toolbox designed for creating 2D grid-world environments for reinforcement learning (RL). APES distinguishes itself by offering sophisticated multi-agent support and realistic, partially observable vision systems based on shadow-casting algorithms. This paper details the architecture of APES, its procedural generation capabilities, and performance benchmarks that demonstrate its suitability for large-scale RL training.

Introduction

In reinforcement learning, the environment is as critical as the agent's architecture. While platforms like OpenAI Gym provide standard interfaces, they often lack the flexibility needed for researchers to design complex scenarios involving partial observability and multi-agent dynamics. In biological contexts, agents do not have a global view of their surroundings; they must navigate with limited fields of vision and occlusions. APES addresses these needs by providing a bridge between simple grid-worlds and biologically-inspired simulations, allowing for fine-tuned control over what agents perceive.

Methods

APES is structured around two core components: the World and the Agents' Interface.

The APES architecture illustrating the interaction loop between agents and the environment interface.

The World and Procedural Generation

The World component manages the 2D grid physics and item placement. A standout feature is the Probability Distribution Matrix (PDM), which allows researchers to define item spawning locations using heatmaps rather than fixed coordinates. This ensures that agents learn to generalize spatial strategies rather than memorizing specific cell positions.

The Interface and Vision Systems

The Interface handles the sensorimotor loop and supports two distinct vision modes: Allocentric (a bird’s-eye view following the agent) and Egocentric (a first-person perspective). To simulate realistic vision, APES utilizes a shadow-casting algorithm to determine cell visibility based on occluders like walls and the agent's specific vision parameters.

Demonstration of the shadow-casting algorithm. The left panel shows the global state with shadows, while the right panel shows the agent's restricted visual input.

Multi-agent Support

APES facilitates the study of social dynamics through tunable agent attributes such as Power (affecting collision outcomes) and Transparency (determining if an agent blocks another's view). These features allow for the simulation of competitive or cooperative scenarios where agents can physically interact or obstruct one another.

Results and Performance

APES is optimized for speed, which is crucial for training deep RL models requiring millions of iterations. On a standard Intel Core i5-5200U CPU, the simulator processes approximately 450 steps per second for a two-agent setup on an 11x11 grid.

The toolbox also includes built-in "Autopilots" (e.g., A* pathfinding), enabling researchers to verify environment logic before deploying complex neural network-based agents. Compared to benchmarks like MazeBase or VGDL, APES provides superior customization for 2D partial observability and environment dynamics.

Discussion

While APES excels in logic and strategy simulation, it is currently limited to square-shaped 2D grid worlds and does not support continuous movement or 3D physics. Future work will focus on expanding geometric flexibility and encouraging community-driven development to explore multi-agent cooperation in scenarios with imperfect information.

Reference: The full code for APES is available at https://github.com/aqeel13932/APES.

Summary updated

BibTeX
@misc{labash2018apes,
  author = {Aqeel Labash and Ardi Tampuu and Tambet Matiisen and Jaan Aru and Raul Vicente},
  title = {{APES: a Python toolbox for simulating reinforcement learning environments}},
  year = {2018},
  eprint = {1808.10692},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1808.10692},
}
Figure