Exact Algorithms for Practical Instances of the Railcar Loading Problem at Marine Container Terminals

With the growth in global trade and its environmental footprint, sustainable modes of freight movement are increasingly important in today’s globalized world. This study focuses on on-dock rail, where the rail terminal is located within the marine container terminal. On-dock rail has in recent years become an essential mode of transportation to move containers out of congested marine container terminals. This study contributes to the literature by presenting tailored exact solution algorithms for a recently proposed optimization model to optimize the loading of double-stack trains. In particular, a 3-stage solution framework is presented for the case when rail cars have a single well. A complementary solution algorithm for the case when a rail car has multiple wells is also provided. Our results show that computational times can be drastically reduced, from 2+ hours to a matter of seconds, rendering the model suitable for practical use.


Introduction
According to the UN Conference on Trade and Development (UNCTAD), over 80 percent of global merchandise trade by volume and more than 70 percent by value are transported using the maritime mode of transportation. To manage this (growing) trade volume, there is a critical need to effectively manage the maritime transportation system, including the rapidly growing containerized trade. is has in recent years led to numerous advances in improved ocean container shipping management strategies (e.g., see [1][2][3]).
Rail, especially on-dock rail-where the rail terminal is located within the marine container terminal-is increasingly being recognized as a sustainable and necessary mode of transportation to move containers in and out of congested marine container terminals.
is trend fits within the broader call in the maritime industry to reduce ocean shipping's carbon footprint [4]. In response to this call, maritime researchers have examined a range of alternatives, from the use of alternative fuels, to the setting of emission standards, speed optimization, and the use of shore power (e.g., see [5][6][7]).
To maximize rail's capacity, it is critical to build trains that are fully utilized when leaving the marine container terminal. Our focus in this study was on double-stack trains. For single-stack trains-that are subject to very different loading constraints-the reader is referred to the literature (e.g., see [8]). A limited number of studies have appeared in the literature that examined the problem of loading doublestack trains, with each study valid under its own set of assumptions appropriate for the geography and operating environment. To the best of our knowledge, Pacanovsky et al. [9] was the first research appearing in the literature discussing the problem of loading double-stack trains. In their work, an inland rail yard was considered where containers arrive continuously and a location on a double-stack train needs to be assigned immediately upon arrival. A heuristic was used to assign the containers. Lai et al. [10] presented an optimization model to optimize the aerodynamics of intermodal freight trains carrying both containers and trailers. It was noted that despite commercial decision support software being available, deciding where to place containers on (double-stack) trains was still "a largely manual process" in practice. Lang et al. [11] examined the loading of double-stack trains in China. While one of their goals was to maximize rail car maximization, their key focus appears to be on keeping the vertical center of gravity low. It is interesting to note that their loading constraints are very different from the model considered in this study. is is most likely due to the different equipment designs in China. For instance, they reported the possibility of loading two 20′ containers on top of two other 20′ containers, which is not common practice in the United States. Upadhyay et al. [12] presented a model for double-stack train loading tailored to the practice in India. As Lang et al. [11], they reported the possibility of loading two 20′ containers on top of two other 20′ containers. In addition to this key difference, Upadhyay et al. [12] also considered other constraints and practices in India that are uncommon in the United States. Most recently, Ng and Talley [13] presented an integer optimization model to load double-stack trains at marine container terminals. Unlike other models discussed above, Ng and Talley's model is tailored to the practice at U.S. container ports. e above-related works are summarized in Table 1, in terms of two key variables: the country for which the model was developed and whether the model has been developed for marine container terminals. e current research is inspired by Ng and Talley [13]. e main focus in Ng and Talley [13] was on presenting a model that captured real-world operating practice. (Before proceeding, it is recommended that the reader reviews the model by Ng and Talley [13], which is summarized in Appendix A. For a more detailed discussion, the reader is referred to the original work.) e resulting model was solved for small problem instances with an off-the-shelf commercial solver. When the number of containers and rail cars is more realistic, i.e., larger, it becomes computationally prohibitive when using off-the-shelf solvers. (As we shall demonstrate in Section 5, it can take more than 2 days to find an optimal loading plan for practical instances of the problem, when using off-the-shelf solvers.) Marine container terminals need answers quickly for the model to be useful in practice. In this study, we exploit the problem structure to develop tailored solution methods for the rail loading problem. As shall be demonstrated, computational times will be drastically reduced, making the model suitable for practical use. e remainder of this study is organized as follows. In Section 2, a tailored, three-stage solution method is provided to solve the optimization model. Section 3 considers an extension of the model in which rail cars can have multiple wells. A new solution framework is provided for this case. Section 4 illustrates the proposed methods with detailed computational results. Section 5 concludes the study.

