Energy Consumption Optimization for the Formation of Multiple Robotic Fishes Using Particle Swarm Optimization

: The traditional leader-follower formation algorithm can realize the formation of multiply robotic ﬁshes, but fails to consider the energy consumption during the formation. In this paper, the energy optimized leader-follower formation algorithm has been investigated to solve this problem. Considering that the acceleration of robotic ﬁsh is tightly linked to the motion state and energy consumption, we optimize the corresponding control parameters of the acceleration to reduce energy consumption during the formation via particle swarm algorithm. The whole process has been presented as follows: ﬁrstly we realize the formation on the base of the kinematic model with leader-follower formation algorithm; then the energy consumption on the base of dynamical model are derived; ﬁnally we seek the optimal control parameters based on the particle swarm optimization (PSO) algorithm. The dynamics simulation of the energy optimization scheme is conducted to verify the functionality of the proposed energy optimized leader-follower formation algorithm via MATLAB. The optimized results demonstrate that the proposed approach, reducing energy consumption during the formation, is superior to the traditional leader-follower formation algorithm and can reduce energy consumption during the formation. The novelty of the work is that we can reduce the energy consumption during the process of formation by considering the energy consumption, which is a gap in the current research ﬁeld.


Introduction
Robotic fish, defined as a fish-like aquatic vehicle, has the highly controllable fins, the large aspect ratio, the undulatory body motions and lunate tail [1]. Robotic fish can be applied in lots of fields, such as underwater exploration, aquatic monitoring, patrol, and mobile sensing [2,3]. Most of the robotic fishes consume energy that are supplied by batteries. But batteries have limited capacity. When robotic fishes conduct different assignments, they need to take on different formation and change the formation frequently. However, during the process of changing the formation, they will consume lots of energy. Therefore, how to reduce the energy consumption in the process of formation and improve the efficiency of formation , have the very high research value.
Migrating flocking, such as traditional leader-follower flocking, can be used to address the formation problems of multiple robotic fishes systems. In terms of formation flocking problems of multiple robotic fishes systems, some researches have come up with lots of methods. If some leaders have global knowledge and they lead other robotic fishes swim in a desired trajectory, the system can track a specific trajectory and realize the formation [4]. But the routine is fixed and not suitable for the real life. Later, for multi-agent dynamical systems, the distributed leader-follower algorithm has been set up [5]. Under the lead of this algorithm, robotic fishes have time-dependent velocities and the routine is not fixed. However, the leader is virtual and few formation articles have contained real leaders. Based on the consensus algorithm [4] and artificial potential field method [6], a model of distributed adaptive formation of multi-agent system has been put forward [7]. The leader is a genuine fish and has bounded unknown input. The leader can lead the followers realize the formation. Considering essential features of formation behavior, such as collision avoidance, and velocity matching [8], a distributed cohesive formation algorithm has been provided to realize the formation [9]. In this algorithm, robotic fishes are divided to two parts: one real leader and several followers. However, those formation algorithms above just realize the formation and fail to consider the energy consumption during the process of formation.
In order to predict, monitor and increase the energy of robotic fish, many researches have been conducted. On the basis of the ionic polymer-metal composite (IPMC) physical properties, in order to save energy, an energy consumption model has been set up to predict single robotic fish energy consumption [10]. A real-time energy monitoring and management system has been designed to monitor the energy consumption of the single robot fish [11]. A reversible energy conversion mechanism has been proposed, which can convert wave energy to electricity for single robotic fish [12]. Besides, an energy-saving cluster head method with fuzzy logic can be utilized to extend the single robotic fish lifetime [13]. Although those methods above can be utilized to predict, monitor and save the energy consumption of robotic fish, they are just devised for single robotic fish, rather than total energy of all the robotic fishes during the process of changing the formation. Although previous methods in literatures have been proposed to realize the formation construction of the group and decline energy consumption of single robotic fish, they involve few information about energy consumption about all the robotic fishes during the process of formation. In the process of swimming, the velocity of each robotic fish is different, and thus the energy consumption of each robotic fish differs from each other. In an attempt to reduce the energy consumption of multi-agent systems, the condition of each robotic fish should be researched in the global point of view.
The paper aims at providing a energy optimized leader-follower formation algorithm to minimize the energy consumption of multi-agent systems during the process of changing formation. Holding that the interconnection between a genuine leader and follower is unidirectional [14], and the leader does not have external control input, thus the formation is stable. Control parameters are utilized to express the acceleration equation of each robotic fish. With the different value of control parameters, the acceleration equation of each robotic fish will be different. As a result, the energy consumption will be different. Compared to the traditional distributed leader-follower formation algorithm, this paper adds new control parameters to the acceleration equation and utilizes particle swarm optimization algorithm to optimize the control parameters. Therefore, the energy consumption will be declined. The main contributions of this paper are as below: to the best of authors' knowledge, this is the first paper to discuss how to reduce the energy consumption of multi-agent system during the process of formation and propose an energy optimized leader-follower formation algorithm. Firstly, with an accurate kinematic model, we can achieve the formation and the acceleration equation including control parameters. Then, a dynamical model of the robotic fish is built to analyze the energy consumption of total robotic fish. The total energy consumption of the multi-agent systems is regarded as a function to guide the choice of control parameters. Then, under the lead of particle swarm algorithm, the control parameters of the acceleration equation can be optimized to lower total energy consumption during the process of formation. Finally, tests are performed to validate the proposed method in three kinds of formation.
The rest of this paper is organized as follows. Section 2 gives the kinematic model and dynamical model of the robotic fish, and proposes the energy optimized leader-follower formation algorithm to reduce the energy consumption of the multiple robotic fish system. And stability of the algorithm is verified. Simulation results are provided in Section 3. Section 4 provides discussion about the advantages of the algorithm and compares it with the traditional leader-follower algorithm. At the end, Section 5 renders several concluding remarks.

