Co-Simulation of Multiple Vehicle Routing Problem Models

: Complex systems are often designed in a decentralized and open way so that they can operate on heterogeneous entities that communicate with each other. Numerous studies consider the process of components simulation in a complex system as a proven approach to realistically predict the behavior of a complex system or to effectively manage its complexity. The simulation of different complex system components can be coupled via co-simulation to reproduce the behavior emerging from their interaction. On the other hand, multi-agent simulations have been largely implemented in complex system modeling and simulation. Each multi-agent simulator’s role is to solve one of the VRP objectives. These simulators interact within a co-simulation platform called MECSYCO, to ensure the integration of the various proposed VRP models. This paper presents the Vehicle Routing Problem (VRP) simulation results in several aspects, where the main goal is to satisfy several client demands. The experiments show the performance of the proposed VRP multi-model and carry out its improvement in terms of computational complexity.


Introduction
Complex systems is a multidisciplinary field and is the subject of active research in several domains such as physics, biology, social sciences and cognitive sciences. The authors of [1][2][3] define a complex system as a set of heterogeneous entities that interact between them, where each entity is characterized by its cooperative, adaptive and open nature. Simulation is one of the critical tools frequently used to study complex systems [4]. Simulation may reduce experimentation costs by allowing researchers to test various alternatives and scenarios of complex systems [5].
The Vehicle Routing Problem (VRP) presents a complex system [6,7] such that the VRP is considered as a group of dispersed clients that are served by a fleet of vehicles that start and end at one depot [8]. Recently, VRP and its various models attracted the interest of intelligent transport researchers due to the complementary limitations of realworld problems, the potential cost savings and the possibility of service improvement in distributed systems. Due to the intrinsic complexity of determining rigorous models and optimal solutions to a large-scale instance of VRP, the process that involves exact solvers is limited, difficult and time-consuming [9]. Therefore researchers and transportation companies are interested in meta-heuristics such as Ant Colony Optimization (ACO), Genetic Algorithm (GA) and Parctical Swarm Optimization (PSO) to solve real world VRP by producing close to optimal solution. An efficient simulation may offer an opportunity to improve the performance of VRP by modeling different methods for solving various VRP objectives.
Co-simulation is applied in many different multidomain systems [10]. It is proposed to address the issues and challenges of complex systems [11]. In this context, decomposed components of a complex system are modeled by different sub-models, then simulated using a simulator for each sub-model. Co-simulation enables exchanging coupling connections to achieve the behavior of the whole complex system as shown in Figure 1. The co-simulation middleware named Multi-agent Environment for Complex SYstem COsimulation (MECSYCO) allows the integration of several modeling and simulation software to co-simulate the dynamic behavior of a complex system. MECSYCO makes the possibility to compare simulation results, swap, add, or remove models.
This paper aims to address the challenge of showing the impact of simulating a VRP multi-model as several interacting simulators by reducing the traveled distance and the obtained time during vehicles routing with the aim to satisfy clients demands. In this context, we will design and implement multiple VRP models as complex systems with several perspectives of multi agent simulators. Each simulator in the proposed solution solves different objectives of the VRP and then makes them interact into the co-simulation platform. Multi agent simulators that represent the VRP models are developed using Netlogo and the whole system is reproduced based on the MECSYCO co-simulator. We observed that the interacting VRP models provide high quality solutions by minimizing significantly the cost of services offered to the clients, in terms of computational time and travel distance.

Sub-model 3
Simulator n Ant colony optimization Sub-model n …….. The rest of this work is organized as follows: In Section 2, we present the summary of the related multi-simulation of complex system research and introduce an overview of the used platform in the co-simulation and we describe the problem formulation of the VRP. The proposed solution is presented in Section 3. Section 4 provides the implementation details and the experiments results. Section 5 concludes the work and give some future work avenues.

