Bezier Curve Collision-Free Route Planning Using Meta-Heuristic Optimization

Nowadays, sustainability becomes a general requirement in engineering and sciences, including in path planning technologies. Path planning is very important for an object, which needs to generate motion, such as a vehicle robot, an arm robot manipulator, a missile, a ship, a submarine, and an aircraft. It is a process to design a feasible path that becomes a trace for vehicles or robots. One of the advantages of using a Bezier curve for path planning is its adaptability to change the control points. It has been widely used as a manufacturing path in additive manufacturing [1,2,3], vehicle route path of an aircraft [4], and vessel path motion [5]. The goal of sustainability in the manufacturing system is still in the way of the process. In the future, additive manufacturing will be developed into sustainable manufacturing via path planning technologies [1]. Thus, research on the path planning methodologies that address a sustainability goal is highly important. Sustainable manufacturing refers to applying an approach for manufacturing that has minimal harm to environments and mitigated bad impacts on human health and nature [6]. For the robots and vehicle systems, which commonly operate in obstacle environments, it is necessary to achieve the safety goal by generating a collision-free path. Collision avoidance strategies become an important issue in path planning. The concept of collision avoidance dynamic critical area for vessel path planning was introduced in [5]. Collision avoidance for human-robot interactions in adaptive manufacturing was presented in [3]. Saeed et al. [7] proposed a boundary node method to solve mobile robot path planning in static obstacle environments. Kala et al. [8] applied multi-neuron heuristic search to solve the path planning in the static obstacle environment. The GA as one of the evolutionary methods has been applied to solve the point-to-point path planning. Linquan et al. [9] proposed to use GA for path planning of robot soccer systems in a dynamic environment. Choi et al. [10] presented two-path planning algorithms based on Bezier curves for autonomous vehicles with waypoints and corridor constraints. Lil et al. 11] assumed the existence of an obstacle-avoiding polyline path and replaced the polyline path with a G cubic spline curve to avoid the obstacles. A B S T R AC T

This paper presents the collision avoidance algorithm of the Bezier curve path using meta-heuristic optimizations. A procedure of collision detection based on matrix analysis is proposed to solve this problem. The collision checking is performed via curve points analysis. It needs to check whether any positions of curve points inside the obstacle area. The GA and WOA are applied to solve the optimization of the collision avoidance Bezier curve. The performance of both methods in solving the problem of narrowpassage collision avoidance path optimization is also investigated.

II. PROBLEM STATEMENTS
The trajectory is from point R to point S with an obstacle between these two points. The objective is to generate a path as a trajectory reference that is free from a collision. A cubic Bezier curve with four control points B0, B1, B2, B3, is used. A start point is the first control point B0, and an endpoint is the fourth control point B3. The other two control points, i.e., B1 and B2 are free to be determined. The collision-free requirement needs to place those control points in a location such that the cubic Bezier curve is outside the obstacle area, as seen in Fig. 1.
where , ( ) , t and Bi are the i th n th order Bernstein basis function, a curve parameter, and i th control point, respectively.
To construct an n th degree Bezier curve, n+1 control point must be defined. Thus, n is three for the cubic Bezier curve. Equation To avoid collisions, proper selection of control points position is essential to generate the collision-free Bezier curve.

III. METHODS
In two-dimensional cases, the obstacles can be modeled as a composition of one or more kinds of the curve. For example, a triangle is composed of three straight curves. A rectangular is composed of four straight curves, or it can be a composition of other curves such as a polynomial or a trigonometric depending on the geometry of the obstacle object. The collision avoidance algorithm needs analysis of curve points position so that the generated path is outside the obstacle area.

A. Fitness Function
The fitness function for avoiding collision route planning is the path length that needs to be minimized. The constraint function is the position of curve points from the obstacle area. The points in the curve are described by the function P(t) based on Equation (3).
where x(t) and y(t) are the x-axis and y-axis of the cubic Bezier curve, respectively. The minimum length equation for the parametric curve is described in Equation (4).
1 0 For the cubic Bezier curve, the objective function is the root integral of the fourth-degree polynomial, which has no closed-form solutions. Thus, numerical integration is necessary to solve (4). The optimum path in a maximize form is the highest fitness value in Equation (5).
The requirement for obstacle avoidance is the path curve in an obstacle-free area. It needs analysis about the curve point's position to ensure that they are outside the obstacle area. This paper defines a function which is called Fobs. It is a function that decides whether the curve is a success or a failure. Only the paths outside the obstacle area for all points are the successful candidates of route planning. It has only two possible values, which are 1 and 0. Mathematically, Fobs can be described as an onoff logic operation using Equation (6).
If All curve points are in the free area: Fobs =1 (6) Otherwise: Fobs =0 Since it depends on the position of the curve points from the obstacle area, the number of Fobs is the same as the number of obstacle areas in the environment. For n obstacles in the environment, there exist n Fobss. Thus, the total objective functions can be generated using Equation (7).
Variable Fobs describes whether the path is a failure or a success. If any of the paths is a failure, the fitness value becomes zero. For example, if three obstacles are composed of the triangle, the rectangular, and the circular obstacles, there are three Fobs values associated with the obstacles. Each of them must be evaluated by checking the position of curve points from each obstacle area.

