OPTIMAL CONTROL OF SHIP COLLISION AVOIDANCE PROBLEM

unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Abstract. The continuous increasing of maritime traffic amplified the severity of the collision risk issue in the maritime domain. Therefore, the calculus and optimization of ship’s navigation without collision risks have been known as a major challenge for the scientific researches’ community. Several solutions were proposed to enhance the maritime safety. The topic was covered as an optimal control problem with state constraints using Nonlinear Model Predictive Control in order to consider the nonlinearity of the ship motion. Other researches relied on calculating risks of collisions in ocean navigation by metaheuristic methods or by neural networks in order to cover multi-ship collision risk situation. In this paper, a detailed description of necessary elements used in the analysis of the maritime navigation without collision issue is presented including the ship motion, the International Regulations for Preventing Collisions at Sea COLREGs rules, and the navigation cost. An analytical study of optimal control based on Pontryagin’s Maximum Principle to avoid ship collision situation with more efficiency is proved and detailed. Simulation results that show the efficiency of the described method are calculated using MATLAB.


INTRODUCTION
The risk of collision between ships increases due to the increment of ships in number and size led by technological development and shipping market needs. The current ship control system is supported by navigation equipment, i.e. gyrocompass, GPS, radar with an Automatic Radar Plotting Aid (ARPA), Automatic Identification System (AIS), Electronic Chart Display and Information System (ECDIS), and autopilot, to facilitate the achievement of the navigator's task. However, safe ship control is a complicated mission, because it demands a continuous evaluation of a large amount of data in real-time and quick decision making. Inaccurate analysis of the current navigational situation or the ignorance of some indications can engender a tragic collision situation. In conventional navigation systems, the main attributes to shipping casualties are wrong judgment, human guidance mistakes, and miss operations that may cause many serious accidents and environmental disasters. In this context, the collision risk, especially the human factor, appears to be the main cause. Human error is a crucial factor in maritime accidents. In fact, from a total of 880 accidental events analyzed during the investigations, 62 percent were attributed to a human erroneous action.
In addition, 50 percent of navigational casualties are caused by the combination of contact (1 590 cases), grounding/stranding (1 426) and collision (1 352) [1]. Controlling the maritime navigation without collisions has been commonly managed by experienced helmsmen and through a decision making based on radar plots of the observed moving objects. Operators use radar plotting to calculate the range, bearing, course, speed, distance. In addition, the collision situations are mainly regulated by the International Regulations for Preventing Collisions at Sea COLREG. These rules describe only the action taken to avoid collision for one-to-one meeting ships, which are, crossing from the right and left, head-on, and overtaking as shown in figure (2). However, they are not efficient for multivessel situation nor for autonomous navigation.
Researches on ship collision avoidance started in the early 20th century. The topic has multiple axes starting with ship motion modeling, collision risk calculation, safe trajectories generation, collision avoidance systems in compliance with COLREG, autonomous system implementation challenges, etc. These axes have been subjects to various researches and have been covered by different approaches. [2] described wave forces, hydrodynamic coefficients, and 2-DOF, 3-DOF model of a surface vessel motion and also focused on the analyses and results that coupled between roll-yaw and sway-roll-yaw. [3] proposed a control design for underactuated surface ships considering force and yaw moment. The results were based on Lyapunov's direct method and backstepping technique. [4] introduced a control strategy based on model predictive control that can be applicable for ships guidance and trajectory tracking in a real sailing condition. [5] developed a parametrization of collision-avoidance control behaviors through the course angle command and the propulsion command. The optimal control behavior was obtained considering obstacles and target ships' prediction trajectories, COLREG rules, and collision hazards calculation. [6] and [7] described collision avoidance algorithm based on model predictive control and used nonlinear programming that can be implemented for autonomous ships in order to avoid both static and dynamic obstacles in compliance with rules in COLREG. [12], [13] suggested an approach that may be used to improve the autonomy of unmanned vehicles systems. These studies solve the path planning and collision avoidance problems using Ant Colony Optimization Algorithm. [14], [15] developed a system based on an improved approach for collision avoidance route planning using a differential evolution algorithm. This system was served as a tool to generate optimal and safe vessel paths in the presence of conflicts. [16] presented collision-avoidance system with the help of a decision-making process using Bayesian Network which was able to perform several sequential actions in order to avoid collision with multiple ships with respect to COLREG rules. To solve the same problem [18] used a model that combined the differential game and linear programming to calculate the safe ship paths in a multiple cooperative and non-cooperative ships encountered situation. [17] introduced the criterion of ship domain and ship fuzzy domain as an essential element in safe ship navigation. The calculation of the ship domain depended on multiple factors as, the ship size, the navigation shape area, the size of encountering ships, etc. The ship domain can be calculated using different approaches, stochastic methods, deterministic methods, and artificial intelligence based on the expert knowledge.
Regarding the topic as an optimal control problem with constraints in real time, some results already showed the efficiency of the optimal control strategies, especially PMP, in improving human lives [21], and machine performances [20]. These mentioned studies introduced a model based on an optimal control strategy, using the Pontryagin Maximum Principle, to retain a lower number of infected nodes alongside height number of recovered ones at a minimum cost, with a vaccination program in a SIR epidemic model [21] and in a computer virus model [20].
The results of these studies demonstrated that the control reduced the propagation of the virus in a population [21] and in a computer network [20] over time. Many other previous studies proved the advantages of using optimal control in similar fields as ship collision avoidance as inland and air navigation systems, due to the advanced researches and the development of computer technology, satellite communicational systems, and electronic devices, including high-tech sensors and actuators. [23] introduced a Modified Hamiltonian Algorithm as a base in a control methodology of collision avoidance for road vehicles using two-level modeling. This methodology was divided from the more standard approach of path-planning and path-following, as there was no explicit path reference utilized. In [22], the study was based on the formulation of the model of collision avoidance and conflict as a singular optimal control problem using the actual flight dynamics of each aircraft and the criteria that a flight regime correction is optimal if the flight navigation verifies a minimum-time safe deviation, which developed an optimal control of conflict avoidance model for aircraft traversing planar intersecting trajectories. However, algorithms that comply with COLREG rules in ocean navigation systems based on optimal control problem is still underdeveloped. In the existing literature, [9] proposed a method to reconstruct an optimal turning ship maneuvering within a limited see area, using a nonlinear unified state-space model. [10] extended the analysis proposed for route change and side-step maneuvering to be applied in ship collision avoidance problem, using the Chebyshev type instead of the Mayer type and assuming that the ship is controlled by a rudder severe. The boundary and final boundary conditions were processed by the penalty function technology. [11] presented a concept for a collision-avoidance system for ships based on model predictive control by generating a finite set of alternative control behaviors depending on two parameters: offsets course angle of autopilot and changes of the propulsion command ranging. The optimal control behavior was selected using simulated predictions of the trajectories of the obstacles and the ship, considering the COLREG rules and collision hazards associated with each of the alternative control behavior.
The main purpose of this work is to make the ship avoids potential collision and choose the safe trajectory autonomously, taking into consideration the dynamics of the ship motion, the COLREG rules, and the minimizing of the navigation cost and time. In this paper, we present an optimal control method based on Pontryagin's Maximum Principle (PMP) to solve the problem. The simulation results are done with the help of MATLAB. To reply properly to the problem, this paper is organized as follows: Section I introduces the motivation of this work based on statistical facts and gives an overview of the current navigation systems and the various researches and approaches that handled the problem. Section II presents the detailed mathematical model that is used, next, in the construction of the Hamiltonian method. In Section III, we prove the existence and the characterization of the optimal control solution using the PMP principle. Then, simulation results are illustrated and a discussion of these results is provided in Section IV. Finally, conclusions and work perspectives are presented in Section V. • Sway motion: Translation following the y axis.