Related Work
To better simulate the behavior of the whole complex and dynamic system, multimodeling and co-simulation are used to provide a strategy that collects a set of models from different discipline [12]. The modular architecture in the multi-agent environment of complex system co-simulation middleware offers the integration of heterogeneous simulators and models. In the literature, several works such as [5,13], have been proposed for the simulation of the complex system as interacting models for reproducing the behavior of the entire system. The work of [14] captures the improvement of decomposing and integrating continuous systems using MECSYCO as discrete environment. In [15], the authors designed the co-simulation of complex system with integral multi-agent simulators, while MECSYCO was used in [16] to integrate the modeling and the simulation tools to co-simulate the complete cyber-physical system.
The hybridization of meta-heuristics in the multi-agent system is used to facilitate the development of meta-heuristic frameworks' optimization. In addition, the development of hybrid meta-heuristics is flexible in multi-agent systems and it offers simultaneous exploration of various areas of the research space [17].
Several studies have been performed to solve different variations of VRP by using multi-agent systems [18]. The work of [19] uses the reinforcement learning and pattern matching to provide a multi-agent distributed framework where each agent adapts itself. In [20], the authors solve the VRP with Time Windows (VRPTW) by exploiting the principle of reinforcement learning to improve the agent actions based on the solutions generated by other agents and the environment interactions.
To improve the result of VRP, this paper aims to create an interacting VRP model by combining the multi-agent simulators to reproduce the entire VRP multi-model. From the literature, we observe that there is no proposal in multi agent systems that integrates simulators into a co-simulation platform to reproduce the entire VRP multi-model.

Co-Simulation of a Complex System
MECSYCO has been used as a middle-ware to simulate and model complex systems which allows the utilization of existing simulators for the implementation of heterogeneous and numerical simulations. MECSYCO focuses on both, the DEVS common formalism proposed by [21] that uses a discrete-event abstraction for the design of dynamic system [22], and on the Agent and artifact architecture using a multi-agent concepts [13] to perform the heterogeneous co-simulation of complex system. In this case, each model or simulator has been considered as an agent and the interaction between simulators corresponds to the indirect cooperation between agents using the defined concept of artifact in [23]. Coupling artifact aims to determine the input output connections between two models and to create the model agent (m-agent) which uses the artifact for leading their model and interchanging input/output data. MECSYCO manipulates a model as various composed models in interactions without a global coordinator using a simulator for each model [24]. This step occupies the management of decentralized multi model simulation in order to integrate several aspects of the same system into a coherent one and to deal with the main challenges of modeling and simulation of a complex system. On the other hand, MECSYCO already includes integrated simulators such as multi agent platform Netlogo, which is frequently used for simulating complex systems and modeling natural and social phenomena.

Mathematical Formulation of the Problem
This section deals with the mathematical formulation of the problem. In the combinatorial optimization field, VRP is one of the most challenging research problems. The issue was studied more than 40 years ago. It involves defining the best sequence of routes for a fleet of vehicles to provide the service to a specific set of clients. The fleet of vehicles is situated at a central depot, every vehicle has certain capacity and each client has a given demand. The aim is to optimize the total traveled distance to serve a geographically dispersed group of clients [25]. First, we have the following data:
A set of commands; 3.
A fleet of vehicles.
The objective is to reduce the total traveled distance from a depot to serve clients, using a similar fleet of vehicles. The issue of solving the VRP faces several design challenges and focuses on the assignment of clients to the routes. This process involves the determination of several routes for each depot by (1) assigning each client to a unique route without exceeding the capacity of the vehicle, and (2) determining a series of clients on every vehicle route. Hence, the mathematical formulation of the vehicle routing problem can be described as follows: • R denotes the set of nodes, R = {r 0 , r 1 , r 2 , . . . , r n }, with r 0 is the depot and r i , i = 0 is the client; • V denotes the sets of vehicles; • N is the number of all clients; • M is the number of vehicles; E is the edge set between nodes defined as: c ij is the cost of transporting one unit from node i to node j; • x k ij is 1, if vehicle k travels from node i to node j; 0, otherwise, • y ik is 1, if vehicle k offers service for client i; 0, otherwise.
From these definitions the objective function problem can be formulated as follows: where Equation (1) represents the objective function that aims to reduce the total travel cost and the constraints formulations are: where Equation (2) aims to ensure that every client is allocated in the single route and Equation (3) is the capacity constraint set for vehicles. Whereas Equation (4) is defined to assure that each client can be served only once and Equation (5) ensures that all delivery vehicles must return to the original depot after finishing their task.