B. Avoiding Collision method: Curve Points Analysis
To evaluate the function of Fobs, the avoiding collision algorithm is proposed as follows: 1. Model the obstacle area. It can be circular, rectangular, a polygon, a curve, or a combination of them. It depends on the obstacle geometry 2. Divide the path, i.e., the cubic Bezier curve, in n points. Those n points are the points in the curve which its distance from the obstacle must be analyzed. 3. Analysis of each point: a. Define a free area and a checking area. There are always free areas in the environment that depend on the geometry of the obstacle system. b. Evaluate Fvalue for each point in the curve.
There are two curve point position possibilities. It can be in the free area or the checking area. All points in the free area for which the value is one are considered a passing candidate. There are also the checking areas where the point value could pass or fail. It depends on the position of curve points from the obstacle. The value of each point is described as an on-off logic operation as follows: • For the curve point in the free area: Fvalue=1 • For the curve point in the checking area: If the curve point analysis indicates that the point is outside the obstacle: Fvalue = 1 Otherwise: Fvalue =0 c. Generate an evaluation matrix.
After the curve points analysis, an evaluation matrix can be generated. The evaluation matrix is the matrix that contains the curve points value. If the cubic Bezier curve is divided into 200 points, the evaluation matrix has a matrix size of 1x200 for one individual.

C. Sample Cases: Five Kinds of Obstacles
The avoiding collision problems for five kinds of obstacles, the rectangular, the circular, the triangular, the area subscribed by two lines and the curve, and the area subscribed by two curves, are presented.  • Circular Obstacle Fig. 3 shows that for the circular obstacle, the checking area is inside rectangular ABCD. In this checking area, the distance of point P to the circle center becomes a tool for curve point analysis using Equation (8).
Where, (x*, y*) is the circle center. If and only if ∆>R*, then the Fvalue=1. R* is an obstacle radius. • Triangular Obstacle Fig. 4 illustrates the triangular obstacle and its geometrical analysis. It shows that θp1 and θp2 can be used as a tool to analyze whether the point P is in the free area or the obstacle area. θp1 and θp2 are point angles from x * -axis and x ** -axis. ( x * , y * ) and (x ** , y ** ) are obstacle coordinates that coincide with points A and C. These coordinates are used to simplify the analysis. ∆θ1 is the angle between a line AB and a line AC, i.e., |θ 2 -θ1| and ∆θ2 is the angle between a line AC and a line BC, i.e., |θ 4 -θ 3|.

Fig. 4. Triangular Obstacle
The formula for checking procedure can be written as follow: where θ1 and θ2 are the angle of line AC from x * -axis and the angle of line BC from x ** -axis, respectively. For the case shows in Fig. 4, point P is in the free area since the P position satisfies the condition of |θp2 -θ4| ≥ ∆θ2.
• Two-Straight Lines and One Curve Obstacle Fig. 5 shows the case where the obstacle geometry is composed of two straight lines AB and AC with coordinate A is (x1, y1) and coordinate B is (x2, y2). The curve has an equation y1=0.007x 3 sinx + x. It shows that Δθ, i.e., |θ2-θ1|, can be used as a tool to analyze whether the point P is in the free area or the checking area.  • Two-Curve Obstacle Fig. 6 shows an example of an obstacle that is composed of two curves with equations y1=-xsin 4 x +10 sin x +5 and y2= 1.5xsin 4 x -0.008 x 2 . ∆θ can be used as a tool to locate the area of checking points. ∆θ, i.e., |θp-θ1|, is measured from a line AB. A(x1, y1) and B(x2, y2) are the intersection points between those curves. The analysis is as follows: • For the points in the free area: xP <x1 or xP>x2 Fvalue = 1 • For the points in the checking area : • For 0 ≤ |θP-θ1| ≤ π and x1 ≤xP≤ x2 :

