# Multi-Agent Simulation Environment for Logistics Warehouse Design Based on Self-Contained Agents
## 4 Prototypical Implementation of Proposed Simulation Environment  
We used the Python programming language for the prototypical implementation of the proposed simulation environment. Our implementation does not include external libraries other than the standard packages included in Python 3. Figure 7 shows the configuration of the prototyped multi-agent simulation environment. To implement the self-contained agent architecture mentioned earlier, we developed a template called agent core library as described earlier. This template includes the necessary functions for messaging, connecting to the agent workplace, rule evaluation, working memory data structures, and so on, thus developers only need to write rules and actions of each agent. In this study, the rule evaluation module is manually developed from scratch that works as a general production system, but it can be implemented using other inference engines. The message interface is implemented using network socket-based communication.  
Users describe the agent's rules of behaviors and actions, then use the agent generator (compiler) to merge the described rules and actions with the Agent Core Library into a self-contained executable agent program (<agentID>.py). The logging and spatial-temporal agents have, as mentioned above, the same architecture as the simulation agents. We also prepared a template for the logging and spatial-temporal agents, which is an extension of the agent core library for simulation agents. The basic functionality for these two agents is prepared in the templates that are independent from the simulation targets. We prepared the agent workplace as a single Python script that is executable in the platform where the basic Python runtime environment is available.  
The developed agents are executed based on the agent workplace, and the simulation logs are exported by the logging agent before the simulation ends. We prepared a visualization program to import and visualize the logistics warehouse's layout and the location of agents and objects (e.g., AGVs, items and shelves) in each time frame. We prepared basic visualization models, such as for shelves, AGVs in a simple rectangular shape, walls, and floors. The visualization program is implemented using a processing programming language.  
Figure 8 shows the runtime configuration of the simulation model using the prototype of our simulation environment. Each agent is an independently executed Python script, and all agents are connected to the agent workplace via TCP/IP connections to send messages.  
Figure 7: Composition of prototyped multi-agent modelling environment.  
Figure 9 shows the network configuration of agents. Since agents and the workplace are connected via TCP/IP connections, it is possible to run agents in distributed PCs to run a simulation if the network is a properly configured local area network (LAN). Except the security settings, such as firewall settings, agents can be moved from one PC to another without modification to the program because each agent has an address of the workplace and can connect to the workplace even if the running PC is changed. This characteristic helps users distribute computing loads. The modifiability of runtime configuration (which PC to run which agent) is established based on these characteristics.