**1. Introduction**

One of the most important transport issues is the safe control of movement, measured by the probability of collision risk when passing ships on the route, using information from the radar anticollision system [1,2]. In practice, there are many safe trajectories for the ship, from which an optimal trajectory can be chosen that ensures minimum collision risk and the smallest path loss on passing encountered ships [3–5]. The development of modern information technologies creates appropriate opportunities for the automation of navigation and construction of decision support systems to safety control the movement of a ship (Figure 1).

**Figure 1.** Safe ship-control system: Dj—distance to j-th met ship, Nj—bearing to j-th met ship, ψ—course of the own ship, V—speed of the own ship, J—number of met ships.

According to Lloyd's statistics, in about 87% of marine accidents, the cause of ship collisions is the navigator's subjectivity in maneuvering decisions, often under conditions of ambiguity and conflict. Therefore, among the many possibilities of describing this process, models of fuzzy control and game control become useful [6–8].

The methods of static and dynamic optimization used so far, evolutionary algorithms or particle swarm methods, do not include the fuzzy and game properties of the real anticollision problems of the ship [9,10].

Therefore, the aim of this paper is to determine an optimal and safe ship trajectory using the theory of fuzzy sets and game theory (Figures 2 and 3).

**Figure 2.** Fuzzy control system.

**Figure 3.** Game control system.

#### **2. Kinematic Model of the Ship**

In practice, the kinematics parameters of passing ships at sea in the form of:


These are identified by the automatic radar plotting aids (ARPA) anticollision system (Figure 4).

**Figure 4.** Situation of passing own ship with other ships.

The kinematic model of the control can be presented in the form of state equation

$$\mathcal{X}\_{\mathbf{k}+1} = \mathbf{f}\left(\mathbf{X}\_{\mathbf{k}}, \mathbf{U}\_{\mathbf{k}}\right), \mathbf{k} = 1, 2, \dots, n \tag{1}$$

where: (Xk+1, Xk) is the set of real ship position co-ordinates, and Uk is the control set [11].

The process ends when the ship reaches the back points called the final states

$$\mathcal{W} = \left\{ \mathbf{a}\_{\mathbf{p}+1}, \mathbf{a}\_{\mathbf{p}+2}, \mathbf{a}\_{\mathbf{n}} \right\} \tag{2}$$

The set of final states must meet this condition

$$\begin{aligned} \boldsymbol{\Psi}\_{\text{opt}} &= \boldsymbol{\Psi}\_{\text{S}} \\ \mathbf{V}\_{\text{opt}} &= \mathbf{V}\_{\text{S}} \\ \boldsymbol{\mu}\_{\text{R}} &\leq \boldsymbol{\mu}\_{\text{Rsafe}} \end{aligned} \qquad\tag{3}$$

where: (ψopt, Vopt) are the optimal own-ship course and speed, (ψS, VS) are set point own-ship course and speed, and μ<sup>R</sup> is the membership function of collision risk [12].

#### **3. Fuzzy Control Model of the Process**

#### *3.1. Membership Function of Fuzzy Goal*

Different security assessments made by navigators can be described as the membership function of the fuzzy goal, allowing a subjective assessment of

$$\mu\_{\rm G}(\mathbf{k}, \mathbf{j}) = 1 - \frac{1}{\exp(\lambda\_{\rm d}(\mathbf{k}, \mathbf{j}) \mathbf{DCPA}\_{\mathbf{j}}^2)} \tag{4}$$

where λ<sup>d</sup> is the navigator's subjective parameter.

#### *3.2. Membership Function of Fuzzy Constraints*

The membership function of the fuzzy constraints can be defined as

$$\mu\_{\mathbb{C}}(\mathbf{k}) = \frac{1}{\exp(\lambda\_{\mathbf{c}}(\mathbf{k})(\mathbf{V}\cos\psi(\mathbf{k}) - \mathbf{V}\cos\psi(\mathbf{k}-1))\mathbf{t}\_{\mathbf{k}}^{2})} \tag{5}$$