IV. META-HEURISTIC OPTIMIZATIONS
This section presents meta-heuristic optimizations, namely the GA and GWO, that are used to solve the route planning.

A. Genetic Algorithm
The GA is a searching method in the computation to obtain solutions to optimization based on Darwin evolution theory [12]. The Binary GA needs binary encodings. The chromosome is decoded before an evaluation of the objective function is computed. For the cubic Bezier route path problem, the optimization parameters are the second and third control point positions, i.e. B1 (x1,y1) and B2 (x2,y2) which must be decoded as chromosomes. Fig. 10 illustrates the GA procedure to solve the Bezier curve collisionfree route planning.

• Chromosomes
Chromosome C is expressed by the string using Equation (9).
The decimal value of "b" elements is determined as Equation (10).
where Ngene is the number of bits.

• Decoding
The real value of the chromosome is obtained using Equation (11). ( 11) Where, Xmin, Xmax, and λ are the lower and upper bounds of the side constraints, and the length of the binary string, respectively.

• Fitness Value
The fitness of the individual is the fitness function at its chromosome, which has been decoded. This fitness function represents the objective of the optimization.

• Mutation and Crossover
A crossover is a process of randomly choosing one or more individuals as parents and randomly swapping elements of the parents. Fig. 8(a) and Fig. 8(b) illustrate single-point crossover and two points crossovers.

Fig. 8. Crossover
A mutation is a mechanism of randomly change digits in the string, i.e. 0 by 1 and vice versa. Fig. 9 shows an example of this process.

B. Grey Wolf Optimizer
The GWO is the meta-heuristic technique inspired by the grey wolves' leadership hierarchy and hunting mechanism [13]. Four types of grey wolves are considered, namely alpha, beta, delta, and omega. Fig. 11 presents the flow chart of the GWO procedure to solve the Bezier curve collision-free route planning.
The alpha () is the fittest solution. The second and third best solutions are beta () and delta (δ), respectively. Other candidates' solutions are omega (), where they follow the , , δ wolves during the hunting procedure. The encircling prey by the grey wolves is modeled using Equation (12 ⃗ are linearly decreased from 2 to 0 for iterations using Equation (13c).
Where, k and kmax are the current iteration and the maximum iteration number, respectively, the variables r1 and r2 are random vectors in [0, 1]. Grey wolves recognize the location of prey. Alpha is the leader during the hunting mechanism. Following Equations (14) to (16) where ⃗ , ⃗ , and ⃗ are the positions of alpha wolf, beta wolf, and delta wolf, respectively.  the alpha wolf, the beta wolf, and the delta wolf are updated based on the fitness value following the definition that the alpha, the beta, and the delta are the fittest search agent, the second fittest search agent, and the third fittest search agent, respectively. It needs to check the current fitness value. In the case that the current fitness value is higher than the previous alpha, then the alpha wolf is replaced by the new one. The beta and delta wolves are updated in a similar procedure. Updating the variables: a, A, and c are obtained by using Equation (13a, 13b, 13c). In this mechanism, r1 and r2 need to be generated three times to obtained the values of ( ⃗ 1 , ⃗ 1 ), ( ⃗ 2 , ⃗ 2 ), and ( ⃗ 3 , ⃗ 3 ) and to calculate the values of ⃗ 1 , ⃗ 2 , and ⃗ 2 as Equation (15). The remaining search agents are updated following Equation (16).

