1. Introduction
Container transportation has become a widelyused mode of transportation, due to its advantages of efficient and reliable operation, comprehensive service, low cost, and easy intermodal transport. However, due to the imbalance of national trade and other complex factors, such as the location of container maintenance ports, different ports of production and use, and so on, the distribution of empty containers in ports is almost unbalanced. How to reposition them is a difficult problem, which all shipping companies have to face, not only in meeting customer demand for empty containers in time, but also in making the overall cost as low as possible.
Generally speaking, the costs relating to containers include transportation costs, stock costs, repairing costs, leasing costs, unload costs, load costs, and other operation costs. For shipping companies, there are also huge differences in the various costs consisting of laden container transportation, empty container repositioning (ECR), calling ports, and calling sequence of vessels, as well as the operating costs of liners. Moveover, since these above problems may by interrelated, it is necessary to consider them simultaneously. Therefore, this problem has become one of the key problems to be dealt with urgently for shipping companies to consider the calling port set, calling sequence, and the transportation of two typical containers together, so as to make the overall cost as low as possible. Basically, the above problem is a typical NP problem in optimization field. At present, one of the research streams about this kind of optimization solution is heuristic algorithms, which mainly imitate natural body algorithms, such as genetic algorithms (GA), ant colony algorithms (ACA), simulated annealing (SA), artificial neural networks (ANN), list search algorithms (ST), and so on.
For a heuristic algorithm solving laden container transportation, ECR, and related optimization problems, many research works and corresponding solutions have been presented. Shintani et al. [
1] relaxed the constraints of calling sequence and calling port set, and designed the corresponding shipping lines for ECR problem. This problem is formalized into a twotier model. The upper level is the knapsack problem, in order to select the best calling port set. The lower level is to determine the calling sequence under the decision of the upper level. GA is used to solve them. Supposing that the demand number of container transportation is a fuzzy one, Chuang et al. [
2] solved the shipping lines planning through fuzzy GA. Lam et al. [
3] proposed an approximate dynamic programming method to cope with the ECR of two ports and two routes. The feasibility of the method was verified by simulated data. For the empty container coding problem, Hottung and Tierney [
4] gave a novel biasedrandom key genetic algorithm encoder, which can study how to move a single container or container group to the yard quickly. Iris et al. [
5] also presented a metaheuristic algorithm for the efficient handling of containers in the yard.
Yoonjea et al. [
6] proposed a twoway, fourechelon container supply chain management mechanism to solve bilateral trade between two countries. This mechanism can reduce high shipping costs and shorten the transportation time prolonged by transit. The paper discussed, in depth, how the choice of ports, leasing empty containers, and shipping routes affected the number of ECR. Dang et al. [
7] assumed that customer demand and returned containers per unit time were sequencedependent and dependent on random variables. They considered the ECR between one port and four yards. Under this situation, it included three cases: Repositioning empty containers from other ports, repositioning between yards, and empty container leasing mechanisms. Rahime and Shahin [
8] proposed a modelling framework, which made joint problems of network design, fleet deployment, and ECR. Zheng et al. [
9] focused on the coordination of empty container allocations among liner carriers. To solve the problem, they proposed a twostage optimization method. In stage I, liner carriers pursued a centralized optimization solution of ECR. In stage II, inverse optimization techniques are used to define the exchange costs. Under the situation of the Chinese One Belt One Road, Katarzyna and Erwin [
10] analyzed the models and a variety of solutions to ECR problems through the prism of Eurasian intermodal transportation. From the view of container transport chains, Lee and Song [
11] gave the extant study in ocean container transport, in which many wide issues were discussed. Notteboom et al. [
12] studied how the alliance mode and vertical integration in container operations have influenced the selection of calling ports. Furthermore, this article also described the interplay between changes in the organizational routines of shipping lines as part of alliances, changes at the level of terminal operations, and changes in the port calling pattern.
Bandeira et al. [
13] proposed a heuristic method for integrated distribution of empty and laden containers in an intermodal network. Zhang et al. [
14] analyzed multiperiod and multiport ECR with stochastic demand and lost sales. Song and Dong [
15] considered the laden container routing and ECR at the operational level. To solve this problem, a shortestpath based integer programming method and a heuristicrules based integer programming method were given. They presented a heuristic algorithm to implement the static assignment plan in dynamic, multipleperiod situations. It is reasonable to assume that laden containers have priority over empty containers. Chang et al. [
16] adopted container substitution between different types, in order to reduce the cost of empty container interchange. The proposed heuristic approach for the multicommodity substitution problem used a branch and bound (B&B) procedure, to find an integer solution to the reduced problem. Lai et al. [
17] adopted a simulation model to optimize the ECR from the Middle East to ports in the Far East. In order to search for costeffective ways, some heuristic search methods were used. Bell et al. [
18] presented a frequencybased assignment model to allocate laden and empty containers over shipping services. Its objective was to minimize the sailing time plus container dwell time, at the original port and any intermediate transshipment ports.
Braekers et al. [
19] proposed a decision support model for service network design in intermodal barge transportation. This model determined optimal shipping routes for roundtrip services between a major seaport and several hinterland ports, where the vessel capacity and service frequency decisions also were analyzed. Chou et al. [
20] built a twostage model. In stage one, a fuzzy backorder quantity inventory mechanism was proposed, to determine the optimal quantity of empty container at a port. In stage two, an optimization mathematical programming network model was used, to determine ECR between ports. Di Francesco et al. [
21] adopted the concept of flexible destination port repositioning and used multiscenario mixedinteger programming to address the ECR problem in maritime networks under possible port disruptions. Epstein et al. [
22] developed an empty container logistics optimization system (ECO) to support the repositioning and stocking of empty containers in a large shipping company. However, the movements and routing of laden containers were not involved. Long et al. [
23] formulated a twostage stochastic programming model for the ECR problem in a maritime shipping network with uncertainties. The sample average approximation method and the progressive hedging strategy were applied to solve the optimization problem. Zheng et al. [
24] also measured container leasing prices with ECR. There are also other collaborative studies between liner shipping companies and ports. Venturini et al. [
25] addressed the integrated problem of call port sequencing and berth allocation.
At present, existing methods have studied the problem of ECR from many views, and have given corresponding solutions. However, from the literature, it can be observed that the existing methods only pay attention to laden container transportation and ECR on the operation layer to a certain extent, and ignore the direct influence of relevant decisions on the tactical layer. As we know, within industry fields, decisionmaking in the shipping industry is usually divided into three levels: The strategic layer, the tactical layer, and the operational layer. They depend on each other, complement each other, and cannot be separated. Therefore, only considering the two types of container transportation planning on the operation layer may be contrary to the actual business. For example, if the decision maker ignores the stocks of port, which typically belongs to the decision problem on the strategy level, they only focus on the container transportation. It may cause unnecessary repositioning cost, as stocking empty containers can meet the demand. In addition, most of the existing methods for solving models use classical optimization methods, such as mathematical programming methods and combinational optimization methods, which cannot cope with shippingrelated models on a large scale, having many parameters and variables, and involving big datasets.
To solve the above problems, we propose a twolayer collaborative optimization model based on business flow, which contains the main decisionmaking problem of the tactical and operation layers. This model can optimize not only the calling port set and calling sequence on the tactical layer, but also the ECR and laden container transportation on the operation layer. For the former, we have proposed a initial solution generation coding method, based on business flow, which can reduce the search space and improve the performance. These extracted business rules are constructed through intuition or experience, which can obtain the best solution, given accepted costs (e.g., time and space). In addition, differences in calling port set and calling sequence may change sailing distances for shipping lines between ports. How to calculate the reachable shipping distance matrix, some rules, and the corresponding algorithm has been given. The latter can further be optimized with the decision problem of two types of containers on the operation layer, by using a mathematical programming method. Casesimulated experiments show that the proposed method can better solve the twolayer cooperative decision problem, simultaneously. The contributions of this paper mainly include the following three aspects.
(1) A coding method and several solution generation rules for the initial solution space are designed for the shipping business flow, which can greatly reduce the search space, decrease the computational complexity, and improve the search efficiency for the best solution.
(2) Two algorithms, which can generate the initial feasible solutions and calculate the reachable shipping line distance matrix between ports, are proposed.
(3) We present and construct a twolayer collaborative optimization model, and solve the main decision problems on the tactical layer and operational layers, consisting of calling port set, calling sequence, ECR, and laden container transportation, and so on.
The rest of this paper is given as follows. The problem description is given in
Section 2. The detailed design of the proposed model is discussed in
Section 3. Experimental results and analysis are demonstrated in
Section 4. Conclusions and future work are presented in
Section 5.
2. Problem Description
As was mentioned above, the decisionmaking problem in the shipping field can be divided into three levels. For the strategic level, because the scope of its involvement is usually the overall business policy of longterm development of a company, its cycle is longer, some for as long as 30 years. It is difficult to control and quantify the processing. However, relevant decisions made on the strategic level have important and direct impacts on the lower layers, including tactical and operational layers. For example, the typical issue, on the strategic level, is strategic alliances. Forming an alliance, or breaking one, will immediately determine the relevant issues on the two lower levels. Basically, the tactical level decisions consist of route planning, liner deployment, and port inventories. This layer and the operational layer are jointly considered, and interact with each other. Meanwhile, they are consistent with the actual business, and the decision results are more reasonable and feasible. Due to the numerous decisionmaking problems on the tactical layer and the operation layer, the factors involved are very complicated. Here, only the calling port set and calling sequence on the tactical layer, and the two types of container transportation problems on the operation layer are involved in the models. The details of the problem are as follows.
Suppose that one shipping route,
$lin{e}_{1}$, is provided (shown as
Figure 1). There are six candidate calling ports. In order to describe the problem succinctly, the port numbers are named ①, ②, ③, ④, ⑤, and ⑥, respectively. The beginning port and end port of this shipping route are both ①. The process, travelling through several ports from port ① and back to port ①, is called a voyage, where the solid line is the inbound journey, including the calling port set and the corresponding sequence. It is: ①②③⑤⑥. The dotted line is the return trip or outbound one. Its calling port set and sequence is: ⑥④②①. For example, based on the given supply and demand of empty containers in the port, and transportation tasks of the laden containers, for port ①, the number of empty containers is
$10$. The negative value indicates that this port is deficit. Namely, empty containers need to be unloaded at or leased to port ①. A positive value indicates that surplus empty containers exist in the corresponding port. The workloads of the laden container transport between ports are formalized as triples (
1):
Taking port ① as an example, the transportation numbers of laden containers are ${L}_{1}(1,2,10)$ and ${L}_{2}(1,3,20)$, which describes that port ① needs to transport 10 laden containers to port ②, and 20 laden containers to port ③. Based on the situation where laden container transportation and empty container demand must be satisfied, how to choose the calling port set and plan the calling sequence will be solved here. The objective function is to maximize the total profit or minimize the total cost of a voyage.
As the factors involved in the above problems are various and complex, the following assumptions are given for building and solving the problem: For liner shipping, schedules and services are given and fixed in advance. Ignore the repair and scrapping of the containers, and all containers within the study scope are available. All required and supplied containers are measured in 20foot equivalent unit (TEU) containers. There is no limit to the amount of empty containers at each port at anytime. The tasks of laden container transportation among ports are always satisfied, and the amount of empty containers required for each port must be met. The transportation cost between ports is proportional to the distance between them.
3. Optimization Models
The above problem is a typical combinatorial optimization problem. Since this problem has decisions at two levels, consisting of tactical level and operational level decisions, involved, we divide it into two stages and solve them separately. In first stage, the visiting sequence is determined and, in the second stage, the optimization model for ECR is solved.
3.1. Initial Solutions Generation Mechanism of Calling Port Set and Calling Sequence on the Tactical Level
When the problem scale increases exponentially, the existing classical combinatorial optimization methods will be usually fruitless and frustrating. Therefore, inspired by the coding method of classical GA, a coding method based on business flow is proposed to adapt this problem. After studying the related business flows on the tactical layer, Rule 1 and Rule 2 are extracted as the basis for the initial solution sequence generation mechanism, as shown below.
Rule 1: Considering that the beginning port and ending port of one voyage in the shipping business are both port ①, the corresponding values of start and end positions of all the solution sequences are both ‘1’. The ‘1’ indicates that the corresponding port is called, and ‘0’ for the opposite side. Generally, because port ⑥ is the farthest port, it must be called; otherwise, it may be isolated. So, its value is also ‘1’.
Some of the initial solutions (calling sequences) are presented in
Table 1. For example, the solution
${s}_{1}$ describes the calling port sequence ①②③⑤⑥④②①. Basically,
${s}_{1}$ shows the case in
Figure 1. For solution
${s}_{2}$, the inbound trip calls each port, but the outbound trip only visits ports ⑥ and ①. The corresponding port calling sequence is ①②③④⑤⑥①. According to Rule 1, both of them are feasible solutions.
The feasible solution sequence generation algorithm is given (from line 4 to 21) in Algorithm 1.
Rule 2: For one voyage, including the outbound and inbound trips, the same port should be called at least once and up to 2 times. The former can ensure the connectivity between this port with any other ports, and the latter can avoid the route forming a selfloop.
It is easy to find that, after applying these two rules, the initial solution space size can be reduced from
${2}^{11}$ to
${3}^{4}$ and greatly cut the search space. For example, as shown in
Table 2, for sequence
$n{s}_{1}$, the corresponding positions of outbound and inbound are both 0 for port ③, representing that there is no calling at port ③ at all in both directions. This completely deviates from the actual business flow. Another example is
$n{s}_{2}$: Except for ports ① and ⑥, the other ports are not linked, which is also out of the actual business flow. Similarly, the sequences
$s{n}_{3}$ and
$s{n}_{4}$ are both infeasible solutions, shown in
Table 2.
3.2. Generation Mechanism of Reachable Shipping Lines Matrix Between Ports
Due to the difference between calling port set and calling sequences among ports, the transportation distances of containers that can be reached among the various ports will be quite different. The distances between ports are formalized as (
2), which indicates that the distance between
$port1$ and
$port2$ is
d standard units.
Without loss the generality, assume that the distances between ports are (①②: 50), (②③: 40), (③④: 80), (④⑤: 50), and (⑤⑥: 70). In
Figure 1, since the outbound trip does not call at port ④, the shipping route distance between port ③ and ④ can be calculated as below: ③④⑤⑥⑤④. The shipping route distance is 80 + 50 + 70 + 70 + 50 = 320.
Based on the above analysis, the following five rules were extracted as the relevant basis for generating the shipping distance matrix between ports, according to the actual service flow.
Rule 3: If one port is called on both inbound and outbound journeys, the distance between the other ports to this port has 2 values, and the corresponding shipping distance value in the matrix is taken to be the smaller one.
By way of illustration, for the feasible solution $sn\left(111111111111\right)$, this port sequence indicates that all ports are visited in both directions. Our method will calculate two values when deciding the shipping route distance from port ② to ④. One is docked at port ② and ④ for inbound journey. The calling ports sequence is ②③④, and its shipping line distance is 120. Another is calling at port ④ when returning. The calling port sequence is ②③④⑤⑥⑤④. Its shipping route distance is 460. So, the corresponding value in the route distance matrix between port ② and ④, according to rules 3, is 120.
Algorithm 1 Pseudocode for calling port set generation mechanism and reachable shipping distance matrix. 
Require:  1:
number of candidate ports: n. $dis[2n2]$;// distances of neighbour ports.
Ensure:  2:
$path[2n1]$;//calling ports set and calling sequence. $dis\_mat\left[n\right]\left[n\right]$; //shipping distance matrix: SDS.  3:
procedure  4:
$pos\_bef\left[n\right]$;//represents the calling ports set of inbound trip.  5:
$pos\_aft\left[n\right]$;//represents the calling ports set of outbound trip.  6:
//calling sequences generation.  7:
$pos\_bef\left[\right]=path[0:n]$; $pos\_aft\left[\right]=path[n:2n1]$;  8:
for each i in $2n1$ do  9:
//Initialize path, where the corresponding positions are 0 and length of each calling sequence is $2n1$.  10:
//position 1, n and $2n1$ must be called, and its position value equals to 1.  11:
$path\left[1\right]=path\left[n\right]=path[2n1]=1$;  12:
for (int $i=2;i<n1;i++$) do  13:
$path\left[i\right]=$ random(0,1);//random value generation: 1 or 0.  14:
if ($path\left[i\right]==0$) then  15:
$path[2ni]=1$;//port must be called once.  16:
end if  17:
if ($path\left[i\right]==1$) then  18:
$path[2ni]=1$ or $path[2ni]=0$;  19:
end if  20:
end for  21:
end for  22:
//calculate the distance matrix.  23:
for each i in range(n) do  24:
for each j in range(n) do  25:
if ($i==j$) then  26:
$dis\_mat\left[i\right]\left[j\right]=0;$ //set the distance from port A to A is 0.  27:
else  28:
//if both two ports are in $pos\_bef$ and not 0.  29:
//both two port are located in “pos_bef” respectively. Both their values are not ‘0’.  30:
//judge the positions of two ports, get port “$t1$” from A to B.  31:
if ($pos\_bef\left[i\right]!=0\&\&pos\_bef\left[j\right]!=0$) then  32:
$t1=Fun(pos\_bef[i],pos\_bef[j\left]\right)$  33:
// Fun is to obtain the passing port set from i to j.  34:
for (t in range($t1$)) do  35:
$temp1+=dis\left[t\right]$;  36:
end for  37:
end if  38:
//both two port are located in “pos_aft” respectively. Both their values are not ‘0’.  39:
//judge the positions of two ports, get port “$t2$” from A to B.  40:
if ($pos\_aft\left[i\right]!=0\&\&pos\_aft\left[j\right]!=0$) then  41:
$t2=Fun(pos\_aft[i],pos\_aft[j\left]\right)$  42:
for (t in range($t2$)) do  43:
$temp2+=dis\left[t\right]$;  44:
end for  45:
end if  46:
// two ports are located in “pos_bef” and “pos_aft” respectively.  47:
// Both their values are not ‘0’.  48:
//judge the positions of two ports, get port “$t3$” from A to B.  49:
if ($pos\_bef\left[i\right]!=0\&\&pos\_aft\left[j\right]!=0$) then  50:
$t3=Fun(pos\_bef[i],pos\_aft[j\left]\right)$  51:
for (t in range($t3$)) do  52:
$temp3+=dis\left[t\right]$;  53:
end for  54:
end if  55:
$dis\_mat\left[i\right]\left[j\right]=min(temp1,temp2,temp3)$; // get the minimum value of three values.  56:
end if  57:
end for  58:
end for  59:
end procedure