Three-Stage Solution Approach for Single-Well Rail Cars
To solve model (P) in Appendix A, a tailored 3-stage solution approach is proposed in this section. e reader is advised to study the model formulation and its notation in Appendix A first before proceeding. e proposed method decomposes the problem into three stages. e first two stages determine an effective lower bound, while the final stage calculates a sharp upper bound for the objective function in model (P).

e First Stage.
Note that the utilization of a rail car can be either 100%, 50%, or 0%. In the first stage, we try to maximize the number of 100% utilization cars. To this end, the following procedure is followed: (1) e objective function is changed to Max Z 1 � j k y jk1 in model (P). Furthermore, an additional constraint 1/2( i∈I h x ik + m∈M h v mk ) + j∈J h y jk2 � j∈J h y jk1 , ∀k ∈ K, is added to ensure that there must be an upper-level container if the lower level is loaded with containers. is constraint forces the rail cars to be loaded to 100% utilization.
(2) If the number of 100% utilization cars (say Q) is equal to the number of available cars, i.e., Q � |K|, then the optimal solution is 100%. (3) On the other hand, if Q < |K|, then there is at least one rail car that cannot be loaded to 100% utilization. In this case, the containers that have not been assigned a rail car will be transferred to the next stage.
In other words, the first stage solves the following program P1: (1) As this formulation only finds 100% utilization cars, the solution space is small. As will be shown in the numerical experiment in Section 4, this formulation (or more accurately, its linearized version) can be solved efficiently using commercial optimization packages (i.e., CPLEX).

e Second Stage.
When Q < |K|, the solution method enters the second stage. In this case, there must be at least one rail car that cannot be loaded to 100% utilization. In this second stage, we then try to maximize the number of 50% utilization cars.
In this stage, the containers that have been assigned to the rail cars and the rail cars loaded with 100% utilization in the first stage are no longer considered. e interest in the Table 1: Summary of key studies of double-stack rail optimization.

