## 4 Optimization Process  
As previously stated, the optimization process is based on dynamic graphs modeling the reference platform and agents representing the embarked contingent. Once an agent is relocated, the resulting graph will show a different state and, therefore, it will be necessary to recalculate the state of the graph and the costs associated with each of its vertices. Thus, the cost of a vertex will depend on the structure of the graph and its state, represented by the location of the remaining agents.  
Following the description above, the simulation engine attempts to move agents through the optimal routes identified, which are those that entail the lowest estimated cost. This evacuates each agent in the shortest possible time, minimizing the evacuation reference time or time recorded by the last evacuated agent, that is, the one who recorded the longest evacuation time.  
Algorithm 1 shows the pseudocode of the recursive method estimating the cost of the different nodes of the graph representing the structure of the ship. Each node can host an indefinite number of crew members at a particular node during evacuation. As can be seen, the objective of the algorithm is to calculate the cost of all possible routes recursively. First, for each node of the graph, the cost of moving the agents through that node is accumulated. Next, if the node's estimated cost for that route is lower than the available cost, it will be used as a reference. Finally, this cost is added to each of the nodes to which the reference node is linked, and the cost estimation function is recursively called.  
```
1 estimateGraphCostTravel(\(graph.node.edge.next\), \(accumulatedCost\))
2 ifnotEndOfGraphthen
3 ifgraph.node.NotEmptythen
4 /* Accumulates estimated cost of moving these members through the node */ \(accumulatedCost\leftarrow accumulatedCost+graph.node.crewMembers\times graph.node.cost\)
5 end if
6 ifaccumulatedCost\(<graph.node.cost\)then
7 /* In the event that the estimated cost of the node for this route is lower than the available one, this cost will be designated as reference */ \(graph.node.cost=accumulatedCost\)
8
9 end if
10 foreachgraph.node.edgedo
11 /* Adds the cost of the link accumulated to the estimated cost of the node */ \(accumulatedCost=graph.node.cost+graph.node.edge.cost\)
12 /* The function is called recursively indicating the node of the next link and the estimated cost so far */ estimateGraphCostTravel(\(graph.node.edge.next\), \(accumulatedCost\))
13 end if
14
15 end for
```  
**Algorithm 1**Estimation of the cost of the graph nodes representing the ship.  
The MaritimeEXODUS application initially solves the problems and lack of suitability of the proposed LP model. However, this simulator does not have the capacity to set the minimum time employed in the evacuation process as an objective function. Therefore, to address the optimal cost function that best suits an agent continuously supported when choosing one route or another, the shortest travel time to the agent's lifeboat should be considered, not the shortest distance. SIMONE does this. Moreover, SIMONE not only recommends the displacement of an agent following the quickest route but its estimated cost computation includes the agent's waiting times identified along a route. The estimated cost makes it possible to anticipate congestion, thus avoiding deadlock situations caused by a number of agents competing for the same resource.