Real-Time Batch Optimization for the Stochastic Container Relocation Problem

: The container relocation problem (CRP) is an important factor affecting the operation efficiency of container terminal yards, and it has attracted much attention for decades. The CRP during the pickup operations of import containers is still an intractable problem for two reasons: the first is that the solution efficiency of the algorithms developed in the existing literature cannot meet the real-time operation requirements; the second is that the pre-optimized operation plan cannot cope with the changes in the real-time operation scenarios caused by the uncertainty of the arrival time of external trucks. This paper proposes an optimization method for the real-time operation scenario which aims to solve the most reasonable operation plan quickly according to the arrivals of external trucks, in which a dynamic upper bound of the optimal solution is derived based on the dynamic programming model of the import containers’ CRP, and an approximate optimal solution can be obtained by minimizing this dynamic upper bound. A heuristic algorithm based on three relocation rules is developed to implement this method, considering the adjustment of the pickup sequence of the target containers. Numerical experiments show that (1) when the number of a batch of target containers is less than 10 (excluding target containers that can be directly picked up), the method proposed in this paper can solve the problem quickly to meet the demand of optimizing real-time pickup operations; (2) compared with other outstanding algorithms, the quality of the solutions obtained by this method is also improved; and (3) this method can be applied to the most container terminals for optimizing real-time pickup operations.


Introduction
Generally, in the yard of the container terminal containers are stacked on top of each other in the ground slots, forming stacks.At the same time, a row comprises several stacks placed abreast, constituting a bay, and each yard block is composed of dozens of bays.The containers in a stack adhere to the last-in-first-out (LIFO) principle.If a target container that needs to be retrieved is not the topmost in its stack and is covered by other containers, the blocking containers must be moved to another stack in the same bay first.As a result, the yard crane is required to perform one or more relocation movements.Moving a blocking container, referred to as relocation (rehandling or reshuffling), is an unproductive operation.A high proportion of unproductive operations resulting from container rehandling decreases yard operational efficiency, delays the turnaround time of external trucks, and increases the detention time of vessels.Regarding relocations, three topics have been identified: the re-marshaling problem, the pre-marshaling problem, and the relocation problem.The relocation problem is referred to as the container relocation problem (CRP) or the block relocation problem (BRP) in the literature and is defined as needing to retrieve all the containers (export or import) from a bay in the prescribed order while minimizing the number of rehandles.Despite the fact that CRP has attracted much attention for decades, the CRP during the pickup of import containers is still an intractable problem, which is the focus of this paper.
The difficulty in dealing with the CRP of import containers is not only due to the fact that it is an NP-hard problem [1] but also to the uncertainty of the pickup sequence and the decentralization of the retrieval operations.In response to the first point, the NP-hard nature, it is necessary to find more efficient methods for solving this problem.Various existing models or algorithms are based on the idea of reducing the problem scale to improve the solution efficiency, whether it is to use a solver to solve an integer programming model, to solve based on a tree search algorithm, or to use heuristic methods.However, the CRP aims to find the optimal operation plan for retrieving all the containers in a bay while minimizing the number of relocations during the pickup operations.The computational effort of the solution process increases rapidly as the instance size increases.Many methods do not perform well in solving the CRP, e.g., restricted CRP is still an NP-hard problem, and the B&B algorithm and other variants of the tree search algorithm are not easy to solve medium-sized and large-sized instances quickly.To improve the efficiency of solving the CRP, we need to consider some ways to reduce the problem size further.To be precise, it is difficult to accurately master the retrieval order of containers in advance since the arrival time of trucks is random [2].But, the truck appointment system (TAS), which is implemented in most container terminals, can provide container terminals with more credible retrieval information and help terminals optimize yard operations [3,4].On this basis, the stochastic container relocation problem (SCRP) [5], also called a CRP with time windows [6], has been the focus of research related to the import container relocation problem.In the SCRP, the containers are divided into different batches (groups) according to their appointment departure time window, i.e., a batch of containers indicates a group of containers stacked in the same bay and with the same appointment retrieval time window.Containers are ordered so that all containers in a batch must be retrieved before any containers from a later batch.The pickup order of the containers within the same batch is uncertain.This suggests that their pickup sequence needs to be determined based on the arrival of corresponding external trucks (ETs).
Due to the decentralization of the retrieval operation of import containers, the operation process for retrieving all the import containers in the bay requires multiple independent operation rounds (also referred to as "operation stages" in other studies).The pickup order and operation plan are determined within each operation round based on the ETs' arrival information.Between two neighboring operation rounds, the bay layout at the end of the previous operation round will be the basis for the next round.Therefore, in this paper, we propose a method that gradually optimizes the pickup operations during each operation round instead of optimizing the overall operation process for retrieving all the containers in a bay.In this method, the problem size of the SCRP is significantly reduced.
This method is referred to as Real-time Batch Optimization, which focuses on the realtime operation round (or the current operation round).The "real-time" means that the current operation round is subject to the instant generation of an operation plan based on the arrival of ETs rather than execution based on a predetermined operation plan.The real-time operation scenario has three characteristics: first, a batch of ETs has arrived at the yard; second, a batch of target containers is known, and the number of target containers depends on the arrived ETs; third, the pickup sequence of ETs is adjustable.In the new approach, we first categorize the ETs into batches (groups) based on their reservation information from the TAS and the arrival information from terminal gates.Of course, the retrieval sequence of the ETs belonging to different batches is precise, and the retrieval sequence of the ETs within the same batch is still being determined.Then, based on this grouping, all the arrived ETs within the real-time operation round are defined as a specific batch (group) whose retrieval priories are set to zero, representing the highest pickup priority.Correspondingly, the target containers within the real-time operation round are a batch with a retrieval priority of 0, which may only be part of the containers booked in the current time window.Moreover, their pickup service order of all arrived ETs is adjustable (no longer following the first-come-first-served principle), and the optimal pickup order is determined based on the bay layout to minimize the number of relocations.
The contributions of this paper are as follows: • Based on the dynamic programming (DP) model of the SCRP, we derive a dynamic upper bound of its optimal solution.Thus, we transform the optimization objective into minimizing this dynamic upper bound, significantly reducing the size of the solution process.