MATHEMATICAL
• Yaw motion: Rotation about the z axis.
The ship motion can be expressed in vectorial form according to [25] and [24], in the earth-fixed frame O(x, y, z), (1) where R(ψ) is the transformation matrix between body frame and inertial frame, T is the state of the ship in the earth-fixed frame, ν = [u v r] T is the velocity vector, M is the mass matrix, C is the Coriolis matrix, and I z represents the inertial moment about the first component of the center gravity (x g , y g , z g ). τ = K[P R] T denotes the actuator forces and moments [27], such that, • K is a configuration matrix.
• The propeller provides the thrust forces P, located at coordinates (x p , y p , z p ), generated by the set of thrusters revolution per second [n 1 , n 2 , ..] T , such that, where P n is a parameter that depends on the propeller diameter and the water density.
OPTIMAL CONTROL OF SHIP COLLISION AVOIDANCE PROBLEM 7 • The rudders provide a lift forces R, located at coordinates (x δ , y δ , z δ ), generated by the set of rudders angles [δ 1 , δ 2 , ...] T , such that, where k is a parameter that depends on the effective rudder area and the relative velocity at the rudders surfaces.
From this configuration, τ can be rewritten as, Then the model of ship motion can be written as, where z = [x y ψ u v r] T is the state vector of the model and µ = [n δ ] T is the control input, bounded between µ min and µ max , denoted by: In a developed form, the position and the velocity of the ship are given by the following system of ordinary differential equations [3], with non-negative initial conditions x(0) = x 0 , Our purpose in this work is to control the behavior of the own ship in collision situation with multiple ships, detected on the radar screen of the ARPA (Automatic Radar Plotting Aids) anti-collision system, which detects more than twenty encountered ships [19]. For that, the position variables of the own ship must satisfy the suggested conditions |x − x i | ≤ R and |y − y i | ≤ R, where R denotes the radius of the radar screen. x i , y i are the position variables of the ith target encountered ship.
In addition, the linear and angular velocities are assumed to be bounded for industrial reasons.
Taking into account the assumptions made above, we obtain that all solutions are uniformly bounded in the following denoted subset of R 6 : To prove the existence of solutions of the system, the second term of the right hand of (3) must be uniformly Lipschitz continuous [26].
Using the developed form, we obtain, where M i {1≤i≤8} are constants composed as combinations of the mass, the Coriolis coefficients, and the maximum values of linear and angular velocities.