The Kinematic Model
When robotic fish makes the formation, we need to record the state of fish. Figure 1 shows the graphical representation of the kinematic model which helps record the process of the formation. As the Figure 1 shows, M k is regarded as the mass center while D k is regarded as the geometrical center. p k (t) = [x k (t), y k (t)] T ∈R 2 is the position vector of robotic fish k at time t, θ k (t)∈[0, 2π) is the heading angle and is measured from the x-axis in the anticlockwise rotation , is the tangential speed, and l k is the distance between D k and M k . Assume that the size of the robotic fish is the same. Every value of the l k is same and we can describe that l k = l d (k = 1, . . . , N), where l d is a positive constant. Besides, − → t k (t) and − → n k (t) are two unit vectors orthogonal to each other, and Kinematic model is adopted to describe the state of the robotic fish when realizing the formation [9]. Considering the fact that underwater communication is limited and technology for localization is not perfect, it is restricted to realize the coordination algorithms on robotic fishes. Despite that three-dimensional swimming capability about robotic fish has been researched [15], robotic fish is still modeled as unicycles swimming in a two-dimensional Euclidean space [16,17]. Because the robotic fish relies on the latter part of its body to provide force, kinematic model of fish is extended, whose mass center and geometrical center are not the same. To sum up, the kinematic model of the robotic fish k (k = 1, . . . , N) is as follows: where: a k (t) ∈ R and b k (t) ∈ R are the thrusting and rotational acceleration, respectively.
the kinematic model can be simplified:ṗ

The Dynamical Model
When robotic fishes swim in the water, they will consume much energy because they need to overcome some force. In order to analyze the resistance force, we need to create the dynamic model of robotic fish. Figure 2 shows the graphical representation of the dynamic model. On the basis of the dynamic model, the resistance force of the robotic fish can be analyzed. Then, the function W about energy consumption can be calculated. Robotic fish is regarded as an integral rigid body, at the same time, the body and tail of robotic fish can be seen as a rigid flat because of the oscillation [18]. Making use of hydrodynamic pressure equation to analyze the hydrodynamic is a good way. The hydrodynamic can be seen as the concentrated force. F 0 and F 1 are the hydrodynamic forces on the head and body of the robotic fish, respectively [19,20]. By neglecting the force of friction, the resistance force to the head of the robotic fish is:

Head
where ρ is the density of the fluid, D 0 is the resistance coefficient of the head, V 0 is the velocity of the robotic fish and A 0 is the maximum sectional area of the head.
By regarding the body as a flat, the hydrodynamic force to the body is: where D 1 is the resistance coefficient of the body. X 0 is the x−coordinate of the head. A 1 is the sectional area of the body. V c1 is the velocity perpendicular to the body. The vector of the velocity The normal vector of the body is: − → I 1 = (sinθ 10 , −cosθ 10 ). And the velocity is: Because the swing of the joints generate the hydrodynamic force to overcome the resistance of the water, the total energy consumed in one period is: The total energy consumption of all robotic fishes can be expressed and calculated. Let the total energy be a function and the particle swarm algorithms is utilized to optimize the value of the function. Figure 3 gives the graphical representation of energy consumption during the process of changing formation. In the initial stage of the experiment, robotic fishes are in a state of disorder. When the leader-follower formation algorithm performs, each robotic fish swims to the appropriate place and take on expected formation. During this process, all robotic fish will consume the energy. Each follower possesses respective input control parameter in the acceleration equation based on the leader-follower formation algorithm. The change of the control parameter will lead to the change of acceleration equation. So is the profile of each robotic fish. Therefore, the formation process will alter and the energy consumption will undulate. We can get the each proper control parameter and reduce the total energy consumption of the formation process. The solid line represents energy consumption after the optimization, while the dotted line represents energy consumption before optimization. Particle Swarm Optimization algorithm can be used to get the optimal value of control parameter, and the experimental results are verified in the simulation experiment. In order to illustrate the main work, we can see the Figure 4. A group of chaotic robotic fishes are divided into two parts: one leader and several followers. The leader takes the uniform motion and the followers take the variable motion. In the acceleration equation of followers, we add the control parameters and use the particle swarm optimization algorithm to optimize the control parameters. Finally, we can reduce the energy consumption. The energy optimized leader-followers formation algorithm will be explained in the next text.

The Leader-Follower Formation and Acceleration Equation
The leader has external control input and is set L = {1} while the follower does not have and is set F = {2, . . . , N}. Supposing that for a follower, interconnection with the follower is bidirectional, while interconnection with the leader is unidirectional [14]. N k (t) represents the neighbor set of follower k ∈ F at time t, and is defined initially as N k (0) = n = p k (0) − q n (0) < D, n = 1, . . . , N, n ≡ k . D > 0 is a constant, and • is the Euclidean norm. Consider the leader k(k = 1) swims at a constant speed, the thrusting acceleration a 1 (t) and rotational acceleration b 1 (t) are equal to zero.
The control input of the follower k(k = 2, . . . , N) can be designed by: where c k is the control parameter.ω The acceleration equation is consisted of two parts. The specific potential function is [7]: Definition 1. Definition 1: V( p kn ) is a potential function of the Euclidean norm p kn between agent k and n. This potential function is radially unbounded, nonnegative, differentiable, such that: When When p kn is equal to a certain value between 0 and 2D, V( p kn ) is located in its unique minimum.
When potential V( p kn ) reaches its unique minimum, the formation can be completed. In order to verify the existence of potential V( p kn ). A potential function can be made [9]. Specific potential V( p kn ) is: The gradient of the potential function is: where a, b and c are positive number.  [21]. So, the formation can be finished.

