Disclosure of Invention
Aiming at the problems in the prior art, the invention improves the basic firefly algorithm and provides a path planning method based on the multi-target firefly algorithm. The method provided by the invention is distinguished from the prior method by the following remarkable characteristics: firstly, based on a concept governed by Pareto, a basic firefly algorithm is improved by combining an information sharing mechanism of FA, so that the problem of multi-objective optimization can be directly solved, and the global search and parallel computing capability of the firefly algorithm is well utilized; secondly, aiming at the multi-target path planning problem, the invention considers a plurality of path performance indexes in the planning at the same time, and can obtain a group of Pareto optimal solution sets by one-time planning, thereby having great flexibility. The path planning method is different from the traditional path planning method aiming at a single target and the path planning method for converting multiple targets into a single target by adopting a weighting method, and can better meet the actual requirement of path planning.
A path planning method based on a multi-target firefly algorithm is characterized by comprising the following steps: the method specifically comprises the following steps:
the method comprises the following steps: performing mathematical modeling on a path planning problem:
(1) mathematically modeling the environment of the path plan:
and planning a path in a two-dimensional plane, wherein S is a departure point of the robot, G is an end point, a global coordinate system O-XY is established in a path planning range, and if n path points form a path, the path is expressed as P ═ S, P1,p2,...,pnG }, wherein (p)1,p2,...,pn) A sequence of path points in the global map, a target for path planning;
in the global coordinate system O-XY, the coordinates of the path point sequence are two-dimensional, and in order to reduce the length of the code, a coordinate system S-X 'Y' is established, taking the starting point S as the origin of the coordinate system and taking the starting point S as the origin of the coordinate system
Taking the X ' axis and the ray which is perpendicular to the X ' and passes through the S point as the Y ' axis, the corresponding coordinate transformation is:
<math>
<mrow>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<msup>
<mi>x</mi>
<mo>′</mo>
</msup>
</mtd>
</mtr>
<mtr>
<mtd>
<msup>
<mi>y</mi>
<mo>′</mo>
</msup>
</mtd>
</mtr>
</mtable>
</mfenced>
<mo>=</mo>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<mi>cos</mi>
<mi>θ</mi>
</mtd>
<mtd>
<mo>-</mo>
<mi>sin</mi>
<mi>θ</mi>
</mtd>
</mtr>
<mtr>
<mtd>
<mi>sin</mi>
<mi>θ</mi>
</mtd>
<mtd>
<mi>cos</mi>
<mi>θ</mi>
</mtd>
</mtr>
</mtable>
</mfenced>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<mi>x</mi>
</mtd>
</mtr>
<mtr>
<mtd>
<mi>y</mi>
</mtd>
</mtr>
</mtable>
</mfenced>
<mo>+</mo>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<msub>
<mi>x</mi>
<mi>s</mi>
</msub>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mi>y</mi>
<mi>s</mi>
</msub>
</mtd>
</mtr>
</mtable>
</mfenced>
</mrow>
</math>
wherein (X, Y), (X ', Y ') are respectively the coordinates of a certain point in the map under coordinate systems O-XY and S-X ' Y ', theta is the included angle between coordinate axis X and coordinate axis X ', (X, Y), (X ', Y ') are the included angles between coordinate axis X and coordinate axis Xs,ys) Is the coordinate of the S point under a coordinate system O-XY;
dividing the line segment SG into n +1 equal parts, making a perpendicular line at each equal division point to obtain a parallel straight line family (l)1,l2,...,ln) The intersection point of the parallel straight line family and the path P to be determined is a target path point sequence (P)1,p2,...,pn) (ii) a Defining S as a starting Path Point p0G is a termination path point pn+1A candidate path is represented as a set of available path points P ═ P (P)0,p1,p2,...,pn,pn+1) The purpose of path planning is to find n path points (p) beyond the starting point and the end point1,p2,...,pn);
Due to the family of parallel lines (l)
1,l
2,...,l
n) Distance between adjacent straight linesThe abscissa of the path point in the S-X 'Y' coordinate system is determined according to the serial number of the path point in the path point set, the ordinate is initialized to be a random number in the working area and is a part to be optimized, and therefore, for a path point with the serial number i, the abscissa of the path point in the S-X 'Y' coordinate system is determined
And ordinate
Respectively expressed as:
<math>
<mfenced open='{' close=''>
<mtable>
<mtr>
<mtd>
<msubsup>
<mi>x</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>=</mo>
<mi>i</mi>
<mo>·</mo>
<mfrac>
<msub>
<mi>L</mi>
<mi>SG</mi>
</msub>
<mrow>
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</mfrac>
</mtd>
</mtr>
<mtr>
<mtd>
<msubsup>
<mi>y</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>=</mo>
<mi>rand</mi>
<mrow>
<mo>(</mo>
<msubsup>
<mi>Y</mi>
<mi>min</mi>
<mo>′</mo>
</msubsup>
<mo>,</mo>
<msubsup>
<mi>Y</mi>
<mi>max</mi>
<mo>′</mo>
</msubsup>
<mo>)</mo>
</mrow>
</mtd>
</mtr>
</mtable>
</mfenced>
</math>
wherein,
respectively representing the abscissa value and the ordinate value of the path point with the serial number i in an S-X 'Y' coordinate system; l is
SGIs the distance between the starting point S and the target point G,
and
respectively a minimum value and a maximum value of the ordinate,
is shown in
Random numbers are uniformly distributed throughout the course of administration.
(2) Three evaluation functions of the path are determined, and the path length, the path smoothness and the path safety are respectively measured:
let any feasible path be P ═ P (P)0,p1,p2,...,pn,pn+1) Then, 3 performance indicators of the multi-goal path planning problem are defined as follows:
(1) path length f1(P)
For one path P ═ P0,p1,p2,...,pn,pn+1) The system consists of n +1 path sections, and the length of the path is the sum of the lengths of the n +1 path sections;
<math>
<mrow>
<msub>
<mi>f</mi>
<mn>1</mn>
</msub>
<mrow>
<mo>(</mo>
<mi>P</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>0</mn>
</mrow>
<mi>n</mi>
</munderover>
<mo>|</mo>
<msub>
<mi>p</mi>
<mi>i</mi>
</msub>
<msub>
<mi>p</mi>
<mrow>
<mi>i</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>|</mo>
<mo>=</mo>
<mo>|</mo>
<msub>
<mi>p</mi>
<mn>0</mn>
</msub>
<msub>
<mi>p</mi>
<mn>1</mn>
</msub>
<mo>|</mo>
<mo>+</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>n</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
</munderover>
<msqrt>
<msup>
<mrow>
<mo>(</mo>
<msubsup>
<mi>y</mi>
<mrow>
<mi>i</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mo>′</mo>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>y</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mrow>
<mo>(</mo>
<msubsup>
<mi>x</mi>
<mrow>
<mi>i</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mo>′</mo>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>x</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</msqrt>
<mo>+</mo>
<mo>|</mo>
<msub>
<mi>p</mi>
<mi>n</mi>
</msub>
<msub>
<mi>p</mi>
<mrow>
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>|</mo>
</mrow>
</math>
wherein i represents the sequence number of the path point; | p
ip
i+1I denotes a Path Point p
iAnd a path point p
i+1The length of the path segment between;
and
respectively representing the abscissa value and the ordinate value of the path point with the serial number of i +1 in an S-X 'Y' coordinate system;
and
respectively represent the abscissa value and the ordinate value of the path point with the serial number i in the S-X 'Y' coordinate system,
and
respectively representing the abscissa value and the ordinate value of the path point with the serial number of i +1 in an S-X 'Y' coordinate system; | p
0p
1I denotes a Path Point p
0And a path point p
1The length of the path segment in between.
(2) Path smoothness f2(P)
Each path section is taken as a vector, the included angle between the vector and the X' axis is calculated according to the slope, the included angle is taken as a path direction angle, the difference value of the direction angles of two adjacent path sections is calculated, and the deflection angle alpha is obtainediThe smoothness of the path is described by the magnitude of the deflection angle:
<math>
<mrow>
<msub>
<mi>f</mi>
<mn>2</mn>
</msub>
<mrow>
<mo>(</mo>
<mi>P</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mfrac>
<mrow>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<msub>
<mi>α</mi>
<mi>i</mi>
</msub>
<mo>+</mo>
<mi>k</mi>
<mo>×</mo>
<mi>π</mi>
<mo>/</mo>
<mn>2</mn>
</mrow>
<mi>n</mi>
</mfrac>
</mrow>
</math>
f2(P) is the mean angle of rotation, α, of path Pi(i ═ 1, 2.. n) denotes two vectors pi-1piAnd pipi+1Included angle (0 ≤ alpha)i< π); n is the number of included angles between adjacent path segment vectors in n +1 path segments; k is alphaiWhen a certain included angle is larger than or equal to pi/2, punishing a target value;
(3) path safety distance f3(P)
The safety degree is a distance between the robot and the obstacle, and if the mobile robot is large in size, the mobile robot cannot be regarded as a mass point, and a certain path safety distance f is kept between the mobile robot and the obstacle to prevent a certain part of the mobile robot from colliding with the obstacle3(P):
Wherein d represents the shortest distance of the path P from all obstacles;
(4) punishment of non-feasible paths
According to whether the path can collide with an obstacle or not, dividing the path into a feasible path and an infeasible path, judging whether one path is the feasible path or not, giving one path to judge the intersection information of the path and the environment, setting the obstacle as a polygon, and describing the obstacle by a group of vertex coordinates, so that the intersection information of each path segment and each edge of the obstacle is calculated to obtain the intersection information of the whole path and the obstacle;
in order to ensure that the objective function value of each infeasible path is larger than the fitness value of all feasible paths, when the objective function value of the infeasible path is calculated, a penalty value is added, and for the infeasible paths, the three objective function values are calculated as follows:
fi(P)=Wi+m×Ci,i=1,2,3
wherein, WiAt the objective function f for all feasible pathsiThe worst value of (d); m is the number of the sections of the non-feasible path in the non-feasible path P; ciIs a penalty factor;
step two: initializing a multi-target firefly algorithm:
firstly, initializing parameters of a multi-target firefly algorithm: group size N, external archive size NaAnd the maximum number of iterations Tmax(ii) a Initializing the positions of fireflies, wherein each firefly represents an alternative path, and each dimension component of a firefly position vector sequentially represents the longitudinal coordinate of each path point on the alternative path through simplification of a pair of path codes in the steps. Initializing the initial position of the firefly in a search space randomly, wherein if n path points are determined, the position vector of the firefly is an n-dimensional vector;
step three: updating the position of the firefly and determining a non-inferior solution set:
in FA, fireflies realize information sharing by luminescence, the brightness is adopted to distinguish the quality of a solution represented by the fireflies, the fireflies with high brightness attract the fireflies with low brightness to move towards the fireflies, so that the whole population moves towards a better area, an objective function value of the position of the fireflies is defined as the brightness of the fireflies, the brightness of the fireflies in FA is distinguished by adopting a concept governed by Pareto, and meanwhile, the fireflies are guided to continuously move towards the better area by combining an information sharing mechanism of FA;
pareto governs:
in the multi-objective problem of solving the minimum value of the objective function, X is set as a feasible solution set of the multi-objective optimization problem,
in order to design the variables of the design,
for the objective function to be optimized, then
<math>
<mrow>
<mi>F</mi>
<mrow>
<mo>(</mo>
<mi>x</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mrow>
<mo>(</mo>
<msub>
<mi>f</mi>
<mn>1</mn>
</msub>
<mrow>
<mo>(</mo>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</mrow>
<mo>,</mo>
<msub>
<mi>f</mi>
<mn>2</mn>
</msub>
<mrow>
<mo>(</mo>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</mrow>
<mo>,</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>,</mo>
<msub>
<mi>f</mi>
<mi>m</mi>
</msub>
<mrow>
<mo>(</mo>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</mrow>
<mo>)</mo>
</mrow>
</mrow>
</math> In order to be the target vector,
<math>
<mrow>
<mo>∀</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>k</mi>
</msub>
<mo>∈</mo>
<mi>X</mi>
<mo>,</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>l</mi>
</msub>
<mo>∈</mo>
<mi>X</mi>
<mo>.</mo>
</mrow>
</math> if and only if
<math>
<mrow>
<mo>∀</mo>
<mi>i</mi>
<mo>∈</mo>
<mo>{</mo>
<mn>1,2</mn>
<mo>,</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>,</mo>
<mi>m</mi>
<mo>}</mo>
<mo>:</mo>
<msub>
<mi>f</mi>
<mi>i</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>k</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>≤</mo>
<msub>
<mi>f</mi>
<mi>i</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>l</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>,</mo>
</mrow>
</math> And is
<math>
<mrow>
<mo>∃</mo>
<mi>j</mi>
<mo>∈</mo>
<mo>{</mo>
<mn>1,2</mn>
<mo>,</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>,</mo>
<mi>m</mi>
<mo>}</mo>
<mo>:</mo>
<msub>
<mi>f</mi>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>k</mi>
</msub>
<mo>)</mo>
</mrow>
<mo><</mo>
<msub>
<mi>f</mi>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>l</mi>
</msub>
<mo>)</mo>
</mrow>
</mrow>
</math> At first, call
Dominating
Pareto optimal solution:
if no other solution x' Pareto dominates x does not exist in the whole feasible solution set of the multi-objective optimization problem, the solution x is called as a Pareto optimal solution of the problem;
pareto optimal solution set:
the method comprises the steps that a set of all Pareto optimal solutions of a multi-objective optimization problem forms a Pareto optimal solution set of the problem;
the specific method for updating the firefly position and determining the non-inferiority set comprises the following steps:
firstly, sequentially substituting the position vectors of all fireflies into three objective functions of path length, path smoothness and path safety, judging whether the path is feasible, punishing an infeasible path, and obtaining the objective function vector corresponding to each firefly;
for any two fireflies in the population, judging a Pareto domination relationship between the fireflies based on a Pareto domination concept, if a certain firefly iPaareto dominates firefly j, indicating that the path represented by i is more optimal, j is attracted by i to update the position of the firefly, wherein the position updating formula is as follows:
<math>
<mrow>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>+</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
<mo>=</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>)</mo>
</mrow>
<mo>+</mo>
<msub>
<mi>β</mi>
<mi>ij</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mo>)</mo>
</mrow>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>i</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>)</mo>
</mrow>
<mo>-</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>)</mo>
</mrow>
<mo>)</mo>
</mrow>
<mo>+</mo>
<mi>α</mi>
<msub>
<mover>
<mi>ϵ</mi>
<mo>→</mo>
</mover>
<mi>i</mi>
</msub>
</mrow>
</math>
wherein t is the number of iterations;
the spatial positions of fireflies i and j; alpha is constant, and alpha is selected to be [0,1 ]],
Is a random number vector;
βij(rij) The attraction of firefly i to firefly j is defined as:
<math>
<mrow>
<msub>
<mi>β</mi>
<mi>ij</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>=</mo>
<msub>
<mi>β</mi>
<mn>0</mn>
</msub>
<msup>
<mi>e</mi>
<mrow>
<mo>-</mo>
<mi>γ</mi>
<msup>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mn>2</mn>
</msup>
</mrow>
</msup>
<mo>,</mo>
</mrow>
</math>
<math>
<mrow>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mo>=</mo>
<mo>|</mo>
<mo>|</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>i</mi>
</msub>
<mo>-</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mo>|</mo>
<mo>|</mo>
<mo>=</mo>
<msqrt>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<msup>
<mrow>
<mo>(</mo>
<msub>
<mi>x</mi>
<mrow>
<mi>i</mi>
<mo>,</mo>
<mi>k</mi>
</mrow>
</msub>
<mo>-</mo>
<msub>
<mi>x</mi>
<mrow>
<mi>j</mi>
<mo>,</mo>
<mi>k</mi>
</mrow>
</msub>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</msqrt>
</mrow>
</math>
wherein beta is
0For maximum attraction, gamma is the light absorption coefficient, r
ijIs the distance from firefly i to firefly j, and n is the firefly position vector
Dimension of (d), x
i,kAs firefly i position vector
Component of the k-th dimension, x
j,kAs the firefly j position vector
The k-th dimension component of (a). In the process of realizing the iteration, the fireflies which are not governed by any other fireflies are saved as a non-inferior solution set of the iteration;
step four: and updating the external archive file.
Adopting an external archive file to store all paths with better performance obtained in the iteration process, wherein the external archive file is empty initially, and updating the external archive file by using a non-inferior solution set generated by each generation in the three steps along with the iteration process, wherein the update strategy of the archive file is as follows: for each non-inferior solution in the non-inferior solution set, if the non-inferior solution is governed by a member of the archive, rejecting the non-inferior solution to join the archive; if the non-inferior solution dominates part of the members of the archive, removing those dominated members, and adding the non-inferior solution to the archive; if all members in the non-inferior solution and the archive are not dominated by each other, directly adding the non-inferior solution into the archive;
limiting the size of the file, deleting partial non-inferior solutions in the file when the size of the file is a preset upper limit, and deleting partial non-inferior solutions in the file when the size of the file exceeds a preset maximum size NaIn the method, the method for deleting the excessive non-inferior solutions in the archive file comprises the following steps: calculating the density of the neighborhood of all individual file members, ordering from small to large, and reserving N with the minimum neighborhood densityaEach archive member, and other members delete from the archive file;
for the definition of the density of the individual neighborhood, the PAES algorithm defines the density of the individual neighborhood by adopting a self-adaptive grid method, specifically: dividing the search space into a plurality of grids, wherein the neighborhood density of an individual is defined as the number of all individuals in the same grid with the individual, the division of the grids is adaptively changed along with the change of members of an external archive file, and when the individual inserted into the archive is positioned outside the existing boundary of the grids, the grids are divided again;
step five: judging whether the preset maximum iteration number is reached:
if the maximum iteration number set in the step two is reached, turning to a step six; otherwise, go to step three;
step six: determining a Pareto optimal path, and finishing path planning:
and outputting a non-inferior solution set in the external archive file to obtain a set of Pareto optimal paths, and selecting one Pareto optimal path as a path planning result according to actual problem requirements.
The invention has the advantages that:
firstly, the method for path planning based on the multi-target firefly algorithm provided by the invention improves the firefly algorithm and provides the multi-target firefly algorithm. The algorithm can solve the problem of multi-target optimization, is simpler and easier to implement than the classical multi-target evolutionary algorithm and the multi-target particle swarm algorithm, and has universality.
Secondly, the multi-target firefly algorithm based path planning method provided by the invention adopts the multi-target firefly algorithm to solve the path planning problem of simultaneously considering a plurality of performance indexes, can provide a reasonable Pareto optimal solution for a decision maker, and meets the requirement of an actual problem.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings.
The invention provides a path planning method based on a multi-target firefly algorithm, which specifically comprises the following steps as shown in figure 1:
the method comprises the following steps: the path planning problem is mathematically modeled.
(1) The environment of the path plan is mathematically modeled.
As shown in fig. 2, path planning is performed in a two-dimensional plane, S is a starting point of the robot, and G is an end point. And establishing a global coordinate system O-XY in the path planning range, and representing the obstacles by using objects filled with black solids. Path planning of the robot is to find a set of path points, and assuming that n path points form a path, the path may be represented as P ═ S, P1,p2,...,pnG }, wherein (p)1,p2,...,pn) A sequence of waypoints in the global map, i.e. a goal of the path plan. The requirement for a waypoint is that the waypoint is a non-obstacle point and that no obstacle point exists on a connection line with an adjacent waypoint.
In the global coordinate system O-XY, the coordinates of the sequence of path points are two-dimensional, and in order to reduce the length of the code, a new coordinate system S-X 'Y' is established. Using the starting point S as the origin of the coordinate systemThe X ' axis is taken, and the ray perpendicular to X ' and passing through the point S is taken as the Y ' axis. The corresponding coordinate transformation is:
<math>
<mrow>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<msup>
<mi>x</mi>
<mo>′</mo>
</msup>
</mtd>
</mtr>
<mtr>
<mtd>
<msup>
<mi>y</mi>
<mo>′</mo>
</msup>
</mtd>
</mtr>
</mtable>
</mfenced>
<mo>=</mo>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<mi>cos</mi>
<mi>θ</mi>
</mtd>
<mtd>
<mo>-</mo>
<mi>sin</mi>
<mi>θ</mi>
</mtd>
</mtr>
<mtr>
<mtd>
<mi>sin</mi>
<mi>θ</mi>
</mtd>
<mtd>
<mi>cos</mi>
<mi>θ</mi>
</mtd>
</mtr>
</mtable>
</mfenced>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<mi>x</mi>
</mtd>
</mtr>
<mtr>
<mtd>
<mi>y</mi>
</mtd>
</mtr>
</mtable>
</mfenced>
<mo>+</mo>
<mfenced open='[' close=']'>
<mtable>
<mtr>
<mtd>
<msub>
<mi>x</mi>
<mi>s</mi>
</msub>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mi>y</mi>
<mi>s</mi>
</msub>
</mtd>
</mtr>
</mtable>
</mfenced>
</mrow>
</math>
wherein: (X, Y), (X ', Y') are respectively the coordinates of a certain point in the map under coordinate systems O-XY and S-X 'Y', theta is the included angle between coordinate axis X and coordinate axis X ', (X, Y), (X', Y ') are the included angles between coordinate axis X and coordinate axis X')s,ys) Is the coordinate of the S point under the coordinate system O-XY.
Dividing the line segment SG into n +1 equal parts, making a perpendicular line at each equal division point to obtain a parallel straight line family (l)1,l2,...,ln) Their intersection points with the path P to be determined are the target path point sequence (P)1,p2,...,pn). Defining S as a starting Path Point p0G is a termination path point pn+1Such a candidate path is represented as a set of available path points P ═ P (P)0,p1,p2,...,pn,pn+1). The purpose of path planning is to find n path points (p) beyond the starting point and the end point1,p2,...,pn)。
Due to the family of parallel lines (l)
1,l
2,...,l
n) The distances between adjacent straight lines are the same, so the abscissa of the path points in the S-X 'Y' coordinate system can be determined according to the serial numbers of the path points in the path point set, and the ordinate can be initialized to beAnd the random number in the working area is the part to be optimized. Thus, for a certain path point with index i, its abscissa in the S-X 'Y' coordinate system
And ordinate
Can be expressed as:
<math>
<mfenced open='{' close=''>
<mtable>
<mtr>
<mtd>
<msubsup>
<mi>x</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>=</mo>
<mi>i</mi>
<mo>·</mo>
<mfrac>
<msub>
<mi>L</mi>
<mi>SG</mi>
</msub>
<mrow>
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</mfrac>
</mtd>
</mtr>
<mtr>
<mtd>
<msubsup>
<mi>y</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>=</mo>
<mi>rand</mi>
<mrow>
<mo>(</mo>
<msubsup>
<mi>Y</mi>
<mi>min</mi>
<mo>′</mo>
</msubsup>
<mo>,</mo>
<msubsup>
<mi>Y</mi>
<mi>max</mi>
<mo>′</mo>
</msubsup>
<mo>)</mo>
</mrow>
</mtd>
</mtr>
</mtable>
</mfenced>
</math>
thus, the two-dimensional coding of the path planning problem is simplified into one dimension.
Wherein,
respectively representing the abscissa value and the ordinate value of the path point with the serial number i in an S-X 'Y' coordinate system; l is
SGIs the distance between the starting point S and the target point G,
and
respectively a minimum value and a maximum value of the ordinate,
is shown in
Random numbers are uniformly distributed throughout the course of administration.
(2) Three evaluation functions of the path are determined, and the path length, the path smoothness and the path safety are measured respectively.
Let any feasible path be P ═ P (P)0,p1,p2,...,pn,pn+1) Then, 3 performance indicators of the multi-goal path planning problem are defined as follows:
(1) path length f1(P)
For one path P ═ P0,p1,p2,...,pn,pn+1) And consists of n +1 path segments, and the length of the path is the sum of the lengths of the n +1 path segments.
<math>
<mrow>
<msub>
<mi>f</mi>
<mn>1</mn>
</msub>
<mrow>
<mo>(</mo>
<mi>P</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>0</mn>
</mrow>
<mi>n</mi>
</munderover>
<mo>|</mo>
<msub>
<mi>p</mi>
<mi>i</mi>
</msub>
<msub>
<mi>p</mi>
<mrow>
<mi>i</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>|</mo>
<mo>=</mo>
<mo>|</mo>
<msub>
<mi>p</mi>
<mn>0</mn>
</msub>
<msub>
<mi>p</mi>
<mn>1</mn>
</msub>
<mo>|</mo>
<mo>+</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>n</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
</munderover>
<msqrt>
<msup>
<mrow>
<mo>(</mo>
<msubsup>
<mi>y</mi>
<mrow>
<mi>i</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mo>′</mo>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>y</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mrow>
<mo>(</mo>
<msubsup>
<mi>x</mi>
<mrow>
<mi>i</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mo>′</mo>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>x</mi>
<mi>i</mi>
<mo>′</mo>
</msubsup>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</msqrt>
<mo>+</mo>
<mo>|</mo>
<msub>
<mi>p</mi>
<mi>n</mi>
</msub>
<msub>
<mi>p</mi>
<mrow>
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msub>
<mo>|</mo>
</mrow>
</math>
Wherein i represents the sequence number of the path point; | p
ip
i+1I denotes a Path Point p
iAnd a path point p
i+1The length of the path segment between;
and
respectively representing the abscissa value and the ordinate value of the path point with the serial number of i +1 in an S-X 'Y' coordinate system;
and
respectively represent the abscissa value and the ordinate value of the path point with the serial number i in the S-X 'Y' coordinate system,
and
respectively representing the abscissa value and the ordinate value of the path point with the serial number of i +1 in an S-X 'Y' coordinate system; | p
0p
1I denotes a Path Point p
0And a path point p
1The length of the path segment in between.
(2) Path smoothness f2(P)
Since the geometric shape of the mobile robot has a certain influence on its motion characteristics, the path should be smooth, i.e. the deflection angle α between the path segmentsiShould be as small as possible.
If each path section is regarded as a vector, the included angle between the vector and the X' axis, namely the path direction angle, can be calculated according to the slope, the difference value of the direction angles of two adjacent path sections is calculated, and the deflection angle alpha can be obtainedi. The degree of smoothness of the path can be described by the size of the deflection angle.
<math>
<mrow>
<msub>
<mi>f</mi>
<mn>2</mn>
</msub>
<mrow>
<mo>(</mo>
<mi>P</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mfrac>
<mrow>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<msub>
<mi>α</mi>
<mi>i</mi>
</msub>
<mo>+</mo>
<mi>k</mi>
<mo>×</mo>
<mi>π</mi>
<mo>/</mo>
<mn>2</mn>
</mrow>
<mi>n</mi>
</mfrac>
</mrow>
</math>
f2(P) is the average corner value of path P. In the above formula, αi(i ═ 1, 2.. n) denotes two vectors pi-1piAnd pipi+1Included angle (0 ≤ alpha)i< π); n is the number of included angles between adjacent path segment vectors in n +1 path segments; k is alphaiThe number of the angle is larger than or equal to pi/2, namely when a certain included angle is larger than or equal to pi/2, punishment is carried out on the target value.
(3) Path safety distance f3(P)
The safety degree is the distance between the robot and the obstacle, and if the size of the mobile robot is large, the mobile robot cannot be regarded as a particle. In this case, in order to prevent a collision between a certain part of the obstacle and the obstacle, the obstacle should be kept at a certain safe path distance f3(P)。
Where d represents the shortest distance of the path P from all obstacles.
(4) Punishment of non-feasible paths
The path may be divided into a feasible path and an infeasible path depending on whether the path would collide with an obstacle. And judging whether a path is a feasible path or not, namely, giving a path to judge the intersection information of the path and the environment. The obstacle is set to be a polygon, described by a set of vertex coordinates. Therefore, the intersection information of the whole path and the obstacle can be obtained only by calculating the intersection information of each path segment and each edge (namely the adjacent vertex connecting line) of the obstacle.
Since the smaller the objective function value is, the better the path is, in order to ensure that the objective function value of each infeasible path is larger than the fitness value of all feasible paths, a penalty value is added when the objective function value of the infeasible path is calculated. For infeasible paths, the above three objective function values are calculated as follows:
fi(P)=Wi+m×Ci,i=1,2,3
in the formula, WiAt the objective function f for all feasible pathsiThe worst value of (d); m is the number of the sections of the non-feasible path in the non-feasible path P; ciIs a penalty factor.
Step two: and initializing a multi-target firefly algorithm.
As shown in fig. 3, first, parameters of the multi-target firefly algorithm are initialized: group size N, external archive size NaAnd the maximum number of iterations TmaxThe size of these quantities is determined according to the problem to be solved. The population size N can be 20-40; external archive File size NaThe size, N, of the finally obtained path set is determinedaThe larger the value of (A), the more paths are finally selected; the maximum iteration number can be 300-600.
Also the firefly location needs to be initialized. Each firefly represents an alternative pathway. Through the simplification of the path encoding by the steps, each dimension component of the firefly position vector sequentially represents the vertical coordinate (in the S-X 'Y' coordinate system) of each path point on the alternative path. The initial position of the firefly is randomly initialized within the search space. As described above, if n waypoints are to be determined, the location vector of the firefly is an n-dimensional vector.
Step three: the location of the firefly is updated and a set of non-inferior solutions is determined.
In FA, fireflies implement information sharing by lighting, and adopt brightness to distinguish the merits of the solutions represented by fireflies, and fireflies with high brightness attract fireflies with low brightness to move towards it, thus making the whole population move towards a better area. When the FA is adopted to solve the single-target optimization problem, only one target function to be optimized is needed, and therefore the target function value of the position of the firefly can be defined as the brightness of the firefly. However, for the multi-objective optimization problem, because consideration is given to simultaneously optimizing a plurality of mutually conflicting objective functions, the quality of a solution cannot be measured by directly adopting the value of one objective function. The concept dominated by Pareto can effectively evaluate the quality of a solution in multi-objective optimization, so that the concept dominated by Pareto can be adopted to distinguish the brightness of the firefly in the FA, and meanwhile, the firefly is guided to continuously move towards a better area by combining with an information sharing mechanism of the FA.
To better explain this process, we first give the related concepts governed by Pareto.
Definition 1: pareto rule
In the multi-objective problem of solving the minimum value of the objective function, X is set as a feasible solution set of the multi-objective optimization problem,
in order to design the variables of the design,
for the objective function to be optimized, then
<math>
<mrow>
<mi>F</mi>
<mrow>
<mo>(</mo>
<mi>x</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mrow>
<mo>(</mo>
<msub>
<mi>f</mi>
<mn>1</mn>
</msub>
<mrow>
<mo>(</mo>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</mrow>
<mo>,</mo>
<msub>
<mi>f</mi>
<mn>2</mn>
</msub>
<mrow>
<mo>(</mo>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</mrow>
<mo>,</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>,</mo>
<msub>
<mi>f</mi>
<mi>m</mi>
</msub>
<mrow>
<mo>(</mo>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mo>)</mo>
</mrow>
<mo>)</mo>
</mrow>
</mrow>
</math> In order to be the target vector,
<math>
<mrow>
<mo>∀</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>k</mi>
</msub>
<mo>∈</mo>
<mi>X</mi>
<mo>,</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>l</mi>
</msub>
<mo>∈</mo>
<mi>X</mi>
<mo>.</mo>
</mrow>
</math> if and only if
<math>
<mrow>
<mo>∀</mo>
<mi>i</mi>
<mo>∈</mo>
<mo>{</mo>
<mn>1,2</mn>
<mo>,</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>,</mo>
<mi>m</mi>
<mo>}</mo>
<mo>:</mo>
<msub>
<mi>f</mi>
<mi>i</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>k</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>≤</mo>
<msub>
<mi>f</mi>
<mi>i</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>l</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>,</mo>
</mrow>
</math> And is
<math>
<mrow>
<mo>∃</mo>
<mi>j</mi>
<mo>∈</mo>
<mo>{</mo>
<mn>1,2</mn>
<mo>,</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>,</mo>
<mi>m</mi>
<mo>}</mo>
<mo>:</mo>
<msub>
<mi>f</mi>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>k</mi>
</msub>
<mo>)</mo>
</mrow>
<mo><</mo>
<msub>
<mi>f</mi>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>l</mi>
</msub>
<mo>)</mo>
</mrow>
</mrow>
</math> At first, call
Dominating
Definition 2: pareto optimal solution
If no other solution x' Pareto dominates x exists in the whole feasible solution set of the multi-objective optimization problem, x is called a Pareto optimal solution of the problem, and is also called a non-inferior solution.
Definition 3: pareto optimal solution set
The set of all Pareto optimal solutions of a multi-objective optimization problem forms a Pareto optimal solution set, or a non-inferior solution set, of the problem.
Because the path planning problem considers three performance indexes of path length, path smoothness and path safety at the same time, and these performance indexes are often conflicting, for example, the path smoothness and path safety may be poor when the path length is short, the path planning problem is essentially a multi-objective optimization problem, and the multi-objective firefly algorithm can be adopted to solve the problem.
The specific method for updating the firefly position and determining the non-inferiority set comprises the following steps:
firstly, the position vectors of all fireflies are sequentially substituted into three objective functions of path length, path smoothness and path safety, whether the path is feasible or not is judged, and the infeasible path is punished to obtain the objective function vector corresponding to each firefly.
For any two fireflies in the population, the Pareto domination relationship between the fireflies is judged based on the concept of Pareto domination. If a firefly iPaareto dominates firefly j, the path represented by i is better, j is attracted by i to update the position of the firefly, and the position updating formula is as follows:
<math>
<mrow>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>+</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
<mo>=</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>)</mo>
</mrow>
<mo>+</mo>
<msub>
<mi>β</mi>
<mi>ij</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mo>)</mo>
</mrow>
<mrow>
<mo>(</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>i</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>)</mo>
</mrow>
<mo>-</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>t</mi>
<mo>)</mo>
</mrow>
<mo>)</mo>
</mrow>
<mo>+</mo>
<mi>α</mi>
<msub>
<mover>
<mi>ϵ</mi>
<mo>→</mo>
</mover>
<mi>i</mi>
</msub>
</mrow>
</math>
wherein: t is the number of iterations;
the spatial positions of fireflies i and j; alpha is constant and can be taken as alpha epsilon [0,1],
Is a random number vector derived from a gaussian distribution, uniform distribution, or other distribution.
βij(rij) The attraction of firefly i to firefly j is defined as:
<math>
<mrow>
<msub>
<mi>β</mi>
<mi>ij</mi>
</msub>
<mrow>
<mo>(</mo>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mo>)</mo>
</mrow>
<mo>=</mo>
<msub>
<mi>β</mi>
<mn>0</mn>
</msub>
<msup>
<mi>e</mi>
<mrow>
<mo>-</mo>
<mi>γ</mi>
<msup>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mn>2</mn>
</msup>
</mrow>
</msup>
<mo>,</mo>
</mrow>
</math>
<math>
<mrow>
<msub>
<mi>r</mi>
<mi>ij</mi>
</msub>
<mo>=</mo>
<mo>|</mo>
<mo>|</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>i</mi>
</msub>
<mo>-</mo>
<msub>
<mover>
<mi>x</mi>
<mo>→</mo>
</mover>
<mi>j</mi>
</msub>
<mo>|</mo>
<mo>|</mo>
<mo>=</mo>
<msqrt>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<msup>
<mrow>
<mo>(</mo>
<msub>
<mi>x</mi>
<mrow>
<mi>i</mi>
<mo>,</mo>
<mi>k</mi>
</mrow>
</msub>
<mo>-</mo>
<msub>
<mi>x</mi>
<mrow>
<mi>j</mi>
<mo>,</mo>
<mi>k</mi>
</mrow>
</msub>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</msqrt>
</mrow>
</math>
wherein: beta is a
0For maximum attraction, β may be taken
01. Gamma is a light absorption coefficient which marks the change of attraction, the value of the gamma has great influence on the convergence rate and the optimization effect of the firefly algorithm, and gamma belongs to [0.01,100]]。r
ijIs the distance from firefly i to firefly j, and n is the firefly position vector
Dimension of (d), x
i,kAs firefly i position vector
Component of the k-th dimension, x
j,kAs the firefly j position vector
The k-th dimension component of (a).
In the process of realizing the iteration, the firefly which is not governed by any other firefly is saved as a non-inferior solution set of the iteration.
Step four: and updating the external archive file.
Because the path planning problem is a multi-objective optimization problem, a path with optimal path length, path smoothness and path safety cannot be found, only three mutually conflicting performance indexes can be subjected to compromise balance, and paths with better performance are determined for decision makers to select.
An external archive file is used to store all paths with better performance, i.e. non-inferior solutions, obtained in the iterative process. Initially the external archive file is empty and as the iteration progresses, the external archive file is updated with the non-inferior solution sets generated in each of the three steps. The update strategy of the archive file is as follows: for each non-inferior solution in the non-inferior solution set, if the non-inferior solution is governed by a member of the archive, rejecting the non-inferior solution to join the archive; if the non-inferior solution dominates part of the members of the archive, removing those dominated members, and adding the non-inferior solution to the archive; if all members of the non-inferior solution and the archive are not in direct possession of each other, the non-inferior solution is added directly to the archive.
If the size of the archive file is not limited, all non-inferior solutions that satisfy the above conditions can be entered into the archive file. However, since the archive file is updated in each iteration, the calculation cost is excessive if the size of the archive file is not limited. Therefore, from the practical calculation point of view, the size of the archive file should be limited. Once the size of the archive file reaches the predetermined upper limit, a criterion for deleting some of the non-inferior solutions in the archive file is required. When the size of the file exceeds the set maximum size NaIn the method, the method for deleting the excessive non-inferior solutions in the archive file comprises the following steps: calculating the density of the neighborhood of all individual file members, ordering from small to large, and reserving N with the minimum neighborhood densityaOne archive member, the other members are deleted from the archive file.
For the definition of the individual neighborhood density, a plurality of forms of the multi-objective evolutionary algorithm are already available. The PAES algorithm defines the density of the individual neighborhood by adopting a self-adaptive grid method, the method is simple and easy to implement, the computation amount of the PAES algorithm is obviously smaller than the S distance density estimation of the popular SPEA2 and the density estimation strategy of the NEAG2, and the performance is not inferior, so that the PAES algorithm defines the density of the individual neighborhood in an external archive file by adopting the method. The specific estimation method comprises the following steps: the search space is divided into several grids, and the individual neighborhood density is defined as the number of all individuals in the same grid as it. The partitioning of the mesh is adaptively changed as the members of the external archive file change, and when an individual inserted into the archive lies outside the existing boundaries of the mesh, the mesh is repartitioned
Step five: and judging whether the preset maximum iteration number is reached.
If the maximum iteration number set in the step two is reached, turning to a step six; otherwise, go to step three.
Step six: and determining the Pareto optimal path, and finishing path planning.
And outputting the non-inferior solution set in the external archive file to obtain a set of Pareto optimal paths. And selecting a Pareto optimal path from the paths according to the actual problem requirement as a path planning result.