•
We propose a new heuristic relocation strategy, namely Least-relocations-and-Lowestprecedence-gap (LL), which learns from the expected relocation index (ERI) heuristic presented by [6] and the expected min-max (EM) heuristic proposed by [5].

•
We introduce two novel relocation rules: moving ahead for a sequential-placed slot (MSS) and freeing up for a sequential-placed slot (FSS).The former rule assigns, as far as possible, a sequential placement for the potential blocking containers in the future in advance.The latter rule tries to find a stack that can free its topmost container to satisfy a sequential placement for the current blocking container.

•
A novel heuristic algorithm, called the sequential-placement first heuristic (SPFH), is devised.It takes advantage of the properties of the two relocation rules mentioned above.
The rest of the paper is structured as follows: In Section 2, we quickly survey the recent literature on the CRP.Section 3 gives a detailed description of the real-time CRP and the formulation of the improved DP model.Section 4 describes the proposed SPFH algorithm in detail.We report the results of our computational experiments with the methods discussed in this paper in Section 5. Finally, Section 6 concludes the study and suggests future research directions.

Literature Review
Two fields have been extensively investigated in the existing literature to reduce relocations during the retrieval process of import containers.In the first field, the objective is to allocate stacking locations for new unloaded containers to reduce relocation moves in the future.Such as, the formulations for evaluating the expected number of rehandles were proposed in [7,8] based on the segregation storage strategies.Other similar studies on generating container storage strategies can be found in [9][10][11].The second field, the container relocation problem, focuses on the relocation movements during the retrieval process and aims to retrieve all containers from a bay based on the prescribed order while minimizing relocations.
The CRP has received much attention from scholars for decades, and extensive studies from multiple perspectives have been conducted [12,13].In order to obtain the optimal solution of CRP, many papers have formulated integer programming (IP) to find the optimal solution [4,[14][15][16][17][18].Because the number of variables and constraints in IP exponentially increases as the size of the problem grows, the IP model cannot be solved for large instances.Another method to obtain the optimal solution of CRP is to utilize the exact algorithms.Many exact algorithms are developed based on tree search procedures, such as tree search algorithms [19,20], (iterative deepening) A* algorithms [21,22], B&B algorithms [18,[23][24][25][26][27][28], and abstract approaches [6].
However, the CRP is an NP-hard problem [29].For larger-scale instances, the exact algorithms or IP models are time-consuming and impractical for real-time operation demands.Therefore, researchers have tackled this challenge from two viewpoints.First, Caserta et al. [29] proposed an assumption that a container can only be relocated if it is blocking the target container.This assumption reduces the number of movable containers during pickup operations, thereby reducing the size of the CRP problem.The CRP under this assumption is referred to as restricted CRP.The restricted CRP has become an important branch of the CRP research field [17,18,20,27,29].Compared to unrestricted CRP, restricted CRP does save a small amount of computational time, but at the cost of losing the quality of the solution.It is worth noting that the restricted CRP is still an NP-hard problem.
Another approach is to utilize the heuristics to solve the CRP model.Researchers have been increasingly exploring heuristic algorithms to overcome the computational complexity of CRP.To date, many outstanding heuristic algorithms have been developed, such as beam search algorithms [25,26,30,31], greedy heuristics [14,[32][33][34], and other heuristics based on relocation rules [5,6,35,36].
Due to the difficulty of obtaining the retrieval time information in advance, many models of CRP were constructed based on assuming that the retrieval processes of import containers conform to some probability distribution [37,38].Moreover, Zehendner et al. [35] proposed the online CRP models where the retrieval orders of the containers are revealed progressively with the arrival of ETs.Similar studies can be found in [6,39].Truck appointment systems (TAS) can help terminals address this issue.The TAS has been deployed in most container terminals, which allows terminal operators to obtain the containers' retrieval time window.Based on the appointment information, Galle et al. [5], Ku and Arthanari [6] introduced a batch model in which the containers within the same appointment time window are considered a batch.Based on the batch model, Galle et al. [5] proposed the stochastic container relocation problem (SCRP) where the retrieval order between different batches is clear but uncertain within the same batch.It means the containers within the same batch have the same retrieval probability.Indeed, the retrieval sequence of the same batch containers is indistinguishable until associated ETs arrive.
For the CRP, relocating operations occur when the container pickup orders do not match their stacking sequence.As a manager, the terminal should not passively deal with the pickup sequence according to the ETs' arrival order but should proactively coordinate the ETs' pickup sequence to conform to the containers' stacking sequence to minimize the number of rehandles [4].Zhao and Goodchild [39] first proposed an embryo of the Batch Optimization method, in which a batch of ETs has arrived, and their pickup service orders are adjustable.Nevertheless, they only apply this method to the first batch to avoid prolonging the other ETs' waiting time.Zeng et al. [3] proposed a rehandling model that considered adjustments to the container pickup order within each group to minimize the number of rehandles.They grouped the ETs according to the appointment time slots in the TAS.Feng et al. [2] proposed a flexible service policy for the SCRP, which assumes all the ETs corresponding to the containers of each batch arrived in advance and dictates the retrieval orders of the current batch's import containers to minimize the number of relocations.
The novelty of this work.A review of the literature indicates that few studies have focused only on optimizing the real-time operation scenario during import container pickup operations rather than the whole retrieval process.Considering the importance of pickup operations' efficiency to the yard's efficiency, it is necessary to find a practical and effective way to solve this problem.This paper attempts to fill this gap by focusing only on the optimization of the real-time operation round for a batch of target containers.Zeng et al. [3] and Feng et al. [2] are closer to the optimization objective of this paper.They assume the simultaneous arrival of ETs within the same reservation time windows and allow the ETs' retrieval sequence to be adjustable, aiming to optimize the pickup operation process for all target containers.However, their approach does not really reduce the problem size, and it is still difficult to solve the larger instances.In this paper, we only optimize one operation round, a part of the whole retrieval process of import containers, i.e., the real-time operation round, which effectively reduces the scale of the solution process, which allows for the adjustment of the pickup sequence and iterates all the available pickup sequences and effectively improves the solution quality.

Problem Description and Formulation
Considering the CRP from a practical viewpoint, instead of passively formulating an optimization plan based on the reservation information from TAS or the assumed probability distribution of ETs' arrivals, we should strengthen the terminal's management of the real-time operation process.In this paper, we optimize the overall pickup operations of the target containers according to the actual arrivals of the ETs (affected by various uncertainties, the ETs may not all arrive according to their booking time), and the pickup orders of ETs is adjustable (which is true in practical operations).Therefore, we iterate over all feasible pickup sequences to find the operation plan with the minimal number of relocations.This section explains the modeling framework of the proposed DSS and the mathematical formulation of the proposed bi-objective optimization model and introduces a comprehensive numerical example.

Problem Description
Due to the limited number of yard cranes, each must move back and forth between different bays rather than being dedicated to a specific unit.So, the state change of a bay and the division of operation rounds during the retrieval process of import containers are shown in Figure 1.As shown in Figure 1a, we define an operation round as the bay is in busy state, whose period that begins when the yard crane moves into the destination bay and ends when the yard crane moves out the destination bay.After an operation round is completed, the bay state turns into idle.Figure 1b tells us that the whole retrieval process of a bay can be divided into three parts-completed operation rounds, the real-time operation round and future operation rounds.The completed operation rounds represent that the retrieval and relocation operations have been finished, which is irreversible.The operations within the real-time operation round are unrelated to the completed operation round but will impact future operations.Consider a bay with N containers piled on W stacks, and the height of each stack cannot exceed H tiers.In the initial state, all the N containers in the bay have been appointed their departure time windows according to the corresponding ETs' reservation arrival period.In turn, they can be classified into G groups based on their respective booking departure times and numbered 1, . . ., G, which implied their retrieval priorities (the smaller group index, the higher retrieval priority).

Idle Busy
Suppose this instance requires K (K ≥ 1) operation rounds to finish retrieving all the N containers.Let S k denote the bay layout after the completion of kth operation round, especially indicating the initial layout when k = 0. Suppose we have completed the first k − 1 operational rounds, then we need to complete the kth operation round.We aim to find an optimized solution a k for the kth operation round that minimizes the number of relocations during the kth operation round.Once the kth operation round finishes, the bay layout will be transformed from S k−1 to S k , which becomes the basis for (k + 1)th operation round.The change in the bay layout between two adjacent operation rounds is described by the following Equation (1).
The a k is a set of operation instructions.If a k includes some relocation operation instructions, some containers will be moved from their stacks into other new stacks.For the restricted CRP, the relocated containers are only the blocking containers above the targets.The relocated containers may contain containers other than the blocking containers above the targets for the unrestricted CRP.However, these movements may result in the addition of the number of blocking containers for the moved-in stacks and impact the (k + 1)th and subsequent operation rounds.Our objective is to minimize the addition of the number of blocking containers in the real-time operation round.
Moreover, during real-time operations, the retrieval sequence of target containers and the movement orders of blocking containers determine the changes in the bay layout, and different bay layouts will produce different increments in the number of blocking containers and other impacts on the subsequent operation process.In the real-time operation round, when multiple target containers need to be picked up, it makes sense to choose a reasonable target container pickup order that can produce fewer relocation operations, even though it may prolong the waiting time of some ETs.Therefore, the method proposed in this paper allows for adjusting the pickup order according to the bay layout, integrating the optimization of the pickup sequence and the reallocations of blocking containers to minimize the increment of the expected number of blocking containers (ENBC).No doubt, the pickup order in practice is likely to be inconsistent with the ETs' arrival sequences, which will result in loading operations being advanced for some ETs and delayed for others.In practice, the number of waiting ETs for retrievals is usually small, and as the number of relocations decreases, the whole operation time decreases, and the delays incurred by individual ETs are acceptable.

Formulation for the Real-Time Scenario of CRP
Learning from [6], we first present a simplified DP model of real-time CRP.Let R(S k ) denote the minimum number of relocations required to remove all the remaining containers based on the layout S k , and let q(a k |S k−1 ) denote the number of realized operations that occur during the kth operation round.The DP model can be formulated as a recursive function as in Equation (2).
Another equivalent form of Equation ( 2) is shown in Equation ( 3) From Equation (3), to obtain the optimal operation plan a k for the kth operation round, the solution process requires simultaneous evaluation of the optimal operation plans from the (k + 1)th operation round to the last operation round.So, solving the total optimization objective R(S 0 ), which is the minimum number of relocations for picking up all containers during the whole retrieval process, is difficult because the complete solving process will generate a large number of redundant computation efforts.Consider it another way, and we can try to find an approximate optimal solution for it.
According to Equation (2), if a * is the theoretically optimal operation plan for the kth round, then we have R(S k−1 ) = q(a * |S k−1 ) + R(S k ).Since solving for the theoretical optimum is difficult, assuming that we obtain an available solution a k for the kth operation round, we can derive an inequality Equation (4).
Without loss of generality, if a 1 , a 2 , . . ., a K are available solutions for each round, respectively, then we must have inequality Equation (5).
In this way, we convert the solving process of Equation ( 3) to summing the number of practical relocations during each operation round.We can ensure an approximate optimal solution if we minimize the number of relocations within each round and the impact on the subsequent operation rounds.
According to the definition, q(a k |S k−1 ) includes two aspects: forced relocations and relocations to free up storage placements.The forced relocations result from blocking the target containers during the real-time operation round.The relocations to free up storage placements result from the containers having nothing to do with the target containers and aim to free up good placements for the blocking containers.In addition, some blocking containers may be relocated twice or more due to all candidate storage positions containing the target containers, but this case is included in the forced relocations.Therefore, we can derive the following inequation as Equation (6).
B k c denotes the blocking containers of the target container c in kth operation round, and U k means the set of relocated containers unrelated to the target containers during the kth operation round.
Let LB(S k ) denote the number of blocking containers in the layout S k , which will require rehandling operations in the remaining rounds.P k indicates the set of target containers in kth operation round.During the kth operation round, each container b ∈ B k c must be moved into other stacks and may become new blocking containers in the move-in stack.Let f (b, s) denote the expected additional number of the blocking containers when the container b is moved into the stack s.Its formula will be given later.Thus, after completing the kth operation round, the number of blocking containers in the layout S k is as Equation (7).
When we have removed all the containers, the last bay layout S K is empty and LB(S K ) = 0.The iterative summation of Equation ( 7) for k from 1 to K yields Equation (8).
The total optimizing objective of this study is min R(S 0 ).It satisfies inequality Equation (9).
It is well known that LB(S 0 ) is the minimal lower bound of R(S 0 ).According to Equation ( 9), we derive an upper bound of R(S 0 ).An approximate optimal solution to the SCRP can be obtained by minimizing the upper bound.Therefore, we concentrate on optimizing the real-time operation process of each round and decrease the computational efforts for assessing the influence of relocating obstructive containers within each operation round on subsequent operation rounds.This method will significantly enhance the solution efficiency of the SCRP and make it suitable for real-time scenarios.

Methodology
According to Equation ( 9), the real-time scenario of the SCRP focuses on two aspects: (1) minimizing the instant relocation number during the real-time operation round; (2) minimizing the incremental number of the blocking containers after each operation round.

Preliminaries
Before describing the implementation of the algorithms in detail, we first define the evaluation method of ENBC and then introduce three heuristic relocation rules.

The Evaluation Method of ENBC
Let p(c) represent the retrieval priority value of container c and p min (s) denote the minimum retrieval priority value of the container set s (if s is a stack number, it represent all the containers in stack s), the smaller value is the the higher priority.Specifically, p min (s) = N + 1 if s is an empty set or stack.Let under(c) denote the containers set within the same stack with container c and below it.
We define three placement state types of containers as follows.The placement state of the container c is to be known as: (1) container means that all other containers placed below have lower retrieval priorities than it.Similarly, an invertedplacement container means that all other containers placed below have higher retrieval priorities than it, i.e., it has a bigger retrieval priority value than the other containers below it.A level-placement container has the same retrieval priority as the highest retrieval priority of the other containers placed below.
Based on their predetermined precedence (e.g., appointment time window), the containers with higher precedence will be retrieved earlier than those with lower precedence during retrievals.Therefore, a sequential-placement container will be picked up earlier than other containers below it without relocation.Conversely, an inverted-placement container must be relocated at least once, as some containers below it will be picked up earlier.We assume the containers with the same retrieval priority have the same retrieval probability.So, a level-placement container causes a relocation when the same retrieval priority container below it is picked up earlier.The blocking containers in a bay layout include the inverted-placement and level-placement containers, and the ENBC is equal to the sum of the number of inverted-placement containers and the expected relocation number of the level-placement containers.The calculation method for the ENBC can be described as Equation (10), which has been investigated in [5].In Equation (10), I(x) is an indicator function that equals one if x is True and zero otherwise, and h(r) indicates the container number within stack r.
There is no increase in the number of blocking containers in a candidate stack when a blocking container becomes a sequential-placement container after being moved into the candidate stack during retrieval.We refer to the candidate stacks for the blocking container that satisfy the above condition as sequential-stack (SS for short).Contrarily, the ENBC of the candidate stack will increase when a blocking container becomes the inverted-placement or level-placement container after being moved into a candidate stack.The candidate stack that satisfies the condition is referred to as inverted-stack (IS for short) or level-stack (LS for short), respectively.The notation f (c, r) has been defined previously, which denotes the increment of ENBC of the stack r after relocating the container c into stack r, and the formula is shown Equation (11).
where m = h(r) ) denotes the number of containers with the same priority as container c in the stack r.

Heuristic Relocation Rules
We introduce three relocation rules in this subsection.The first relocation rule, namely the Least-relocations-and-Lowest-precedence-gap (LL) rule, draws inspiration from relocation rules such as ERI [6], Minmax [29], and EM [5].The other two relocation rules are used to compensate for the deficiencies of the LL rule, including the prospective re-allocations for some non-instant-relocated blocking containers to produce a better layout.

LL Rule
Two conditions construct the LL rule.They are first, selecting the set of stacks that produces the smallest increment of the ENBC after reshuffles, and, second, choosing the move-in stack from the set of stacks obtained in the "first step" with the closest priority value for the blocking container.Equation ( 12) describes the mathematical formula of the LL rule.
s * = arg min s(c) denotes the function to obtain the stack index where the container c is stacked.If f (c, s * ) = 0, it indicates that the topmost slot of stack s * is a sequential stack for blocking container c.Therefore, moving container c to stack s * does not increase the ENBC.If f (c, s * ) ̸ = 0, it indicates that there is no sequential stack for blocking container c to move in.The LL rule provides a method for selecting the move-in stack for container c, which suggests that the stack with the closest precedence to container c is the best choice.This rule has the advantage of keeping the stack with lower priority to provide sequential stacks for subsequent blocking containers as much as possible.Figure 2 illustrates the processing of heuristic rule LL.In Figure 2, we set the priority of the target container to 0 and presented the decision process to relocate the blocking containers by LL.The container priority value marked by the red circle is the current blocking container.Numbers under the layout represent the minimum priority of each assignable stack and the increment of ENBC if the current blocking container is moved into this stack.The blue number marks the optimal selection.The tag "(1, 3)" represents the container placed in the first stack and 3rd tier.The tag "⟨(1, 3), 1, 4⟩" denotes an instruction, meaning the container "(1,3)" will be moved from the first stack into the fourth one.(The symbols illustrated in Figure 2 have the same meaning in the subsequent figures.)The LL rule has two potential areas for improvement.Firstly, it is a greedy approach that always assigns a sequential placement for the relocating container whenever possible, which will likely trap into the local optimum.In other words, reallocating a blocking container with higher retrieval priority to a sequential placement with lower priority may result in losing sequential-placed slots for subsequent relocations.Secondly, when only inverted-placement slots are available for the blocking container, the subsequent blocking containers likely have no more sequential placements to select from, which will directly make additional relocations or result in more potential relocations in the following retrieval processes.The next two relocation rules remedy the deficiencies of the LL rule in the previously mentioned aspects.

Moving Ahead for Sequential Stack (MSS)
Given the blocking container c that is next to be relocated, its optimal reallocation stack s * is determined according to the LL rule.If stack s * is sequential-stack for blocking container c, we try to find another inverted-placement container, which is the topmost item in its stack s (s ̸ = s * ) and denotes as top(s).If stack s * is sequential-stack for container top(s) and moving it into stack s * before container c does not change the sequentialplacement state of container c.We define this method as a relocating policy, known as the Moving-ahead for Sequential Stack (MSS) rule.The MSS rule aims to move a invertedplacement container into a sequential-stack stack in advance and reduce the likelihood of the container top(s) becoming a blocking container again in the subsequent operation process.This rule needs to comply with the following conditions: (1) there are at least two empty slots in stack s * ; (2) the topmost container top(s) in stack s must be in inverted-placement state, i.e., its retrieval priority satisfies the condition p(top(s)) > p min (s); and (3) the retrieval priority of container top(s) must satisfy the condition p(c) < p(top(s)) < p min (s * ), i.e., the stack s * is sequential-stack for containers c and top(s) and the retrieval priority of container top(s) is lower than container c. Figure 3 shows us the processing of the rule MSS.

Freeing up for Sequential Stack (FSS)
For a blocking container c, if only inverted-stack stacks are available, directly moving container c into one of the stacks will add a new blocking container and, in turn, add a relocation during the subsequent retrieval processes.In this case, selecting a suitable stack s and moving its topmost container top(s) to another stack s ′ will free up an sequentialplacement for container c.If stack s ′ is a sequential-stack for container top(s), the total operation cost of the "free up" operations is the same as that of direct moving.As well as it may also increase the possibility of selecting sequential-placement for the subsequent relocations.We refer to the above method as a new relocation policy: freeing up for the sequential stack (FSS) rule.The FSS rule needs to comply with the following conditions: (1) the available reallocation positions for the blocking container c are inverted-placements; (2) if stack s is a candidate sequential-placement for the blocking container c by freeing up the topmost item c ′ , while the retrieval priority value satisfies p(c ′ ) < p(c) < p(under(c ′ )); and (3) the container c ′ will be moved into stack s ′ , which must be the sequential-stack for container c ′ .
We now continue to analyze the instance depicted in Figure 3.In the final configuration, container (1,2) is the current forced relocating item, and two available stacks, the second and fourth stack, are both inverted stacks.Let us move container (4, 1) from the fourth to the second stack and obtain a sequential stack by consuming one practical relocation movement.Furthermore, this reshuffle is cost-effective since it may provide an additional sequential-placement in subsequent processes.Figure 4 illustrates the detailed processing of the FSS rule.

Sequential-Placement First Heuristic (SPFH)
This section presents the SPFH algorithm for the real-time operation round of SCRP.The algorithm structure of SPFH includes two levels.The outer level adopts a policy iteration mechanism, i.e., the set of policies comprising all possible pickup sequences, from which the best operation solution has the least cost; the inner level is the specific process of simulating the operation solution and evaluating the cost for each pickup sequence.
The outer level of SPFH takes two inputs: S 0 denotes the initial configuration of the current operation round of the bay, and P denotes the target container set of the current operation round.In the outer level of SPFH, the procedure, namely AutoRetrieval, is a conventional prioritization mechanism that checks and automatically picks up the target containers if retrievable before the start of each operation round or after each relocation.This mechanism makes the configuration irreducible while freeing up optional slots for other blocking containers.The procedure, namely GenerateSequence, generates all possible pickup orders for the target containers of the current operation round.Then, iterate these orders to obtain the best operation plan for the yard cranes with minimal operation costs.The procedure, namely Simulation-Evaluation, is the inner level of the SPFH algorithm.The pseudo-code of the outer level of SPFH is shown in Algorithm 1, and the pseudocodes of the procedure AutoRetrieval and the procedure GenerateSequence are shown in Algorithm 2.
Algorithm 1 Outer level: the main procedure of SPFH algorithm 1: procedure SPFH(S 0 ,P) q ← select first item from the pickup sequence set Q 9: F cur ←SIMULATION-EVALUATION(q,S cur ,sol cur ) The objective of the inner level of SPFH is to simulate the relocation operation processes and estimate the associated operation costs concerning a given pickup sequence.This procedure involves removing the target containers of the current operation round and moving their blocking containers into the best placements with the least cost (the sum of the number of instant relocation moves and the addition of ENBC).

7:
top 1 [W] ←Get the top target container in each stack of W and remove them from corresponding stack.

8:
Q 1 ←Generate the set of full permutations from each target container in top 1 .9: for all i ∈ [l 1 , len(q 1 )] do 17: q 2 ←Insert t 2 sequentially into q 1 at ith item, and generate a new sequence. 18: top 2 [W] ←Get the top target container in each stack of W and remove them from corresponding stack.

21:
return Q 1 The detailed simulation and evaluation procedure consists of the following steps.Firstly, we apply the LL rule to identify the optimal stack s * , which will minimize the addition of ENBC among all assignable slots to which we can move the blocking container directly.However, the earlier reallocations of the blocking containers occupy reasonable placements and may lead subsequent blocking containers to lose the well-stacking slots.Hence, we will consider the impact of current reallocation decisions on subsequent blocking containers and determine whether there are better solutions than the current selection.Suppose the selected stack s * is a sequential-stack for the current blocking container.In this case, we will check for some inverted-placement containers that satisfy the MSS rule to increase the chances of choosing a well-stacking position for other blocking containers.Similarly, suppose the selected stack s * is a inverted-stack, we will try to find a stack s ′ satisfying the FSS rule that the stack s ′ is a sequential-stack for the current blocking container after moving the topmost container in stack s ′ to another stack.The optimal result is that the non-forced relocating container obtains a new well-stacking placement.Otherwise, relocating the non-forced container will increase the final operational cost in the future.Moreover, when stack s * provides a level-placement for the current relocating container, neither the MSS rule nor the FSS rule is applicable because they may exacerbate the problem.Algorithm 3 presents the pseudo-code for the inner level of SPFH.

2:
P ← q,S cur ← S;   S cur ← S cur ⊕ opr, sol ← sol + opr ▷ ⊕ is an operator that indicates that opr will be executed based on the bay layout S cur and generate a new layout.return ∥opr∥

Computational Experiments
In this section, we present some computational experiments to validate the effectiveness of the LL heuristic and SPFH algorithm for the real-time operations of SCRP.

Implementation Details
Our experiments are implemented by Matlab 2016b and conducted on a PC with an Intel Core I7-9700 K CPU at 3.6 GHz and 16 GB RAM.The program code, results and instances used in this section are available at https://github.com/zhou-sf/rt-scrp(accessed on 16 July 2023).We generate our experiment dataset based on the existing dataset from [5] and complete our experiments from four cases.Each case of the experiments is implemented with 30 instances.
The first two experiments validate the effectiveness and performance of the LL heuristic and SPFH algorithm under small-batch and large-batch instances, respectively.In the case of small-batch instances, the configuration sizes of the instances vary from S = 5, . . ., 10 stacks and T = 3, . . ., 6 tiers and batch sizes of each operation round vary from B = 1, . . ., 4 containers.The configuration sizes of the large-batch instances vary from S = 10, 12 stacks and T = 8, 9, 10 tiers, and batch sizes of each operation round vary from B = 5, . . ., 12 containers.The last experiment illustrates our algorithms' improvement compared to the algorithms proposed in [5,6].

Experiment Results
In this section, we will illustrate the numerical results to verify the validity and feasibility of this paper's methods under small-batch instances and large-batch instances, and also compare it with similar methods from other literature under small-batch instances.

Effectiveness Validation under Small-Batch Instances
A total of 48 configurations, each with 30 instances, are solved using the proposed heuristic LL and algorithm SPFH.Each configuration has S × T × FillRate containers, where S is the number of stacks of the bay, T is the maximum number of tiers in a stack, and the FillRate is the occupancy rate of the slots in the bay.In this experiment, the value of S varies between 5 and 10, and the T varies between 3 and 6.The FillRate is divided into two cases: 50% and 67%.The batch size of each operation round in each instance is random and varies from B = 1, . . ., 4.
Tables 1 and 2 summarize the experiment's results as follows.The rows labeled as "C" indicate the container number of each configuration, and the rows labeled as "Solved" indicates that the number of instances solved optimally is provided in the form x/30.We can find that all 30 instances for each configuration are solved by SPFH and LL in very short time, respectively.The "MaxTime (s)" and "AvgTime (s)" in the two tables refer to the runtime of the most time-consuming instance of each configuration and the average runtime of 30 instances of each configuration, respectively.As the tiers and the fill rates grow, given instances need longer solution time.Most important, the worst case in Table 1 is that an instance with configuration (five stacks and three layers) and with 67% fill rate has four target containers, and it takes about 0.134 s to solve.For these problem sizes, the solution time of most instances is less than 0.02 s.Since many ports today have a maximum tier requirement of four and need fast solutions, SPFH and LL could be used in practices in small-batch cases.(2) Analysis of the results Tables 3 and 4 show us the statistical information of the experimental results of LL and SPFH under 50% and 67% fill rate, respectively.The IB refers to the initial number of blocking containers for each instance.Its value equals the sum of the number of forced relocations and potential relocations of a bay's initial layout, determined by the number of the inverted-placement and level-placement containers.The I eb indicates the average of the increment in the expected number of new additional blocking containers and the number of movements other than the forced relocations during each operation round of a bay.
The IB shows the average value of the initial blocking container number, which is nearly half the sum of the maximum and minimum values of the initial blocking container number for each configuration's instances.Furthermore, the standard deviation of IB, Stdev, increases with the instance configuration's size, which suggests that the number of potential relocations grows as the instance size grows.A similar pattern can be found in the standard deviations of I eb of LL and SPFH.However, the I eb of LL and SPFH exhibit greater randomness, and it is since each instance layout varies greatly and the pickup sequence of target containers is adjustable, the incremental number of potential relocations generated during the practical operations is indeterminate.In addition, the value of I eb in LL differs significantly from that in SPFH, mainly because SPFH introduces two relocation rules MSS and FSS on top of LL, and the two rules avoid many potential relocations caused by container movements.The Act refers to the average value of each instance configuration's actual number of relocations.Its value is statistically derived from the optimized operation plan.According to Equation ( 9), the value of Act theoretically does not exceed the value of (IB + I eb ).However, in Tables 3 and 4, there are cases where the value of Act is greater than the value of (IB + I eb ).This case can happen because some blocking containers caused by level-placement containers produce some realistic relocations.Meanwhile, this case happens more in LL and less in SPFH.The reason for this case is because the LL heuristic, when selecting a position for the blocking container, will prioritize selecting a level stack in the absence of sequential candidate stacks (selecting level stack produces the increment of the expected number of potential blocking container less than selecting inverted stack).Some potential blocking containers may produce realized relocations, so there are more realized relocations than the theoretical optimal operation solution.However, this situation rarely occurs in SPFH because the relocation rule FSS in SPFH always tries to free up a sequential stack for the current blocking container.
As shown in Figure 5, the values of Act in SPFH are better than those of LL, especially at the fill rate of 67%.Intuitively, the SPFH algorithm outperforms the LL heuristic.Still, the relocation rules MSS and FSS, which allow moving other containers unrelated to the target container, may prolong the loading operation of a few ETs during some operation rounds.

Effectiveness Validation under Large-Batch Instances
In this experiment, the configuration sizes of the experimental instances vary from S = 10, 12 stacks and T = 8, . . ., 10 tiers.The batch size varies from B = 5, . . ., 12 and the batch number varies from W = 8, 10.So, each instance configuration has a different file rate.
Table 5 summarizes the validation of the algorithm SPFH and the heuristic LL for the large-size instances in the real-time operation scenarios.The column titled "MT" refers to the runtime of the most time-consuming instance out of 30 instances.The column "AT" refers to the average runtime of 30 instances.The meanings of other variables, namely I, IB, I eb , and Act, are the same as those in the previous tables.The results in Table 5 imply that both algorithms SPFH and LL can solve most instances quickly.However, when the configuration of instances reaches 12 stacks and 10 tiers, if the number of target containers per round is more than 8 (the number of target containers here does not include those can be directly picked up), the solution time of some instances rises rapidly, even more than 2000 s, which means that the algorithms no longer meet the needs of real-time optimization operations.When the number of target containers per round is larger than 10, it is difficult to solve any one instance in a short time.Fortunately, in the actual operation scenario, there are rarely more than ten target containers in most container terminals during a real-time operation round.
The reason for the time-consuming solution process in the large-size batch instances is that the flexible pickup order mechanism requires iterating through all possible target pickup orders during the real-time operation round to explore the optimal operation plan.The number (r) of iterations of the solution process increases rapidly with the number (m) of stacks where the target containers are stacked and the target container number (n), and the value of r is between m! and n!.In fact, if both n and m exceed 8, the method proposed in this paper will have difficulty solving in less than 60 s.Two perspectives can be considered to solve this problem: first, reducing the solution quality, using heuristics for selecting target containers (e.g., always retrieving the target containers with the lowest number of blocking containers) instead of complete iteration to improve the solution efficiency, and, second, dividing the current larger batch into two smaller batches before processing, e.g., the current batch of 10 containers is divided into two small batches of 5 containers.
Under large-batch instances, it is more common for the value of Act to be greater than the theoretical upper bound, (IB + I eb ).The reason for this case has been given in the experiment mentioned above under small-batch instances.Moreover, it can be seen that the discrepancy between the Act and (IB + I eb ) decreases with increasing batch size.

Comparison with Other Algorithms under Small-Batch Instances
In this experiment, we chose [5,6] for comparison, mainly because our experimental dataset was derived from them.Moreover, they are the two most outstanding researchers of SCRP in the existing literature.They aim to find optimal operation plans for yard cranes for retrieving all the containers in a bay while minimizing the number of relocations.This optimization objective is the same as this paper, but the realization method differs.We directly compare the experimental results with those of [5,6] to illustrate the improvement of our methods in performance.In Tables 6 and 7, EM (heuristic) as well as PBFS and PBFSA (two variants of B&B) are proposed by [5] and the the heuristic ERI is proposed by [6].6 and 7 give us the summaries of the improvement of the solution quality between the SPFH and LL and the EM, ERI, PBFS, and PBFSA on the same data set with fill rate 50% and 67%, respectively.The experiment results show that the algorithms PBFS and PBFSA are not applicable to the real-time operation scenario of SCRP when the configuration size (S, T) exceeds (7,5) with the 50% fill rate or (5,5) with the 67% fill rate.All heuristics are able to complete all experimental instances, and the experimental results show that the solution quality of LL and SPFH improves to varying degrees for the heuristics EM and ERI.In terms of the trend of solution quality, the smaller the problem size, the more significant the improvement in solution quality.Meanwhile, the trend of improving the solution quality decreases as the number of stack tiers grows, indicating that the growth of the number of containers increases the proportion of uncertain information and the complexity of the solution process of the SCRP and decreases the quality of the solution.
The main reason why LL and SPFH outperform EM, ERI, PBFS, and PBFSA is that our method fully utilizes the pickup information of the arrived ETs and the adjustable strategy of the containers' pickup orders, and they increase the chances of obtaining a better solution.In fact, the terminal allows for yard operators to adjust the operation sequence of different ETs according to operational needs.This also shows that our methods are reasonable and practical.

Conclusions
This paper addresses issues related to optimizing the real-time pickup operations of import containers based on the appointment and arrival information of ETs to reduce the number of relocations.Our results include a method (namely Real-time Batch Optimization), which only focuses on the real-time pickup operation round of import containers, a dynamic upper bound of the theoretical optimal solution of the SCRP, and a heuristic algorithm based on three relocation rules.The heuristic relocation rule, LL, can be used as a standalone algorithm for operation scenarios of restricted SCRP, and the algorithm SPFH is applied to operation scenarios of unrestricted SCRP.Numerical experiments show that the newly proposed method exhibits excellent performance on both small-batch and large-batch instance sets, and its solution efficiency and quality outperform other methods in the literature.The reason for the new method's performance compared with others in the literature is that it focuses only on real-time operations, i.e., a part of the overall retrieval process, which significantly reduces the solution process size.In addition, the adjustment of the target containers' pickup order helps us choose a better operation plan.The newly proposed method in this paper is suitable for large-throughput and busy-operation container terminals because more than one ET may arrive during most of the operation rounds, while it is difficult to achieve good optimization results for small-throughput and loose-operation container terminals because not more than one ET arrives at during most of the operation rounds.Since the SCRP is an NP-hard problem, reducing the problem size is the main idea to improve its solution efficiency.In this paper, focusing on only one stage of the overall pickup operation process of imported containers significantly reduces the problem size, which provides ideas for efficiently solving large-scale instances.Meanwhile, this idea can be used to solve other NP-hard problems related to container terminal yard operation optimization.
However, the method proposed in this paper has two potential limitations: retrieval priority of the containers and target containers' pickup sequence during each real-time operation round.First, the retrieval priority of containers is crucial for estimating the ENBC and deciding the new slot for the blocking containers.But, this paper relies on the appointment information from the TAS to determine containers' retrieval priority.Theoretically, the greater the proportion of containers within a bay booked in advance, the higher the accuracy of the solution.Suppose none of the containers within a bay have been booked in advance.In that case, the method proposed in this paper will degenerate into a general SCRP, except that the problem size is reduced, while the accuracy of the solution is unknown.The second limitation is caused by the procedure GenerateSequence in algorithm SPFH, and its solution approach has been mentioned in Section 5.2.2.
In view of the limitation and applicability, further research can be carried out in the following directions based on this paper.First, using machine learning algorithms to mine and analyze the operation logs of container terminals to predict the customers' retrieval time and infer the containers' pickup priority is a worthwhile area of research for improving the solution quality of SCRP due to insufficient appointment information.Alternatively, mining the operation logs of the container terminal to derive the probability distribution of customers' retrieval for estimating the ENBC is a valuable topic, too.Second, by extending the new method proposed in this paper to the CRP of export containers, the container pre-marshaling problem (PMP) or the storage allocation problem (SAP) of import containers will be our next major concern.Moreover, the integrated optimization of the container relocation problem, yard crane scheduling, and balancing the waiting time of ETs is a challenging topic for future studies.

Figure 1 .
Figure 1.The retrieval operation process analysis of a bay.

3 : 6 :
while P is not empty do 4: p ← obtains the first item of P 5: B p ← obtain the blocking containers of the target container p for all b ∈ B p do 7: opr ← ∅, s * ← LL(b, S cur ) ▷ Get the stack for container b according to LL rule 8: if f (b, w(b), s * ) = 0 then 9:

10 :
if F cur < F best then F best ← F cur , sol best ← sol cur 11: else if F cur = F best then sol best ← sol best ∪ sol cur ←Get the top target container in each stack of W and remove them from corresponding stack.

Table 1 .
Runtime and completed instances of the heuristic LL with small batch instances.

Table 2 .
Runtime and completed instances of the algorithm SPFH with small-batch instances.

Table 3 .
The results of the LL heuristic and the SPFH algorithm under 50% fill rate.

Table 4 .
The results of the LL heuristic and the SPFH algorithm under 67% fill rate.

Table 5 .
Validation of the heuristic LL and algorithm SPFH with large instances in the real-time operation scenario of SCRP.

Table 6 .
Performance of heuristic LL and algorithm SPFH for the fill rate 50%.

Table 7 .
Performance of heuristic LL and algorithm SPFH for the fill rate 67%.