The Designed Model
The goal of this paper is to solve the VRP by building a complex simulation using a society of interacting co-evolving VRP models. The proposed approach provides a solution based on the agent and artifact concept [23,26,27]. The simulation is performed by m-agents that manage their model and data exchange using artifacts.
The first task to do is to define a solution for solving each VRP model using an atomic VRP simulator. Then, the second task is to determine the input output connections between these simulators. The final task is to construct coupled interacting co-evolving VRP models.

Description of Atomic VRP Models
The routing and scheduling of a service correspond to the creation of vehicle routes for the depot. By assigning each client to a unique route and respecting the capacity of the vehicle the order of the clients on every vehicle route will be determined. To this end, we develop two models to solve VRP such that each model is to satisfy a different objective.
The first is to try to minimize the total traveling distance and the second is to minimize the number of vehicles.

First VRP Model
We use ant colony optimization for the VRP, where the colony of ants is created from the depot. Each Ant constructs a route for vehicles that will serve the clients starting from the depot and returning to the same depot. The principle of the routing algorithm is described below, see Algorithm 1.

21:
R ← R − r s ; 22: end if 23: end while 24: end for 25: return route_map_o f _the_best_ant_solution; The improvements of the solution shown in Algorithm 1 reached in successive iterations. In each iteration all ants in the colony travel between a pair of clients. The probability of an ant to visit an unvisited client is calculated based on the pheromone and the distance and a client will be chosen according to this probability. Then the ant checks if it can visit the given client, i.e., if its current load allows it to add the demand of the client and verify the vehicle's capacity violation. If yes, the ant visits the specified client (adding client's demand and indicating it as selected). Otherwise, the ant ends the current trip with empty load (returning to its colony) and the algorithm restarts a new trip. We apply the following equations for a client i to choose the next client j where p ij is the probability of the point i to choose point j, τ ij is the strength of pheromone trail between point i and j, α is the coefficient that controls the influence of the pheromone trail τ ij , β is the coefficient that controls the influence of the visibility η ij , and R is a set of clients. At the end of each iteration, the pheromone trail evaporates according to the following equation: where ρ is the coefficient of the pheromone evaporation and the update state is calculated by applying the next equation: where ∆τ ij = best_known_solution best_global_cost (10)

Second VRP Model
VRP of the second model uses a similar algorithm routing and sequencing of the first model. The difference is that each ant in this model tries to reduce the number of vehicles to visit all clients and to add all possible ones whose demand does not exceed the capacity of the current vehicle. The algorithm of the second model is formulated as follows, see Algorithm 2. while R = ∅ do 9: while C = ∅ do 10: for (r j ∈ C) do 11: p ij ← probability_o f _point i _to_choose_point j ; 12: end for 13: r s ← r j _with_highest_p ij ; 14: C ← C − r s ; 15: Q(k) ← Q(k) + demand(r s ); 16: if Q(k) < capacity_o f _vehicle then 17: route_map ← route_map + r s

18:
i ← r s

19:
R ← R − r s ; 20: end if 21: end while 22: k ← k + 1; 23: Q(k) ← 0; 24: route_map ← route_map + r 0 ; 25: i ← r 0 ; 26: end while 27: end for 28: return route_map_o f _the_best_ant_solution; In Algorithm 2, the ant checks if its current load allows it to add the demand of the chosen client and verifies the vehicle's capacity violation. If yes, the ant visits the specified client (adding client's demand and indicating it as selected). Otherwise, the ant selects another unvisited node according to the calculated probability. When all clients have been visited, the ant ends the current trip with empty load (returning to its colony) and the algorithm begins a new trip. We improve the solution by local search and we use a two-opt local search algorithm in the end of both Algorithms 1 and 2.