Study
Country Maritime Pacanovsky et al. [9] United States No Lai et al. [10] United States No Lang et al. [11] China No Upadhyay et al. [12] India No Ng and Talley [13] United States Yes 2 Journal of Advanced Transportation second stage is only in the remaining containers and rail cars that have not been assigned/loaded. It is to be noted that in the second stage no rail cars will achieve 100% utilization. at is, we can discard constraints (A.8) and (A.12). Also, we eliminate constraint (2) from the first stage because the remaining containers will be loaded on the cars with a maximum utilization of 50% only and we cannot force the car's utilization to 100%.
As the first stage, this second-stage problem can be efficiently solved using CPLEX. Proposition 1 now is as follows.
Proof. Since the first stage identifies 100% utilization cars and the second stage the 50% utilization rail cars, the first two stages together provide a feasible solution to the original problem. Q.E.D.
Because of the sequential nature of the first two stages, the loading plan thus far is generally suboptimal. To improve on the utilization, a third stage is introduced. In the third stage, we first derive an upper bound on the utilization. After that, we solve the original formulation considering all containers and rail cars with an additional constraint that bounds the value of objective function. Before presenting the details, we introduce the following notation.
(i) Z: the sum of the objective values from the first two stages of the solution method, i.e., Z � Z 1 + Z 2 . (ii) a h : the numbers of 20′ laden containers destined for hub h that are not loaded in the first two stages. (iii) b h : the numbers of 20′ empty containers destined for hub h that are not loaded in the first two stages. (iv) c h : the numbers of 40′ containers destined for hub h that are not loaded in the first two stages. (v) n: the number of remaining rail cars that are not loaded with any containers after the first two stages. (vi) a: a � h∈H a h /2 , which represents the maximum possible number of 50% utilization cars for the remaining 20′ laden containers a h . Recall that |K| denotes the number of rail cars that can be loaded. e following result can then be derived.
Proof. Using the above notation, note that at most m � min a + b + c, n { } additional rail cars can be loaded with containers after the first two stages of the solution method, each with 50% utilization. erefore, it follows that Z � Z +(m × 0.5/|K|) is an upper bound. Q.E.D.
Based on the upper and lower bounds in propositions 1 and 2, we can introduce the following constraint to the model (P): (4) en, we solve the following formulation P3 in this third stage with all the original containers and rail cars as input: As will be demonstrated in our numerical experiments, constraint (6) is critical in finding optimal solutions with limited computational effort.

