## 1 Introduction
### Related Works  
When the ship comes to the port, initially the containers destined for the port are unloaded, and then a set of containers at the yard is retrieved from the stacks and loaded into the vessel through quay crane operations. These retrievals from the yard stacks constitute a combinatorial problem [10]. The quay crane operation also must attend to some specific operational constraints, such as quay crane non-crossing, non-overtaking, and safety distance constraints [11]. These approaches consider each problem separately. More recently, many models integrated some of these problems. For example, the operation of a yard crane, the scheduling of yard vehicles, and loading operations executed by a quay crane are modeled jointly in [12; 13; 14]. In [15; 16], the issue of yard location assignment problems is integrated with the interaction of a yard transport vehicle, while ref. [17] integrated the yard location assignment with the dispatching of yard crane units. Ref. [18] jointly treated the quay crane assignment problem with the problem of storage space assignment. In [19], the problem of the yard transport vehicle routing was integrated with quay crane and yard crane operations. Facing similar problems, ref. [20] integrated two different railroad container terminals problems and emphasized the positive impact of establishing decision support tools for solving interdependent problems in an integrated manner. Simulation-based approaches were also present in [21] to solve the problem of railway traffic flow. In the ship, the container assignment must take into account the locations for specific container types and other requirements such as vessel stability, height, and weight limits. The position of the container on the stacks must also consider its destination to avoid reshuffle operations in future ports. This is also a combinatorial problem, and commonly, a hierarchical approach is used, in which the liner shipper establishes a master plan, also called the master bay planning problem (MBPP), and the port terminal determines a sequence of cargo loading and the cargoes' positions on the ship [22; 23]. There are not many papers that investigate multi-port stowage planning. The first model was proposed in [24], and after that, several papers were presented [3; 5; 25; 26; 27; 28; 29; 30]. The methods adopted by these papers can be grouped into three classes: (1) a single mathematical model, (2) hierarchical planning, and (3) heuristic models. In the class of the single mathematical model, multi-port stowage planning is formulated as a unique optimization problem [5; 24]. Although mathematically elegant, these single models use a simplified representation of the ship with a single bay and all containers being the same size, creating difficulty in treating realistic size problems. To overcome these difficulties, there are hierarchical models. They use decomposition in the master planning and container allocation sub-problems [3; 25; 28; 29; 30]. Other models use only heuristics, as in [3; 26; 27]. Some papers, such as [31; 32], have taken into account some characteristics of the containers, such as the dimensions (e.g., standard, 45-footer, high-cube, or oversized), weight class (light, medium, or heavy), type (reefer or open-top), load (dangerous or perishable), and port of destination. Despite that, these papers focus on the export flow at the one-port ship loading problem, ignoring the cargo arrangement in yard stacks. Here, we integrate the entire flow of the containers between the port yards and the ship. Ref. [27] presented two genetic algorithm (GA) approaches to multi-port stowage planning. In the first one, the dimension of the chromosome was equal to the number of cells of the ship. A realistic problem results in a very large vector, which makes the GA search very inefficient. A second representation was proposed called compact encoding, in which only the unloading and loading containers were represented.