Structuring VRP Multi-Model
In order to co-simulate the multi-model of VRP, we use MECSYCO, which allows to lunch of several VRP models. In this approach, we focus on the reuse of atomic VRP models defined in Section 3.1 and making them interact. Figure 2 shows an overview on the model coupling of M 1 and M 2 . As VRP models are created separately, each model has its own description and proceeds its own execution. It should couple these VRP models to reconstruct the entire multi-model using the co-simulation of MECSYCO. To this end, we define the connections between both models by specifying the input and output ports.

Exchanging Data between Simulators: Input and Output Connections
To predict the impact of co-simulation of VRP multi-model, we show the first model M 1 which represents the solution of VRP using Algorithm 1, where the objective is to minimize the total traveled distance. The second model M 2 implements Algorithm 2 that tries to minimize the total number of vehicles used to solve the same VRP. The aim in this case is to reproduce the VRP multi-model as a society of interacting and co-evolving models. We have to couple the two aforesaid models M 1 and M 2 using the concepts of Agent and Artifacts that are presented in Section 1. To couple M 1 and M 2 we need to define the input and output ports of each model and the connections between them.
The solution is improved by successive iterations where every model, i.e., M 1 or M 2 , shares the improved solution with the other. M 1 and M 2 read the input and try to improve their solution as illustrated in Figure 3.   Specifically, when the model M 1 finds new best solution in a given iteration, it sends the following inputs to the model M 2

1.
Ed: Set of edges belonging to the best solution (for each one of these edges the model M 1 sends a pair of nodes delimiting this edge).  Figure 4 show more details on the behavior of models in interaction.

Interchanging Models
When executing two similar models of VRP, they give two different solutions in each iteration. Instead of coupling two different VRP models, we can simply integrate two similar models M 1 or two similar models M 2 . Here, we keep the same input and output connections as defined in the previous section. So, if one model has a good solution, it sends it to the second model and reciprocally. Specifically, when we couple two same models M 1 , they will have different solutions in each iteration, and the first one have better solution, send the following inputs to the second model M 1 :

1.
Ed: Set of edges belonging to the best solution. This may impact on the solution of each model and redirect it to the best solution by reinforcing the pheromone of edges that have a good solution in each model. Moreover, we can study the evolution of the computational time when proceeding the co-simulation of VRP models, thereby the co-simulation of VRP models for finding a good solution.  Thus, we interchange models to compare different executions and study the accuracy of the best multi model. Figure 5 shows the VRP models' interaction graph. By using MECSYCO we may launch more than one model of VRP at the same time following the routing algorithm defined in Section 2. The execution gives two different solutions that are improved in each iteration. The whole architecture of the multi-model is modular, transparent and parallel so the simulation can be viewed as a set of distributed and reusable components such that: • The modeling is performed by model artifact.
• Conducting the models is accomplished by the model-agents.
• The coordination process is carried out by the coupling-artifacts. As a result, we easily can add, remove or interchange models without being interested with coupling and coordination issues.

Implementation and Results
The VRP models are implemented using Netlogo [28] which is an environment designed for modeling and simulating the natural and social experiences. We use MECSYCO to perform the co-simulation of the VRP models based on the following parameters of hardware: • Memory: 7.7 GB; • CPU: Intel® Core™ i5-8250U CPU @ 1.60GHz × 8; • Graphic Card: Intel® UHD Graphics 620 (Kabylake GT2); • Operating System: ubunto 16.04 LTS 64 bits; • Disk: 964 GB.
In the analysis, we study the behavior and the experiment results of VRP models on several VRP instances from [29] and then we evaluate the improvement carried out by the co-simulation of the VRP multi-model in term of quality of obtained results and computational time.

Implementing VRP Models
In the definition and implementation of the VRP graphs using Netlogo, we use the turtles agent to represent nodes with their turtle variables. The coordinate of each client and the links agent are used to define the edge between two nodes. We use the link variables for determining for each edge the link cost of these two nodes and the value of pheromone trail. Table 1 represents the result obtained by executing single model VRP: model M 1 with BKS is the best-known solutions which were given by [29], Perc-Dev is the percentage deviation of the result reached by the model M 1 and Processing time (s) is the processing time for the execution of the model M 1 .  Table 2 represents the result obtained by executing single model VRP, i.e., model M 2 . Both models M 1 and M 2 are based on an ant colony system in their implementation, and they can interchange the following data: the cost of solution is calculated by the total traveled distance, edges belonging in the best solution found and the values of pheromone trail of these edges.
Other data can be exchanged between these models such as the route of the best solution or the route of each vehicle, etc. However, we skip these exchanged data to avoid more machine resources occupation because we must reserve more memory space to store the solution (routes) which takes a considerable time during the exchange.