Optimization of Control Parameter
Each acceleration equation of follower has respective control parameter C k , which can alter the movement condition of corresponding robotic fish at time t. When C k has different values, the value of the acceleration will be different. As a result, the velocity and route of the robotic fish will be changed. So, energy consumption of the formation will be changed. In order to reduce the energy consumption, particle swarm optimization can be utilized to optimize the parameter C k .
The Particle Swarm Optimization algorithm was proposed in 1995, which combined with the process of the study of swarm intelligence and human [22]. In an E-dimensional optimization space, the swarm is composed of N particles named N = (n 1 , . . . , n N ). Each particle k is an E-dimensional vector, whose position and velocity are respectively expressed with X k = (X k1 , . . . , X kE ) T and V k = (V k1 , . . . , V kE ) T . The individual optimal position is stored with p i = (P k1 , . . . , P kE ) T while the global optimal position is stored with P g = (P g1 , . . . , P gE ) T . The position and velocity of each particle k are updated by: where W max is the maximum value of W and W min is the minimum value. h and h max indicate the current and maximum iterations, respectively. According to the principle of particle swarm optimization, and the instance of distributed formation flocking algorithm, control parameter C k is regarded as the variable while the total energy consumption in the process of robotic fish formation is regarded as the function. The relation between variable and function is built by formation algorithm and power consumption algorithm. Figure 5 shows the process of the particle swarm algorithm.
Step one: Initialize the size of the population. Presuppose the size of the population N = 30. Because there are ten robotic fishes for formation and parameter C k varies from individual to individual, parameter C k is a ten-dimensional vector. considering that parameter C k has scope limitation, we initialize the position X kd and velocity V kd of each particle k in a certain range.
Step two: Calculate the function as follows, according to the relationship between the parameter C k and energy loss. Firstly, calculate the fitness value(f(X kd (t)) of each particle in the population; Then, calculate the individual optimal position p k of each particle in the current moment; Finally, calculate the global optimal position p g of robotic fish system in the current moment.
Step three: Calculate and update the velocity and position of the particle. Because parameter C k is in a range, the velocity and position of the particle should also be in a range. The velocity shouldn't be greater than maximum velocity V max . Otherwise, the velocity will be replaced with maximum velocity V max . In the same way, if the position updated of the particle is beyond the range of C k , the position should be replaced with boundary value of C k .
Step four: Compare the current fitness value of each particle with the optimal value of individual fitness. P k should be replaced with the better one.
Step five: Compare the current fitness value of each particle with the optimal value of global fitness. P g should be replaced with the better one.
Step six: If the precision meets the requirement or the number of iteration reaches the maximum, the algorithm will be stopped. Otherwise the circulation should return to the step two.

The Proof of the Stability
It is defined thatθ(t) = (θ 2 (t), . . . ,θ N (t)) T ,q(t) = [q 2 (t) T , . . . ,q N (t) T ] T , as while as p(t) = [p 11 (t) T , . . . ,p 1N (t) T , . . . ,p N1 (t) T , . . . ,p NN (t) T ] T . Make N l = k a k1 = 1, k ∈ F denote the set of followers who has one leader neighbor on time interval [t r , t r+1 ). Let the following energy function as the common Lyapunov function [7]. If the value of derivative is less than zero, the energy optimized leader-follower formation algorithm is stable. Therein: where: C k is the control parameter and the constants that are in a range. The derivative of E(θ(t),q(t),p(t)) during the time interval [t r , t r+1 ) is: Consider parameter C k is a constant that is in a range, E 4 (t) is a constant, in which case, dE 4 dt is equal to zero. So: Because that dE dt ≤ 0 and thus, the distributed formation flocking optimization algorithm asymptotically is stable [9].
When the potential energy reaches a minimum value, the individual distance of the system reaches a stable value. Therefore, if we can ensure the system's potential energy reaches a minimum value when the individual distance of the system reaches a expected value, we can realize any formation we want. For one geometry formation, it is composed of N vertexes which are built by the regular In order to realize the expected formation, the acceleration equation of the followers should be changed as follow: where p kn (t) = p kn (t) p d kn , when the robotic fish system realizes a stable formation, potential function V( p kn (t) ) = 1.

Results
In order to evaluate to the proposed optimization scheme reducing energy consumption during the formation, dynamic simulations are conducted on MATLAB2018b. Initial conditions of each robotic fish are built. The simulation time is 200 s while the sample step is 0.01 s. we can express the state of the robotic fish at time t with S k (t) = (x k (t), y k (t), θ(t), v k (t), ω k (t)). The units of components are m, m, rad, m/s, rad/s respectively. Give the initial conditions:

The Change of W max
A linear decrease strategy about W can improve the ability of optimization [23]. When W is given different values, different results for optimization will be produced. In the beginning of particle swarm algorithm, the larger inertia weight is, the stronger ability of global search is. As time goes on, the smaller inertia weight is, the stronger ability of local search is. Let W min is equal to 0.5, and add 0.1 every time. Make W max − W min = 1. Table 1 shows that the value of C i and total energy consumption vary from different W max in the lambdoid-shaped formation. When W max is equal to 0.8, the total energy consumption in the formation is the minimum. In the beginning, the value of W max is 0.8, the ability of global search is strong to explore more value of control parameter. As time goes, the value of W max declines, and the ability of local search become stronger. Thus, particle swarm algorithm can select the appropriate value. Under the given initial conditions, when C k = (1.3, 1.3, 0.6608, 1.3, 1.3, 0.7657, 0.6, 1.3, 1.8738), k = 2, . . . , 10, ten robotic fishes consume the least energy.  Table 2 demonstrates that the value of C k and total energy consumption vary between different W max in the ring-shaped formation. When W max is equal to 0.7, the total energy consumption of ten robotic fishes in the formation is the minimum. When the value of W max is 0.7, the ability of global search and local search can be balanced well. As a result, the algorithm can find more suitable value of control parameter. Under the given initial conditions, when C k = (0.74, 0.6, 0.9041, 1.3, 1.3, 0.74, 0.74, 0.74, 0.74), k = 2, . . . , 10, ten robotic fishes consume the least energy.  Table 3 shows that the value of C k and total energy consumption vary from different W max in the rectangle-shaped formation. When W max is equal to 0.6, the total energy consumption of ten robotic fishes is the minimum. when C k = (1.2075, 1.3, 0.8908, 0.7156, 1.055, 1.3, 0.6534, 1.3, 1.3), k = 2, . . . , 10, ten robotic fishes consume the least energy.

Discussion
Different formation has different set of C k . To better illustrate the proposed optimization algorithm, the optimized energy is compared with the energy without optimization(fixed value).The experiment is finished in the computer whose motherboard is Z270 and CPU is i7-7700. Table 4 shows the value of C k of three kinds of formation before and after optimization. Table 4 indicates comparison of total energy consumption of three kinds of formation. Make ten fishes as a whole. Each formation consumes a corresponding energy under three different kinds of parameters C k . Compare the three cases of energy, and Table 4 shows that the whole fishes in the three kinds of formation consume the least energy in which case that parameter C k is optimized. Lambdoid-shaped formation gets best energy optimization. During the process of formation, because the control parameters are optimized, the corresponding robotic fish will choose the better routine and consume little energy to finish the formation. To sum up, when ten robotic fishes conduct only one formation from the very beginning, the proposed algorithm can succeed to optimize the total energy consumption. However, as we can see from the Table 4, optimal control parameters of different formations are different. If we want to get each formations with least energy consumption, we need to choose different set of control parameters. This is the disadvantage of our algorithm. We cannot get the same value of control parameters to finish different formation. Besides, power of ten agents in the formation can be simulated. Figure 6 demonstrates the power of ten agents in the ring-shaped formation. Figure 6b shows that when the control parameters are optimized, the whole fishes will quickly end the energy fluctuation period, and will finish the formation with the steady energy consumption. So, the formation will be completed quickly. Figure 7 indicates the power of ten agents in the rectangle-shaped formation. The two curves are similar. The time when formation transits to the smooth energy consumption is similar. However, before formation, the energy is consumed a little more. Figure 8 shows the power of ten agents in the lambdoid-shaped formation. Although the volatility is larger after optimizing control parameter, finishing time is shorter. thus, the energy consumption is reduced. Figure 9 shows the finishing time in three kinds of situation. This indicates that the proposed algorithm not only reduces the energy consumption in the process of formation, but also shorten the formation time.     Nowadays, we are trying to build the experimental platform to do do the experiment in a real world. We are using hardware such as STM32F407 and software such as Keil to build platform. In the future, we will build up a more general swimming model of the robotic fish by considering the complex stress. In addition, we will take the task to seek general control parameter to adapt to different formation transformation.

Conclusions
Nowadays, few papers focus on the energy consumption of total multi-agent during the formation. Our work can fill in this gap. This paper has presented an application of PSO to optimize the control parameters C k s to efficiently reduce energy consumption during the formation. Although that not all formation algorithms have C k s, each algorithm has control parameters that control the movement of agents. Although different formations have different control parameter, we can choose different optimal parameters by using particle swarm optimization algorithm to finish the formation with lower energy consumption. After optimizing the control parameter, individual robotic fish has their own suitable parameters and they will choose perfect routine to finish their formation. Besides, finishing time will be shorter.