Safe ship trajectories.
In its simplest form, the ship trajectory can be designed as a time-varying state η(t) = [x(t) y(t) ψ(t)] T . To avoid collision risk with other target ships, the own ship trajectory should belong to a set of safe ship trajectories C 0 (t) that is described as: where N is the number of target ships detected by the AIS system.
From the maritime safety point of view, a safety distance D i sa f e should be respected to avoid collision between two ships [8], as described in the following inequality, • R i : The domain radius of the i th target ship.
• L: The own ship length.
• D i o : The safety distance between the target ship and the own ship is described in COL-REG rules.
Therefore, the safety distance is defined as: Then, the safe ship trajectories can be rewritten using the safety distance to avoid collision risk between the own ship and target ships,

COLREG rules. COLREG rules treat collision avoidance problems in three cases as
shown in Figure 2. Let ψ o and ψ i be the heading angles of the own ship and the target ship respectively.
• In a HEAD-ON situation, each ship should alter to starboard.
• In a CROSSING situation, the ship on the port side should alter to starboard, and the other should stand on.
• When a ship should be OVERTAKEN another ship, she alters to starboard and, the overtaking ship stands on. If a ship should react, the evasive maneuvers should be always to the starboard in respect to COLREG rules. For this purpose, we introduce the following condition: In addition to this, collision avoidance depends also on the time of taking action. The more time passes the less action to avoid collision is efficient. Taking this into account, we consider the following condition, where t d is the time of collision risk detection:

OPTIMAL CONTROL PROBLEM
3.1. Problem Formulation. Choosing a safe trajectory to avoid collision may lead the ship to deviate from its tracking trajectory. To handle the course deviation, the input of the system, µ = [n δ ], should minimize the erroneous between the safe trajectory and the desired trajectory [24], The goal is to take the ship from an initial state z t d to a terminal state z T , in a time duration , into a collision risk situation with N target ships, and to minimize three terms, the difference between the ship trajectory and the reference trajectory, the difference between the time of risk detection and the time to action, and the voyage cost. Therefore, the objective function can be defined as: We seek the optimal control µ * such that, where U is the set of admissible controls defined by:

Optimal Control Solution.
The purpose of this section is to develop a control solution based on the Pontryagin Maximum Principle. This method affords a solution to the problem with constraints on the control variables. To use this approach, we must first check the existence of the solution which depends on satisfying a set of conditions [26]: • The set of states variables and the set of controls are not empty which is proved above.
• The definition (5) of U clearly reveals that the set is closed and convex.
• There exists c 1 , c 2 > 0 and ρ > 1, such that, In a real situation, there is a positive amount of time to take action after detection of collision risk. Therefore, there exists ε > 0, such that |t d − t| > ε. Then, we can easily see that the condition is verified for c 1 = 1 2 , c 2 = ε, and ρ = 2. Then, we obtain, It is convenient to define the Hamiltonian function to characterize the necessary conditions of the optimal control: H (x, y, ψ, λ 1 (t), ..., λ 6 (t)) = L(x, y, ψ, µ) For the optimal control solution µ * and the state system solutions denoted as x * , y * , ψ * , there exist adjoints functions {λ i } i=1..6 with the transversality conditions, satisfying the following equations: Considering the optimality condition, we obtain and denote the characterization of the optimal control: Therefore, we can obtain the optimal control solution µ * : Given the optimal solution µ * and the system solution (x * , y * , ψ * , u * , v * , r * ), we can rewrite (4) in the following form,

NUMERICAL RESULTS
In the previous section, we give a theoretical control solution using PMP. However, finding the numerical solution explicitly is quite difficult in practice. The simulation of complex real-world optimal control problems is possible now in light of revolutionary improvements in the field of numerical approaches and techniques [29]. In this section, the forward-backward algorithm based on the Runge-Kutta order 4 method is applied to the ship collision avoidance problem by regarding the optimal control problem as a two-boundary value problem [28], at t 0 and T . MATLAB is used for the implementation of the numerical method and the graphic results. In the following, the steps of the numerical implementation are presented: • Step 1: Define the step size T − t 0 = mh , where m is the number of mesh points in the interval. Step 2: Define the adjoints initial conditions as in (6) and the state and control variables initial conditions.
• Step 3: Solve the state variables forward in time according to its differential equation in the optimality system (4), using the initial conditions of the state variables and the values of µ [29].
• Step 4: Solve the adjoint functions backward in time according to its differentials equations in the optimality system (7), using the transversality condition (6) at time T , the values of µ, and the state variables solved in step 3. • Step 5: Update µ by entering the new state variables and adjoint functions values in the characterization expression of the optimal control.
• Step 6: Check the convergence of the algorithm by calculating the relative error.
The numerical simulations were carried out based heavily on the ship characterizations, parameters, and coefficients values of the ship dynamics used in [3], defined as shown in Table 1.
The reference trajectory is generated with the help of a virtual ship with initial conditions and not including control variables.    These constraints are the control of collision avoidance by choosing states among C 0 (t), and the respect of COLREG rules by applyingψ > 0.
Plots in Figures 3b, 4b show that the variation in velocities is close to zero except in yaw velocity represented in Figure 5b, which is minimized in the optimal control model and that contributes to cost minimization during the navigation.

CONCLUSION
This work provided a literature contribution on applying optimal control techniques to maritime safety. By including ship motion in our study, we presented a realistic controlled model that represents real-time ship navigation. By the mean of Pontryagin's maximum principle, we developed a control strategy that provides to the ship autopilot the rudder and the propulsion values should be applied as a system controls in real-time navigation. Simulation results obtained in the present paper indicated that the control strategy helps in avoiding ship collision risk simultaneously and effectively with respect to COLREG rules and cost minimization.