Co-Simulation of VRP Multi-Model
In this section, we run different forms of combined models and perceive the improvement provided by their co-simulation. In order to develop interactive VRP multi-models, we use MECSYCO which offers multiple integrating VRP models by defining the input and output port of coupling artefact. VRP instances [29] are a set of 100 instances created to offer a more universal and stable experimental setting.
Experiments were carried out in order to analyze the performance of the proposed VRP multi-model. The main objective is to assess whether the co-simulation has a direct impact on the qualitative performance of the obtained results. In this context, three composition are proposed for the interaction between the VRP multi-model used in the experiments: Perc-Dev A is the percentage deviation after co-simulation for two models in interaction; • Processing time B (s) is the processing time in second for just one model before co-simulation; • Processing time A (ms) is the processing time in milliseconds after co-simulation for two models in interaction. Table 3 presents the co-simulation results of model M 1 with M 1 which demonstrate enhanced performance of the found solution in terms of percentage deviation and processing time compared with the execution of single model M 1 . Table 3. The obtained co-simulation result of models M 1 with M 1 .

Inst. Per-Dev B % Per-Dev A % Processing Time B (s) Processing Time A (ms)
A-n32-k5  Table 4 shows the result of the combination of the two same models M 2 with M 2 . We perceive that there is an improvement in the found solution compared with one model M 2 in both the solution cost and the time of processing.  Table 5 shows the obtained results of integrating two different models M 1 with M 2 . We observe that there is an improvement in the found solution compared with the result of a single model M 1 or M 2 in terms of solution and time of processing.  7 show the co-simulation processing time when coupling the same or different models. We conclude that the co-simulation of models is faster than the unique model M 1 or M 2 . On the other hand, during data exchange between models we proceed to post and read best solutions for each interacting model. Instead of sending the best solution as a sequence of routes, we choose to send it as separate edges with their pheromone trail. After the execution, we observe that this action has a significant impact on the behavior of the model in constructing its solution and the model builds better solutions quickly. In addition, it does not spend a lot of time interchanging data and occupies a reasonable memory size to store the best solution.

Discussion
We conducted several experiments in a single VRP model and multiple VRP models in interaction, Single VRP models implementing different algorithms of ACO metaheuristics gave close to optimal solutions; the VRP multi-model improved these results compared with single ones. We coupled • Two different models M1 and M2; • Two same models M1 with M1; • Two same M2 with M2.
Always the result of coupled models was the best according to single model M1 or single model M2. It was especially time consuming. Figure 8 displays the co-simulation processing time of the three coupled systems and shows that the coupled system using two same models M 1 has the best result.
Co-simulation enables the integration of heterogeneous models/simulators homogeneously, in the future we can implement other types of metaheuristic and define the appropriate interchanging data between them, in order to study the amelioration of results in each different case.

Conclusions
This paper discusses the integration of VRP simulators created in Netlogo platform into MECSYCO co-simulation middleware. The proposed VRP multi-models in interaction implement ant colony meta-heuristic for solving two different objectives. The obtained results show the efficiency of better solution finding of VRP multi-models compared with single VRP models in terms of processing time and travel distance. We conclude that the type of data exchanged between models gives more qualitative performance to the solution short execution time to solve the problem.
In the future, we will evaluate the proposed approach by introducing other variants of VRP such as the Multi Depot Vehicle Routing Problem (MDVRP) and the Vehicle Routing Problem with Time Window (VRPTW). Moreover, the atomic VRP models can be implemented using other types of meta-heuristics and the combination of these models can be performed by defining other input and output connections.