Rule 4: Within one voyage, if one port only has an inbound calling, the other ports to this port cannot reachable in the outbound journey. That is, nonconnected for outbound. For this situation, the shipping route distance has only one value and reaches its maximum.
Take the calling sequence $s{n}_{m}\left(11011111101\right)$, as example. For the inbound journey, it calls in at port ②; but in the outbound, it does not call in at port ②. So, the shipping line from port ③ to ② is ③②①②. Their value in the distance matrix is $40+50+50=140$.
Rule 5: When calculating the shipping route distance matrix, the maximum distance of any two ports cannot exceed the values of one voyage.
Since each port calls one time at least, the maximum distance between this port to other ports is across both inbound and outbound journeys. Its values are less than the distance of one voyage.
Rule 6: For a feasible solution, every two ports are connected.
If one solution can not guarantee that any two ports can reach one another, it may appear to have an isolated port. Furthermore, if two ports are not connected, the possible transportation task cannot be executed. This port also loses the existing necessity.
Rule 7: For each port, the distance from the port to itself equals to 0.
For example, for feasible solution sequence
$s{n}_{p}\left(11111111111\right)$, its distance matrix is as in Formula (
3). The Pseudocode is described (from line 23 to 58) in Algorithm 1.
3.3. Relevant Parameters of Two Types of Containers on the Operational Level
To describe the model of ECR and laden container transportation conveniently, some notation is given:
$i,j$: port;
$defP:deficit\phantom{\rule{4pt}{0ex}}port\phantom{\rule{4pt}{0ex}}set$, the port set to which the empty containers need to be imported;
$surP:surplus\phantom{\rule{4pt}{0ex}}port\phantom{\rule{4pt}{0ex}}set$, the port set from which the empty containers need to be exported;
$balP:balance\phantom{\rule{4pt}{0ex}}port\phantom{\rule{4pt}{0ex}}set$, the ports set which needs neither importing nor exporting;
P: port set—$P=\{defP,surP,balP\}$;
M: profit coefficient of laden containers;
Q: transportation cost coefficient of laden containers;
N: transportation cost coefficient of empty containers;
$empt{y}_{i}$: the number of empty containers in port i;
$lease{C}_{i}$: the leasing cost of unit containers in port i;
$load{C}_{i}$: the loading cost of unit containers in port i;
$unload{C}_{i}$: the unloading cost of unit containers in port i;
$stock{C}_{i}$: the inventory cost of unit containers in port i;
$portCall{C}_{i}$: the calling cost of vessel in port i;
$lade{n}_{ij}$: number of laden containers from port i to j;
$di{s}_{ij}$: the distance between port i to j.
3.4. Optimization Model of ECR and Laden Container Transportation on the Operational Level
According to the business process of ECR and laden container transportation on the operation layer, the corresponding objective function, decision variables, and constraints are given as follows.
3.4.1. Decision Variables
The decision variables are as follow:
$transNu{m}_{ij}$: number of empty containers from i to j;
${s}_{i}$: inventory number of empty containers in i;
${l}_{i}$: leasing number of empty containers in i.
3.4.2. Objective Function
According to the objective function, which maximized the revenue, we give the details of model as formula
4 and corresponding constraints as formulas (
5)–(
9), where, the objective function (
4) describes that the goal of the model is to maximize revenue, which is the total income minus the total cost.
3.4.3. Constraints
According to the above hypothesis and problem description, the corresponding constraints are given:
The first item of the objective function is the freight income of laden containers. The second items are the transportation cost and (un)loading cost of the empty containers, respectively. The third item is the leasing cost of the deficit ports. The fourth item is stock cost of empty containers in surplus ports. The last one is the cost of the vessel calling ports, which is usually a constant. The constraint (
5) indicates that the number of empty containers exported from the surplus ports cannot exceed the ones available at the same port. The constraint (
6) describes that the number of empty containers imported into the deficit ports should be less than or equal to the absolute value of required ones. The constraint (
7) ensures that the deficit ports do not export empty containers; otherwise, it will be contrary to the actual business. The constraint (
8) declares that, for the surplus ports, the exporting amount of empty containers plus the inventory ones are equal to the excess. The last constraint (
9) limits the leasing mechanism, and is employed if the imported empty containers do not meet the demand ones in deficit ports. The number of leased empty containers is the demand ones minus the importing ones. This is due to the fact that the empty container demand must be met, which was mentioned in the above hypothesis.