V. RESULT AND DISCUSSION
Numerical experiments in MATLAB environment are performed using 20 individuals in the population using 700 curve points. A Simpson's rule is applied as numerical integration to solve F1. The computation uses 25 iteration numbers. For the GA, the mutation rate and selection rate are chosen to be 0.1 and 0.5, respectively. The number of bits is selected to be 10. This research uses synthetic data to generate the obstacle environment and the route path using MATLAB software. The programming code is written in the m-file. The synthetic data approach permits an exploration of unusual configurations, unique system behavior, and specific parameter [17]. The synthetic data methodology has been widely applied in the robotics field. Using MATLAB software, the synthetic data has been integrated into the comprehensive systems in solving adaptive trajectory planning [18], Unmanned Aerial Vehicle (UAV) coordination [19], Wide Area Aerial surveillance [17], and route choice problem in transportation science [20] A. Triangle Obstacle Table I presents the results of the GA and GWO for route planning from the start point (5.6 -0.5) and the endpoint (3.5 4) in a triangle obstacle environment. It shows that the GWO has better performance than that of the GA since the GWO has the highest fitness value, i.e., 0.01614. As expressed in Equation (5), the minimum length problem has been converted to the maximization problem so that the better performance can be determined by the highest value of the fitness function. Fig. 12a shows the fitness value evolution of the GA and the GWO. It can be observed that within 25 generations, the GWO evolve beyond the GA fitness graph. Fig. 12b and 12c illustrate the collision-free Bezier route obtained from the GA and the GWO, respectively. The results of route planning are in the form of control points (B1x, B1y) and (B1x, B1y) (see Table I), representing the position of lines that determine the Bezier curve geometry. Thus, different values of these control points result in different shapes of the collision-free Bezier curve. Meta-heuristic optimizations search these control points in such a way so that the route path is feasible, i.e., collision-free. These lines are illustrated as the straight line in the black color in Fig. 12b and 12c. The collision-free path, which is illustrated in the blue color in Figs. 12b and 12c are then can be computed by using Equation (2).  Table II presents the results of the GA and GWO for route planning from the start point (9, 0) and the endpoint (8,12) with an obstacle that formed from two straight-line curves. The curve has the equation Y =0.007 x 3 sin x + 0.001x 2 cos x + x. It shows that the GWO has better performance than that of the GA since it has the highest fitness value, i.e., 0.061327. Fig.13a shows the fitness value evolution of the GA and the GWO. The same as in the triangular obstacle, the GWO fitness evolve beyond the GA fitness graph.  . 13a and 13b illustrate the collision-free Bezier route obtained from GA and GWO result for this obstacle environment. It can be observed that in this obstacle geometry, the generated paths obtained from the GA and the GWO are significantly different because the values of Bezier curve control points obtained from the GA and the PSO (see Table II) are in the opposite direction.  Table III presents the results of the GA and GWO for route planning from the start point (13 -2) and the endpoint (13 10) with obstacle formed of two curves y1 = -x sin 4 x+10 sin x +5 and y2 = 1.5x sin 4 x -0.008 x 2 . The previous cases show that the GWO has the highest fitness value, i.e., 0.08071. Fig. 14a shows the fitness value evolution of the GA and the GWO. The GWO fitness again evolves beyond the GA fitness graph. Fig. 14b and 14c illustrate the collision-free Bezier route obtained from GA and GWO results for such a two-curve obstacle environment. The same as in the case of one curve two-line obstacle, the generated paths of the GA and GWO are significantly different. Visualization graphs in Figs. 14b and 14c are also clearly indicated that the length of the path from the GWO is lower than that of the GA.   Table IV presents the results of the GA and GWO for route planning from the start point (1.5 4) and the endpoint (10 10) for combination obstacles (see Fig. 15). As in the previous cases, this table shows that the GWO has better performance than that of the GA, where the GWO best fitness value is higher, i.e., 0.071091, than that of the GA, i.e., 0.064472. The result of the best solution is confirmed by the fitness evolution graph, as shown in Fig. 15a. Applying the route planning result, i.e., Bezier curve control points (see TABLE IV), the collision-free Bezier routes are illustrated in Fig. 15b and 15c for the GA and the GWO, respectively, combination obstacles environment.

D. Combination Obstacle and Narrow-Passage Collision Avoidances
The route planning is then modified by changing the starting point to R(4, 0). This new route planning conveys the narrowpassage area. Motion planning involving the narrow-passage problem has been an important topic but a very challenging computational problem [14][15][16]. Thus, investigating both meta-heuristic optimization methods in solving this type of route planning Table V presents the GA and GWO for this route planning which contains the narrow passage area. Unlike previous cases, it shows that the GA has better performance in finding the optimal collision-free route than that of the GWO, where the GA exhibits the highest fitness value, i.e., 0.0561, compared with the best fitness value of the GWO, i.e., 0.053024. Applying the results of the control points in Table IV to Equation (2), Fig. 16a and 16b illustrate the collision-free Bezier route of the GA and the GWO, respectively, for this narrow passage route planning.   For the narrow passage route planning, both the GA and the GWO encounter the problem of escaping from the death fitness value. As presented in the methodology section, the penalty method is applied. The fitness is set to be a null value when there is a route point inside the obstacles area. The GA and GWO possibly have null fitness values at the beginning of the computation, and they need to escape from this null value. Fig. 17b shows the fitness evolution of both GA and GWO during the narrow passage route planning computation. As a comparison, Fig. 17a shows the fitness evolution of both methods for case 1, where it does not involve the narrow passage area. Without a narrow passage area, both methods do not face the null fitness value problem.