where λ<sup>c</sup> is the navigator's subjective parameter.

#### *3.3. Membership Function of Fuzzy Collision Risk*

Ships that can take part in a collision should be sorted according to the degree of threat by the collision-risk rating index. In many works, the ship's domain is treated as an assessment of collision risk [8]. In this article, the collision-risk transfer function was used as collision-risk assessment

$$\mu\_{\rm R}(\mathbf{k}, \mathbf{j}) = \frac{1}{\exp(\lambda\_{\rm rd}(\mathbf{k}, \mathbf{j}) \mathbf{DCPA}\_{\mathbf{j}}^2 + \lambda\_{\rm rt}(\mathbf{k}, \mathbf{j}) \mathbf{TCPA}\_{\mathbf{j}}^2)} \tag{6}$$

where λrd and λrd are the navigator's subjective parameters.

The fuzzy-set decision is determined as result of an operation of the fuzzy set of a goal and fuzzy set of constraints

$$
\mu\_{\rm D}(\cdot, \cdot) = \mu\_{\rm C}(\cdot, \cdot) \* \mu\_{\rm C}(\cdot, \cdot) \tag{7}
$$

#### *3.4. Fuzzy Neural Anticollision (FNAC) Algorithm*

To present the idea of dynamic programming in this case, we first have to present the task in a slightly fuller form

