# Multi-Agent Simulation Approach for Modular Integrated Construction Supply Chain
## 3 Proposed Agent-Based Model
### Model Implementation Using AnyLogic
#### 3.4.2 Model Implementation
This state is triggered by a message indicating that the vehicle should load the prefabricated components. After loading the components, transporter \(T_{1}\) transitions to the movingToFactory state. This state is triggered by a timeout, representing the travel time required to move from the supplier's facility to the MiC factory. Once transporter \(T_{1}\) arrives at the factory, it transitions to the unloading state. This state is triggered by the arrival of the agent at the factory, where the vehicle unloads the prefabricated components. Following the unloading process, transporter \(T_{1}\) moves to the movingToSupplier state. This state is also triggered by a timeout, indicating the travel time required for the vehicle to return to the supplier's location. Upon arrival at the supplier's facility, transporter \(T_{1}\) transitions back to the atSupplier state. This state is triggered by the agent's arrival, marking the completion of one transportation cycle and readying the vehicle for the next order. Statechart for Transporter \(T_{2}\) Agent:  
The statechart diagram in Figure 6e represents the various states and transitions of transporter \(T_{2}\). This agent is responsible for moving integrated construction modules from MiC factories to construction sites. The initial state, indicated as a statechart, marks the starting point of the process. Transporter \(T_{2}\) begins in the atFactory state, where it is initially located at the MiC factory. In this state, transporter \(T_{2}\) is waiting to receive an order. Upon receiving an order, transporter \(T_{2}\) transitions to the loading state. This state is triggered by a message indicating that the vehicle should load the integrated modules. After loading, transporter \(T_{2}\) transitions to the movingToConstructionSite state. This state is triggered by a timeout, representing the travel time required to move from the MiC factory to the construction site. Once transporter \(T_{2}\) arrives at the construction site, it transitions to the unloading state. This state is triggered by the arrival of the agent at the construction site, where the vehicle unloads the construction modules. Following the unloading process, transporter \(T_{2}\) moves to the movingToFactory state. This state is also triggered by a timeout, indicating the travel time required for the vehicle to return to the MiC factory. Upon arrival at the factory, transporter \(T_{2}\) transitions back to the atFactory state. This state is triggered by the agent's arrival, marking the completion of one transportation cycle. Main Agent Implementation:  
The Main Agent in the AnyLogic model integrates all other agents and manages the overall simulation environment which is set up to reflect the real-world logistics network, including geographical locations, transportation routes, and factory and construction site locations. A key feature of the Main Agent is the incorporation of a GIS Map, which locates all agents based on their latitude and longitude coordinates. This GIS Map uses data from the OpenStreetMap (OSM) server and is configured to utilize road types, ensuring accurate route planning and transportation simulation [54]. OSM has aimed to build a detailed, freely accessible map of the world, offering precise and constantly updated geographic data for applications like traffic information, navigation, geospatial analysis, and travel urban planning [55]. In the context of the MiC supply chain, OSM plays a significant role by providing open, collaborative mapping data that help improve operational efficiency, reduce costs, and ensure the timely and reliable deliveries of both prefabricated components and integrated modules. Using the OSM server by the transporter \(T_{1}\) and \(T_{2}\) agents ensures the use of open standards and compatible data formats for easier interoperability and data exchange.