E. Comparison with polynomial-based path
Using the cubic Bezier curve, there are only four unknown parameters, which are the first Bezier curve control point: B1(x1, y1) and the second Bezier curve control point : B1 (x2, y2), to be searched by the meta-heuristic algorithm. The results have shown that the cubic Bezier curve incorporating the meta-heuristic optimization can be used to solve the narrow passage problem. This section investigates the behavior of a polynomial-based path in solving the presented collision avoidance problem. The polynomial function has been widely used in the path planning of arm robot manipulators when the trajectories are generated in the joint space [21].
The cases presented in this paper are different with arm robot manipulators since the generated trajectories of the present study are in the cartesian space/coordinate. However, the behavior of the polynomial function as the collision-free path is very interesting to be studied because the same with the Bezier curve, the polynomial function has the smoothness property, which is very important in path planning [22]. A quadrinomial [21], which is polynomial degree fourth, is applied as the path in cartesian coordinate in the following: The boundary conditions of initial coordinates and final coordinates yield: where (x, y), (x0, y0), (xf, yf), and an are the cartesian coordinates of the path, the initial coordinates, the final coordinates, and nth polynomial coefficient, respectively. The path length of y=f(x) is in the following: Variable (x 0 , y 0 ) and (x f , y f ) are known parameters as the departure point and the destination point, respectively. Using the above equations, there are three searching parameters, which are the fourth polynomial coefficient: 4 , third polynomial coefficient: 3 , and second polynomial coefficient: 2 . Using the GA and the GWO, the computation of the polynomial-based path is similar to the Bezier curve with L in Equation (4) is replaced by Equation (19) because the route is now in the form of y=f(x). The only difference is the generated path, which is now using the polynomial-based function as described in the above equations.
The combination obstacle, namely case 1, presented in the previous section is used as the path planning problem. Table VI presents the results of the GA and the GWO. As in the Bezier curve-based path, the GWO exhibits the highest fitness value, i.e 0.074111. GWO have failed in finding a collision-free polynomial path for the triangular case, as shown in Fig. 19. Although the obstacle is only one piece of triangular geometry; however, using one segment of the polynomial function is not enough to generate the collision-free path. Compared to the cubic Bezier curve, the polynomial function y=f(x) is not agile enough to be used as the collision-free route path. The results in this paper have shown that, in general, both the GA and GWO have shown good capability in finding the collisionfree route applying the developed collision-avoidance algorithm. Without the narrow passage problem, the GWO has shown a good performance than that of the GA, while for the narrow-passage route planning, the GA has outperformed the GWO. The good performance of the GA in escaping from null fitness value is probably due to the mutation procedure. This research uses a quite high mutation rate, i.e., 0.1, where it can further explore the searching capability of the GA. Because of the capability of the GA in solving the narrow passage problem but it less performed than the GWO for the route planning without the narrow passage problem, considering to hybrid between GA and the GWO in solving the advanced planning is also very interesting to be conducted for future research. Investigating other meta-heuristic methods in solving the narrow-passage route planning is also very important to be conducted for future research. Because the results in this paper have shown that one segment of polynomial-based function is less agile for the collision-free route path, it is suggested to study the application of piecewise polynomial functions, for example, the B-spline curve, incorporating the meta-heuristic optimization for the future study. For future research, the developed collision avoidance algorithm can be further implemented to solve the motion planning of an unmanned aerial vehicle and manufacturing path of the industrial manipulator; however, the advanced path planning will require additional constraints to be considered. For example, the other constraint is the maximum curvature for the UAV path planning as described in [23,24].

VI. CONCLUSION
The collision avoidance Bezier curve optimization has been presented. The avoiding collision algorithm based on curve point analysis was developed. The Bezier control points needed to search in such a way so that the generated route has the minimum length while it was also collision-free. Meta-heuristic optimizations, which were the GA and the GWO, have been applied to solve this route optimization problem. Since the problem has been converted to the maximization problem, the measurement of the best performance was based on the highest fitness value. Results showed that the GWO, in general, has shown better performance than that of the GA, where the GWO exhibits the highest fitness value. However, the GA has shown better performance for the narrow passage problem than that of the GWO. They are considering that the GA has good performance in solving the narrow-passage path planning. At the same time, the GWO outperformed the GA for the case without escaping from the death fitness value. Implementing hybrid GA-GWO to solve the advanced path planning is recommended for future research.