Case of N-Well Rail Cars
Model (P) assumes that rail cars have a single well. While this is a possible scenario, what is more common in practice is to have rail cars that consist of multiple wells N, with the most common case being N � 5 (TTX, 2020) (https://www.ttx.com/ about/equipment/). Figure 2 shows a 5-well rail car. In this case, the 3-stage framework no longer applies as it was tailored to the single-well case. In this section, a new solution technique is developed for the case of N-well rail cars, where N > 1.
To ensure that all well cars that are part of the rail car are dispatched toward the same hub, an additional constraint is Journal of Advanced Transportation 3 introduced. In particular, for an N-well rail car (N > 1), this additional constraint is as follows: For example, suppose N � 5, then constraint becomes 5m+5 i�5m+1 u h i � 5u h 5m+1 . Note that m indexes the number of N-well rail cars. For example, if there are three N-well rail cars, then the index m takes on the values 0, 1, and 2.
Unfortunately, including constraint (7) does not allow the resulting optimization problem to be solved efficiently. To alleviate this, we derive an upper bound (UB) on the utilization as follows. In Section 4, we will demonstrate that the UB derived is very sharp and can significantly reduce the computational efforts required to solve the formulation. Recall from Section 2 that a h , b h , and c h represent the number of 20′ laden, 20′ empty, and 40′ containers to hub h, respectively. Further, let F h and H h be the minimum numbers of fully loaded (i.e., 100% utilization) and halfloaded (i.e., 50% utilization) rail cars for hub h, respectively. en, the following three steps can be used to calculate the UB on the utilization when constraint (7) is present.
Step 1. (estimate the minimum number of cars required).
In the first step, we ignore the weight limit and attempt to load all containers with the minimum number of cars. In particular, we create groups for each two randomly selected 20′ laden containers and groups for each two randomly selected 20′ empty containers. As the 20′ containers can only be placed in the lower level, we load these groups to the cars first. erefore, the minimum number of cars required to load the 20′ containers can be estimated as a i /2 + b i /2 , as the weight limit is not considered in this step. en, we try to load the 40′ containers on top of the groups of 20′ containers without considering the weight limit. Two scenarios are possible.
Because the number of 20′ containers required to load the cars with only 20′ laden and empty containers ( a i /2 + b i /2 ) is greater than the number of 40′ containers (c h ), in this case, the number of cars that can be fully loaded F h is equal to the number of 40′ containers c h . e remainder of the cars can only be half-loaded, and the number of this type of cars    I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I   : ~ ______ .______  I :   I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I   I  I  I I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  I  Step 2. (bounding the number of N-well cars). In this step, we bound the number of N-well cars and subsequently determine how to distribute the single-well cars to these N-well cars.
(i) Let B be the number of N-well cars (N > 1) and S be the number of remaining unloaded single-well cars.
where K represents the number of total single-well cars. If a single-well car is with 100% utilization, we choose to load it first to the N-well car. Let M h be the number of fully loaded N-well cars for hub h and U h,i be the utilization rate according to different loading approach i for partially loaded N-well cars for hub h. e following procedure estimates the number of N-well cars. If F h ≥ N and B > 0, we want to know how many fully loaded cars can be sent for each hub h. In this case, for each hub, we want to know how many fully loaded cars can be sent. Let M h � min (F h /N), (K/N) , and we can update Since F h is the remaining full car and H h is the remaining half-loaded car to hub h, we can update U hi as follows: . e terms S × 1, N × h M h , and N × n N n are the utilization contribution of single cars, the utilization contribution of fully loaded N-well cars, and the utilization contribution of partially loaded N-well cars, respectively.
Otherwise, if the number of fully loaded cars is less than the number of single cars that need to be assigned and N × n N n are the utilization contributions of 100% utilization single car, 50% utilization single car, fully loaded Nwell car, and partially loaded N-well car, respectively.
To summarize, when N-well rail cars are present (with N > 1), the following optimization problem is solved: (7) and

Single-Well Rail Cars.
To validate the proposed solution approach, we generated weights for the containers and weight limits of the rail cars according to real-world empirical distributions. (For a more detailed discussion of the weight data, see [13].) e cargo weight and car weight limit are between 10,000 and 100,000 and 140,000-180,000, respectively. e tolerance factor of a rail car is set to 1 in all cases (cf. Appendix A). e proposed 3-stage solution approach was implemented in the C# programming language. e numerical experiments were conducted on a Windowsbased machine with an Intel 3.40 GHz CPU and 16 GB of memory. Table 2 lists representative results for the 3-stage solution approach for 8 different instances of the problem. e CPLEX column shows the objective values found by CPLEX and the CPU time used when CPLEX is used to solve the problem instance. (All optimization problems are linearized first using the same techniques as in Ng and Talley [13] before CPLEX is applied.) For example, in Instance 1 the optimal utilization is 60%, and it took over 2562 seconds (42.7 minutes) to find this solution. is would make this "brute force" approach unacceptably slow for practical purpose.
When using the proposed 3-stage solution approach, the computation time can be drastically reduced. (Each of the stages is solved using CPLEX, applied to the respective linearized problems.) For example, for Instance 1, the column "Stage 1" shows the solution found after the first stage of the solution approach: a utilization of 50% (i.e., an Journal of Advanced Transportation optimality gap of 16.67% compared with the optimal utilization of 60%).
is required just 0.039 seconds, i.e., a reduction of essentially 100%. To further improve this solution, the column "Stage 2" shows the solution after the second stage. As can be seen, the utilization has improved to 60% (recall that this is the optimal solution). e second stage took 0.182 seconds to find, which is a 99.99% reduction compared with the CPLEX column. While in this specific instance, the optimal solution was found after 2 stages, sometimes stage 3 is required (see column "Stage 3"), as was the case in Instance 3 in Table 2. In Instance 3, the utilization improved from 0.5 to 0.6 to 0.617, which is the optimal solution.
It is interesting to note that for 5 of 8 problem instances (instances 2, 4, 5, 7, and 8), CPLEX failed to find the optimal solution after 2 hours (172,800 seconds), which is the maximum computational time that was allotted to each instance. (In these instances, no objective values have been reported in Table 2.) On the other hand, our 3-stage solution approach was able to solve each of the instances to optimality within seconds.

N-Well Rail Cars.
Since N � 5 is the most common in practice, we will present empirical results for this case in this section. e same problem data as for the single-well experiment in the previous section have been used. e results are summarized in Table 3. Note that we have repeated the optimal utilization from the single-well model for comparison purpose.
ere are a number of interesting findings. First, compared to the single-well case, the 5-well rail car model can

Concluding Remarks
On-dock rail has become an essential and sustainable mode of transportation to move containers out of congested marine container terminals. To help marine container terminals maximize rail's capacity in practice, it is critical to have both models and solution methods that are practice-ready. is study contributed to the latter. Using a recently introduced rail capacity maximization model, we demonstrated that-when using a commercial off-the-shelf solver-the computational times for realistic problem instances are prohibitively long for the model to be practically useful. To address this issue, new and tailored exact solution methods were developed in this research. Particularly, a 3stage solution framework has been proposed for the case when rail cars have a single well. To complement this case, a solution method for the case when a rail car has multiple wells has also been provided. In the computational study, our results show that computational times can be dramatically reduced from 2+ hours to a matter of seconds, rendering the model suitable for practical use. ere are at least three possible future research directions. First, while the model captures the most salient features observed in practice, it is possible to further extend the model to incorporate less common container types, most notably tank and hazardous cargo containers. Second, stochasticity during the planning and operation (i.e., random disruption or stochastic demand arrival) can also be incorporated. However, this might increase the computation times, which brings us to the last future research direction.
ird, while our solution approach is highly efficient, it might be interesting to explore other solution methods, especially when considering different model extensions. For example, evolutionary algorithms have generally shown to be effective in addressing large-scale real-world problems; e.g., see Zhao and Zhang [14,15]. x ik Equals 1 if laden 20′ container i ∈ I h is loaded on (the bottom of ) rail car k ∈ K, 0 otherwise. v mk Equals 1 if empty 20′container m ∈ M h is loaded on (the bottom of ) rail car k ∈ K, 0 otherwise. y jkl Equals 1 if 40′ container j ∈ J h is loaded in position l ∈ L on rail car k ∈ K, 0 otherwise. z k Equals 1 if there is at least one laden 20′ container loaded on rail car k ∈ K, 0 otherwise. τ k Equals 1 if there is at least one empty 20′ container loaded on rail car k ∈ K, 0 otherwise. e objective function (A.1) seeks to maximize the utilization of the rail cars. Constraint (A.2) ensures that when rail car k is assigned hub h, one can either load two laden 20′containers on the rail car, or none. Constraint (A.3) states that each laden 20′ container can be loaded on 1 rail car only. Constraints (A.4) and (A.5) are the parallels of constraints (A.2) and (A.3) for empty 20′ containers, whereas constraint (A.6) prohibits the mixing of empties and laden 20′ containers on a rail car. Constraint (A.7) guarantees that each 40′ container is assigned to at most one location on the rail cars. Constraint (A.8) states that only when rail car k is assigned hub h, one can load a 40′ container (i.e., destined for hub h) to the top position on the rail car. Similarly, at most one 40′ container (i.e., destined for hub h) can be loaded at the bottom of rail car k, if the rail car is destined for hub h and no 20′ containers are loaded on the rail car, cf. constraints (A.9) and (A.10). In (A.11), the weight capacity restrictions of the rail cars are stated. Constraint (A.12) ensures that the top container is lighter than the bottom container(s) within a tolerance factor of c k . For instance, when c k � 1.1, this indicates that the weight of the container on the top on rail car k is at most 10% higher than the weight of the bottom container(s). Constraint (A.13) ensures that each rail car is assigned a hub. Finally, constraints (A.14) to (A.19) state the binary nature of the decision variables. For a more detailed discussion of this model, the reader is referred to Ng and Talley [13].
Data Availability e data used in the current research is from the port authority we worked with. Due to the non-disclosure agreement, we cannot reveal all the details. However, we would be happy to provide the details to reviewers for review purpose. Disclosure e contents of the article remain the sole responsibility of the authors.

Conflicts of Interest
e authors declare that they have no conflicts of interest.