$$\begin{aligned} \mu\_{\rm D}(\mathbf{u}\_{0},...,\mathbf{u}\_{N-1}|\mathbf{X}\_{0}) &= \\ \max\_{\mathbf{u}\_{0},...,\mathbf{u}\_{N-1}} [\mu\_{\rm C}^{0}(\mathbf{u}\_{0}) \wedge \mu\_{\rm G}^{1}(\mathbf{X}\_{1}) \wedge \mu\_{\rm C}^{1}(\mathbf{u}\_{1}) \wedge \mu\_{\rm G}^{2}(\mathbf{X}\_{2}) \wedge \dots \\ \dots \wedge \mu\_{\rm C}^{N-1}(\mathbf{u}\_{N-1}) \wedge \mu\_{\rm G}^{N}(\mathbf{f}(\mathbf{X}\_{N-1},\mathbf{u}\_{N-1})) \end{aligned} \tag{8}$$

After transformation and maximization in relation to controls (u0, u1, ... , uN−1), we obtain the following system of recursive equations

$$\begin{cases} \boldsymbol{\mu}\_{\rm{G}}^{\rm{N-i}}(\mathsf{X}\_{\rm{N-i}}) = \max\_{\mathbf{u}\_{\rm{N}-i}} [\boldsymbol{\mu}\_{\rm{G}}^{\rm{N-i}}(\mathbf{u}\_{\rm{N}-i}) \wedge \boldsymbol{\mu}\_{\rm{G}}^{\rm{N-i+1}}(\mathbf{f}(\mathsf{X}\_{\rm{N-i+1}}))] \\\ \boldsymbol{\chi}\_{\rm{N-i+1}} = \mathbf{f}(\mathsf{X}\_{\rm{N-i}}, \mathsf{u}\_{\rm{N-i}}) \; \mathbf{i} = \mathbf{0}, 1, \ldots, \text{N} \end{cases} \tag{9}$$

Referring to Formula (9), going back from stage t = N to t = 0, at each stage there are two phases: minimization and maximization. Such operations can be implemented using the special neural network proposed in [13]. The traditional artificial neural network does not perform the minimum and maximum operations of a finite set. Appropriate neurons were proposed by Rocha, which will be presented in the next sections [14–18].

#### 3.4.1. Neural Network

The operations presented above require special neurons that can be used in an artificial neural network. Such neurons were proposed by Rocha [19], neurons of maximum type and minimum type. We assume that the neuron has n inputs (b1, b2 ... , bn) and the weighted sum of these n inputs is defined by the following formula

$$\mathbf{y} = \sum\_{\mathbf{k}=1}^{n} \mathbf{w}\_{\mathbf{k}} \mathbf{b}\_{\mathbf{k}} \tag{10}$$

where wk are the synapse weights connecting the input neurons.

The following pattern shows that the resulting obtained value u is encoded as the axonal activation bp of the postsynaptic neuron.

$$\mathbf{b}\_{\mathbf{p}} = \begin{cases} 1 & \text{if} \quad \mathbf{u} \ge \alpha\_2 \\ \quad \mathbf{f}(\mathbf{u}) & \text{if} \quad \alpha\_1 \le \mathbf{u} \le \alpha\_2 \\ 0 & \text{otherwise} \end{cases} \tag{11}$$

We have introduced two axonal thresholds α1, α2, which are defined by polarized neurons, where f transition function. We can now define the maximum-type neuron and the minimum-type neuron.

#### Maximum-Type Neuron

Defined as such whose axonal threshold α<sup>t</sup> in stage t is described as

$$\alpha(\mathbf{t}) = \begin{cases} 1 & \text{if } \quad \mathbf{t} = 0 \\ \mathbf{b}\_{\mathbb{P}}(\mathbf{t} - \mathbf{1}) \text{ otherwise} \end{cases} \tag{12}$$

However, axionic activation bp is presented as

$$\mathbf{b}\_{\mathbf{p}}(\mathbf{t}) = \begin{cases} \mathbf{a}(\mathbf{t}) & \text{if } \mathbf{u}(\mathbf{t}) \le \mathbf{a}(\mathbf{t}) \\ \mathbf{u}(\mathbf{t}) & \text{otherwise} \end{cases} \tag{13}$$

where u(t) is the postsynaptic activation at stage t [20].

Combining the two functions, at the output of the max neuron, we obtain a maximum value of the inputs if weight wk = 1

$$\mathbf{b}\_{\mathbf{p}}(\mathbf{t}) = \max\_{\mathbf{k}=1,2,\ldots,\mathbf{t}} \left[ \mathbf{w}\_{\mathbf{k}} \mathbf{b}\_{\mathbf{k}} \right] \tag{14}$$

Minimum-Type Neuron

Defined as a neuron whose axionic threshold α<sup>t</sup> at stage t is

$$\mathbf{a}(\mathbf{t}) = \begin{cases} 1 & \text{if } \mathbf{t} = 0 \\ \mathbf{b}\_{\mathbf{P}}(\mathbf{t} - 1) \text{ otherwise} \end{cases} \tag{15}$$

However, axionic activation

$$\mathbf{b}\_{\mathbb{P}}(\mathbf{t}) = \begin{cases} \boldsymbol{\alpha}(\mathbf{t}) \text{ if } \mathbf{u}(\mathbf{t}) \ge \boldsymbol{\alpha}(\mathbf{t})\\ \mathbf{u}(\mathbf{t}) \text{ otherwise} \end{cases} \tag{16}$$

The equations show that the output of the min neuron encodes at least the minimum value of the inputs if weight wk = 1

$$\mathbf{b}\_{\mathbf{P}}(\mathbf{t}) = \min\_{\mathbf{k}=1,2,\dots,\mathbf{t}} \left[ \mathbf{w}\_{\mathbf{k}} \mathbf{b}\_{\mathbf{k}} \right] \tag{17}$$

In this way, defined neurons allow to build the neural network to solve the task of the optimal safe ship trajectory.

#### 3.4.2. Structure of Neural Networks in Relation to Multistage Control

The neural network proposed in Reference [13] allows solving the task presented above. Its structure consists of alternating layers of minimum and maximum neurons. Weights values of neuron entrances are not given by learning in the ordinary sense, but result from the description the task, i.e., state transitions, fuzzy constraints, and fuzzy goals. Therefore, in order for the structure of the neural network to properly work, it is necessary to determine the connections between minimum and maximum neurons on the same layer, the maximum neurons of the preceding layer, and the minimum neurons on a current layer.

In the following, the neurons are described as


3.4.3. Generating Interconnections between Max and Min Neurons at the Same Layer

The connection of the two types of neurons from the same layer is done using the state-transitions equations, the connection function is as

$$\mathcal{W}(\mathbf{m}\_{\mathbf{k}'}^{\mathrm{i}}\mathbf{M}\_{\mathbf{k}}^{\circ}) = \begin{cases} 1 & \text{if } \mathbf{f}\_{\mathrm{N}-\mathbf{k}}(\mathbf{q}\_{\mathrm{R}}(\mathbf{m}\_{\mathbf{k}}^{\mathrm{i}}), \mathbf{q}\_{\mathrm{T}}(\mathbf{M}\_{\mathbf{k}}^{\circ})) \neq 0 \\\ 0 & \text{otherwise} \end{cases} \tag{18}$$

where qR(mi k) is the number of receptor control, qT(M<sup>i</sup> k) is the number of relay states, fN-k(.,.) is the state-transition equation. A value of 1 means there is a connection, while 0 means no connection.

#### 3.4.4. Generating Interconnections between Max Neurons and Min Neurons at the Given Layer

The combination of max neuron Mj <sup>k</sup>−<sup>1</sup> (layer k <sup>−</sup> 1) and min neuron mi <sup>k</sup> (layer k) is executed by the number of receptors qR(m<sup>i</sup> k) and the number of the relay. It allows to obtain state xN−<sup>k</sup> using the state equation, running neuron driver qC(m<sup>i</sup> k). That can be presented as the equation

$$\mathbf{q}\_{\mathbb{C}}(\mathbf{m}\_{\mathbf{k}}^{\mathrm{i}}) = \mathbf{x}\_{\mathrm{N}-\mathbf{k}} = \mathbf{f}\_{\mathrm{N}-\mathbf{k}}(\mathbf{q}\_{\mathrm{R}}(\mathbf{m}\_{\mathbf{k}}^{\mathrm{i}}), \mathbf{q}\_{\mathbb{T}}(\mathbf{M}\_{\mathbf{k}}^{\mathrm{j}})) \tag{19}$$

This driver is designed to send to all max neurons in layer (k − 1) the number of receptors qC(m<sup>i</sup> k). Neurons, which, due to the sent value, are activated, have the same value as receptor qR(Ml <sup>k</sup>−1). Just like in computer networks, between neuron mi <sup>k</sup> and M<sup>l</sup> <sup>k</sup>−1, a connection is established, which can be defined as

$$\mathbf{W}(\mathbf{M}\_{\mathbf{k}-1}^{\mathrm{l}}, \mathbf{m}\_{\mathbf{k}}^{\mathrm{i}}) = \begin{cases} 1 & \text{if } \mathbf{q}\_{\mathrm{R}}(\mathbf{M}\_{\mathbf{k}-1}^{\mathrm{l}}) = \mathbf{q}\_{\mathrm{T}}(\mathbf{m}\_{\mathbf{k}}^{\mathrm{i}}) = \mathbf{q}\_{\mathrm{C}}(\mathbf{m}\_{\mathbf{k}}^{\mathrm{i}}) \\\ 0 & \text{otherwise} \end{cases} \tag{20}$$

The connections presented in this fashion give the possibility to form an algorithm based on an artificial neural network, which will emulate solving the problem of dynamic programming in fuzzy environment, that is, the fuzzy neural anticollision (FNAC) algorithm [21].

The structure of the neural network to determine the safe ship trajectory is atypical, the network consists of six stages, in the first stage there are two layers of neurons, one max neuron and nine min neurons. The next has 9 max neurons and 32 min neurons. However, in third stage there are 25 max neurons and 38 min neurons. The penultimate stage has nine max neurons and nine min neurons. The last has one max neurons. The neurons weight result from the function state transitions and the membership function of fuzzy constraints and the membership function fuzzy goals.

Output step is to find a series of connections of maximum neurons, whose outputs have the highest value fuzzy decision μDmax.

The initialization step it is to create a neural network. As in the dynamic programming steps proceed from the latter to zero (initial).

Thus, the steps of numbering 0 (the last stage with respect to X0) to N (last step k, the first with respect to X0) initialize the first layer of neurons maximum at stage k = 0, and increase by 1 (k = 1). From this step on, in each subsequent step we first initialize the layer of minimum neurons and then the layer of maximum neurons (Figure 5).

**Figure 5.** Fuzzy neural anticollision (FNAC) algorithm block diagram.

The connection step, as the name suggests, is to combine the maximum and minimum neurons of the same stage k (Phase 1), the maximum neurons at stage k − 1, and the minimum neurons at stage k (Phase 2). The output step is to find a series of connections of maximum neurons whose outputs have the highest value, μDmax.

Of course, this is also true for control, which made it possible to obtain a value μD(u0\*, ... ., uN−1\*|X0) so there is also a connection with the minimum neurons. This time, these values are being sought in an order according to the initial state, that is x0 to xN (final state).

The initial state and the final state are single (this is related to the maneuvers of the ship). In some structures of the neural network, this may occur more than once, in the initial and final states, and, in this case, the connection may vary depending on the selection state at the initial stage.

Using the fuzzy toolbox and neural toolbox contained in the MATLAB\_R2016a software, the fuzzy neural anti-collision (FNAC) computer program was designed for the determination of the safe own-ship trajectory in a collision situation [11].

#### **4. Game Control Model of the Process**

#### *4.1. Base-Differential Game Model*

The most general description of the own ship passing j other encountered ships is the model of a differential game of moving control objects (Figure 6).

**Figure 6.** Block diagram of the basic model of differential game.

The properties of the process are described by the state equation

$$\begin{array}{llllllll}\mathbf{x}\_{\mathbf{i}} = \mathbf{f}\_{\mathbf{i}}[(\mathbf{x}\_{0,\mathfrak{\beta}\_{0'}}, \mathbf{x}\_{1,\mathfrak{\beta}\_{1'}}, \dots, \mathbf{x}\_{\mathbf{j},\mathfrak{\beta}\_{\mathbf{i}'}}, \dots, \mathbf{x}\_{\mathbf{J},\mathfrak{\beta}\_{\mathbf{l}}})\_{\mathbf{i}}\\ (\mathbf{u}\_{0,\mathfrak{\delta}\_{0'}}, \mathbf{u}\_{1,\mathfrak{\delta}\_{1'}}, \dots, \mathbf{u}\_{\mathfrak{\beta}\_{\mathfrak{\delta}\_{\mathbf{i}'}}, \dots, \mathbf{u}\_{\mathbf{J},\mathfrak{\delta}\_{\mathbf{l}}})\_{\mathbf{i}} & \mathbf{t}] \\ \mathbf{j} = 1, \ \mathbf{2}, \dots, \ \mathbf{J}\end{array} \tag{21}$$

where <sup>→</sup> x 0,β<sup>0</sup> (t) is the β<sup>0</sup> dimensional vector of the process state of the own-ship determined in a time span t ∈ [t0, tk]; → x j,β<sup>j</sup> (t) is the <sup>β</sup><sup>j</sup> dimensional vector of the process state for the j-th met ship; <sup>→</sup> u0,<sup>δ</sup><sup>0</sup> (t) is the <sup>δ</sup><sup>0</sup> dimensional control vector of the own-ship; <sup>→</sup> uj,<sup>δ</sup><sup>j</sup> (t) is the <sup>δ</sup><sup>j</sup> dimensional control vector of j-th met ship [22].

Control constraints and the state of the process are connected with the basic condition for the safe passing of the ships at a safe distance Ds in compliance with the International Regulations for Preventing Collisions at Sea (COLREGs Rules)

$$\mathbf{g}\_{\mathbf{j}}(\mathbf{x}\_{\mathbf{j},\mathfrak{k}\_{\mathbf{j}},\prime},\mathbf{u}\_{\mathbf{j},\mathfrak{k}\_{\mathbf{j}}}) \leq 0 \tag{22}$$

Goal function has the form of the payments, the integral payment and the final one

$$\mathbf{I}\_{0\mathbf{j}} = \int\_{\mathbf{0}}^{\mathbf{t}\_{\mathbf{k}}} \left[ \mathbf{x}\_{0, \mathbf{\hat{x}}\_{0}}(\mathbf{t}) \right]^{2} \mathbf{d}\mathbf{t} + \mathbf{r}\_{\mathbf{j}}(\mathbf{t}\_{\mathbf{k}}) + \mathbf{d}(\mathbf{t}\_{\mathbf{k}}) \quad \rightarrow \text{ min} \tag{23}$$

The integral payment represents the additional distance traveled by the own-ship while passing the encountered ships and the final payment determines the final collision-risk rj(tk) relative to the j ship and the final deflection of the own-ship d(tk) from the reference trajectory [23].

Two types of control goals were taken into consideration, programmed control u0(t) and positional control u0[x0(t),t]. The basis for the decision-making control are the decision-making patterns of the positional control processes, the patterns with the feedback arrangement representing the differential games.

While formulating the model of the control process, it is essential to take into consideration both the kinematics and the dynamics of the own-ship movement, the disturbances, the strategy of the encountered ships, and the assumed formula as the goal of the own-ship handling.

The diversity of selection of the possible models directly affects the synthesis of the own-ship control algorithms, which are afterwards affected by the ship-handling device, directly linked to the ARPA system and, consequently, determine the effects of safe and optimal control.

The application of reductions in the description of own-ship dynamics and the dynamics of the j-th encountered ship, and their movement kinematics, leads to the approximated model-positional and matrix.

#### *4.2. Approximate Matrix Game Model*

When leaving aside the own-ship dynamics equations, the general model of a differential game for the process of preventing collisions is reduced to the matrix game of J participants non-co-operating or co-operating among them. The state and control variables are represented by the values

$$\begin{array}{l} \mathbf{x}\_{\text{j1}} = \mathbf{D}\_{\text{j}} \colon \mathbf{x}\_{\text{j2}} = \mathbf{N}\_{\text{j}} \colon \mathbf{u}\_{01} = \boldsymbol{\upmu} \colon \mathbf{u}\_{02} = \mathbf{V} \colon \mathbf{u}\_{\text{j1}} = \boldsymbol{\upmu}\_{\text{j}} \colon \mathbf{u}\_{\text{j2}} = \mathbf{V}\_{\text{j}}\\ \mathbf{j} = 1, \ 2, \ \dots, \ \mathbf{J} \end{array} \tag{24}$$

#### *4.3. Matrix Game Anticollision (MGAC) Algorithm*

Collision matrix risk R includes the values previously determined on the basis of data taken from anticollision system ARPA; the value of collision-risk rj with regard to the determined strategies of the own-ship and those of j-th encountered ships (Figure 7).

**Figure 7.** Matrix game anticollision (MGAC) algorithm block diagram.

The form of such a game is represented by the following risk matrix

$$\mathcal{R} = [\mathbf{r}\_{\mathbf{j}}(\delta\_0, \delta\_{\mathbf{j}})] \tag{25}$$

containing the same number of columns as the number of participant O (own-ship) strategies. It has; e.g., a constant course and speed, course alteration 20◦ to starboard, 20◦ to port, etc., and contains a number of lines that correspond to a joint number of participants J (j-th encountered ships) strategies

$$\mathbf{R} = \begin{bmatrix} \mathbf{r}\_{11} & \mathbf{r}\_{12} & \dots & \mathbf{r}\_{1,\mathbf{v}\_{0}-1} & \mathbf{r}\_{1\mathbf{v}\_{0}} \\ & \mathbf{r}\_{21} & \mathbf{r}\_{22} & \dots & \mathbf{r}\_{2,\mathbf{\delta}\_{0}-1} & \mathbf{r}\_{2\mathbf{\delta}\_{0}} \\ & \dots & \dots & \dots & \dots & \dots \\ \mathbf{r}\_{\delta\_{1}1} & \mathbf{r}\_{\delta\_{1}2} & \dots & \dots & \mathbf{r}\_{\delta\_{1}\delta\_{0}-1} & \mathbf{r}\_{\delta\_{1}\delta\_{0}} \\ & \dots & \dots & \dots & \dots & \dots & \dots \\ & \mathbf{r}\_{\delta\_{1}1} & \mathbf{r}\_{\delta\_{1}2} & \dots & \dots & \mathbf{r}\_{\delta\_{1}\delta\_{0}-1} & \mathbf{r}\_{\delta\_{1}\delta\_{0}} \\ & \dots & \dots & \dots & \dots & \dots & \dots \\ & \mathbf{r}\_{\delta\_{1}1} & \mathbf{r}\_{\delta\_{1}2} & \dots & \dots & \mathbf{r}\_{\delta\_{1}\delta\_{0}-1} & \mathbf{r}\_{\delta\_{1}\delta\_{0}} \end{bmatrix} \tag{26}$$

The value of the collision-risk rj is defined as the reference of the current situation of the approach described by parameters D<sup>j</sup> min and T<sup>j</sup> min to the assumed assessment of the situation defined as safe and determined by the safe distance of approach Ds and the safe time Ts—which are necessary to execute a maneuver avoiding a collision with consideration of actual distance Dj between the own-ship and the encountered j-th ship (Figure 8)

$$\mathbf{r}\_{\parallel} = \left[ \varepsilon\_1 \left( \frac{\mathbf{D}\_{\text{min}}^{\text{j}}}{\mathbf{D}\_{\text{s}}} \right)^2 + \varepsilon\_2 \left( \frac{\mathbf{T}\_{\text{min}}^{\text{i}}}{\mathbf{T}\_{\text{s}}} \right)^2 + \varepsilon\_3 \left( \frac{\mathbf{D}\_{\text{l}}}{\mathbf{D}\_{\text{s}}} \right)^2 \right]^{-\frac{1}{2}} \tag{27}$$

**Figure 8.** Example of the dependence of collision risk on the relative values of distance and time of approaching ships.

Weight coefficients ε1, ε2, ε<sup>3</sup> are dependent on the state of visibility at sea (good or restricted), the kind of water region (open or restricted), speed V of the ship, static L, and dynamic Ld length of ship, and static B and dynamic Bd beam of ship [10]

$$\begin{cases} 0.1 \le \varepsilon\_1 \le 10 \\ 0.1 \le \varepsilon\_2 \le 10 \\ 0.1 \le \varepsilon\_3 \le 10 \end{cases} \tag{28}$$

$$\mathbf{L\_{d}} = \mathbf{1.1} \ (1 + 0.345 \ \mathbf{V}^{1.6}) \tag{29}$$

$$\mathbf{B\_{d}} = \mathbf{1.1} \text{ (B + 0.767 \text{ LV}^{0.4})}\tag{30}$$

Assuming higher values of particular weight coefficients ε1, ε<sup>2</sup> and ε3; the share of the risk of collision rj depending on the distance of ships Dj and D<sup>j</sup> min or the time of excessive approach of ships Tj min increases.

The constraints affecting the choice of strategies are a result of the recommendations of the way of priority at sea. Player O (own-ship) may use δ<sup>0</sup> of various pure strategies in a matrix game and player J (encountered ships) has δ<sup>j</sup> of various pure strategies.

As the game, most frequently does not have a saddle point, the state of balance is not guaranteed, and there is a lack of pure strategies for both players in the game. In order to solve this problem, dual linear programming may be used.

In a dual problem, player O, having δ<sup>0</sup> various strategies to be chosen, tries to minimize the risk of collision

$$\mathbf{I}\_0 = \min\_{\delta\_0} \mathbf{r}\_{\mathbf{j}} \tag{31}$$

while player J, having δ<sup>j</sup> strategies to be chosen, tries to maximize the collision-risk

$$\mathbf{J}^{\mathbf{j}} = \max\_{\boldsymbol{\delta}\_{\mathbf{j}}} \mathbf{r}\_{\mathbf{j}} \tag{32}$$

For a non-co-operative matrix game, the problem of determining an optimal strategy may be reduced to the task of solving a dual linear programming problem [24]

$$\left(\mathbf{I}\_{0}^{j}\right)^{\*} = \min\_{\delta\_{0}} \max\_{\mathcal{S}\_{j}} \mathbf{r}\_{\mathbb{I}} \tag{33}$$

For a co-operative matrix game, the problem of determining an optimal strategy may be reduced to the task of solving a dual linear programming problem

$$\left(\mathbf{l}\_0^\dagger\right)^\* = \min\_{\delta\_0} \min\_{\delta\_\mathbf{j}} \mathbf{r}\_\mathbf{j} \tag{34}$$

Mixed strategy components express probability distribution P = [pj(δ0,δj)] of players using pure strategies

$$\mathbf{P} = [\mathbf{p}\_{\mathbf{j}}(\delta\_{0}, \ \delta\_{\mathbf{j}})] = \begin{bmatrix} \mathbf{P}\_{11} & \mathbf{P}\_{12} & \cdots & \mathbf{P}\_{1,\delta\_{0}-1} & \mathbf{P}\_{1\delta\_{0}} \\ & \mathbf{P}\_{21} & \mathbf{P}\_{22} & \cdots & \mathbf{P}\_{2,\delta\_{0}-1} & \mathbf{P}\_{2\delta\_{0}} \\ & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots \\ \mathbf{P}\_{\delta\_{11}} & \mathbf{P}\_{\delta\_{12}} & \cdots & \mathbf{P}\_{\delta\_{1},\delta\_{0}-1} & \mathbf{P}\_{\delta\_{1}\delta\_{0}} \\ & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots \\ \mathbf{P}\_{\delta\_{\mathbf{j}}1} & \mathbf{P}\_{\delta\_{\mathbf{j}}2} & \cdots & \mathbf{P}\_{\delta\_{\mathbf{j}},\delta\_{0}-1} & \mathbf{P}\_{\delta\_{\mathbf{j}}\delta\_{0}} \\ & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots \\ \mathbf{P}\_{\delta\_{\mathbf{j}}1} & \mathbf{P}\_{\delta\_{\mathbf{j}}2} & \cdots & \mathbf{P}\_{\delta\_{\mathbf{j}},\delta\_{0}-1} & \mathbf{P}\_{\delta\_{\mathbf{j}}\delta\_{0}} \end{bmatrix} \tag{35}$$

The solution for the steering goal is the strategy of the highest probability and will also be the optimal value approximated to the pure strategy

$$\mathbb{P}\left(\mathbf{u}\_0^{\delta\_0}\right)^\bullet = \mathbf{u}\_0^{\delta\_0} \left\{ \left[ \mathbf{p}\_{\mathbf{j}}(\delta\_0, \delta\_{\mathbf{j}}) \right]\_{\max} \right\} \tag{36}$$

The safe trajectory of the own-ship was treated here as a sequence of changes to the course and speed. The established values are as follows: safe passing distances among the ships under given visibility conditions at sea Ds, time delay of manoeuvring and the duration of one stage of the trajectory as one calculation step. At each step, the most dangerous ship is determined with regard to the value of collision risk rj.

Consequently, on the basis of the semantic interpretation of the COLREGs, the direction of a turn of the own-ship is selected to the most dangerous encountered ship [25–27].

Collision matrix risk R is determined for the admissible strategies of the own-ship δ<sup>0</sup> and those δ<sup>j</sup> for j-th ships encountered. By applying dual linear programming in order to solve the matrix game, we obtain the optimal values of the own-ship course and those of the j-th ship at the smallest deviation from their initial values.

If, at a given step, no solution can be found at the speed of the own-ship V, the calculations are repeated at reduced speed by 25% until the game is solved.

The calculations are repeated step by step until the moment when all elements of matrix R become equal to zero, and the own-ship, after having passed the encountered ships, returns to its initial course and speed.

Using the *linprog* function, that is, linear programming from the *optimtool* optimization toolbox contained in the MATLAB\_R2017a software, the matrix game anti-collision (MGAC) computer program was designed for the determination of the safe own-ship trajectory in a collision situation [10].
