Automatic Knot Adjustment Using Dolphin Echolocation Algorithm for B-Spline Curve Approximation
Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016
MACRO
JOURNALS
The Journal of
Macro
Trends in Technology and Innovation
Automatic Knot Adjustment Using Dolphin Echolocation Algorithm for B-Spline Curve Approximation
Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER** *Necmettin Erbakan University, School of Applied Sciences, Department of Management Information Sciences **Selcuk University, Faculty of Engineering, Department of Computer Engineering
Abstract
In this paper, a new approach to solve the cubic B-spline curve fitting problem is presented based on a meta-heuristic algorithm called “dolphin echolocation”. The method minimizes the proximity error value of the selected nodes that measured using the least squares method and the Euclidean distance method of the new curve generated by the reverse engineering. The results of the proposed method are compared with the genetic algorithm. As a result, this new method seems to be successful.
Keywords:
B-spline Curve Approximation, Cubic B-spline, Data Parameterization on B-Spline, Dolphin Echolocation Algorithm, Knot adjustment I NTRODUCTION
B-Spline curve fitting is a classical problem for computer aided geometric design [1]. For example, de facto for the CAD / CAM and related graphic design industries, and in most geometric modeling areas is that non-polynomial parametric curves should be transformed into non-uniform rational B-splines. Similarly, in vector font modeling problems, fonts are often fitted with a soft-pass B-Spline. In practical applications, the distance between the target curve and the fitted B-Spline curve must be less than a predetermined tolerance, and the resulting curve is called an error-bound approach. Euclidean distance method is used to measure the value corresponding to the distance between two curves.
Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016 B-S
PLINE C URVE F ITTING P ROBLEM
The problem of B-Spline curve fitting is expressing the target curve with minimum tolerance through b-spline curves. The target curve can be two or three dimensional [2]. The scope of this paper The parameterization of the target data points The convergence of the minimum error tolerance with the B-Spline curves using the automatically placed minimum control point constitute. A B-spline curve is expressed as equation (1).
𝑃(𝑢) = ∑ 𝑝 𝑖 𝑁 𝑖 , 𝑝 (𝑢) 𝑛𝑖=0 where 𝑝 𝑖 is the i th control point and 𝑁 𝑖,𝑝 is the main function of B-Spline curves. The main function 𝑁 𝑖,𝑝 of B-Spline curve for given knot vector t with degree p is expressed as equation (2). 𝑁 𝑖,0 (𝑢) = {1, 𝑡 𝑖 ≤ 𝑢 ≤ 𝑡 𝑖+1
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 𝑁 𝑖,𝑝 (𝑢) = 𝑢 − 𝑡 𝑖 𝑡 𝑖+𝑝 − 𝑡 𝑖 𝑁 𝑖 , 𝑝−1 (𝑢) + 𝑡 𝑖+𝑝+1 − 𝑢𝑡 𝑖+𝑝+1 − 𝑡 𝑖+1 𝑁 𝑖+1,𝑝−1 (𝑢) Further information on the B-Spline curves can be found [3]. A. Methods on Data Parameterization
Because of B-Spline curves are parametric curves, the target data points need to be parameterized in the B-Spline curve fitting. However calculation of optimum data parameterization is theoretically quite difficult, different ways of data parameterization are used in applications. Three methods of uniform parameterization, chord-length parameterization, and centripetal parameterization are emerging in researches based on previous studies [4,5,6]. In this study centripetal parameterization method is used. B. Euclidean Distance Minimization
The Euclidean distance is used to calculate the error between the target curve and the B-Spline fitted curve. The Euclidean distance is calculated by an equation (3)
𝐷 = √∑(𝐶(𝑖) − 𝐵(𝑖)) where
𝐶(𝑖) is the i th data in original dataset, 𝐵(𝑖) is the i th data in the fitted curve. The general Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016 approach of this paper is to minimize this distance and express the B-Spline curve with minimum control point at the same time. Thus the Euclidean distance and the number of control points is treated together in the fitness function. C. Dolphin Echolocation Algorithm
The dolphin echolocation algorithm presented by Kaveh and Ferhoudi is an optimization algorithm that is inspired by the hunting principles of bottlenose dolphins through sonar waves [7]. The dolphins explore the entire search area for a specific effect to hunt. As they approach their prey, they try to focus on the target by limiting the number of waves they send by limiting their search. This algorithm implements search by reducing the distance to the target. The search space must be sorted before beginning to search. The alternatives of each variable to be optimized must be sorted in ascending or descending order. If these alternatives have more than one characteristic, they should be sorted according to the most important one. In the use of this technique, for example, for the variable j , the vector A j in length LA j forms the columns of the Alternatives Matrix. In addition, a convergence curve is used to change the convergence factor during the optimization process. The variation of this trend throughout the iterations is calculated by equation (4). 𝑃𝑃(𝐿𝑜𝑜𝑝 𝑖 ) = 𝑃𝑃 + (1 − 𝑃𝑃 𝑖 ) ∗ 𝐿𝑜𝑜𝑝 𝑖𝑃𝑜𝑤𝑒𝑟 − 1(𝐿𝑜𝑜𝑝𝑠𝑁𝑢𝑚𝑏𝑒𝑟) 𝑃𝑜𝑤𝑒𝑟 − 1 where PP is the probability of being pre-defined, PP is randomly selected probability for the first iteration, Loop i is the number of the current iteration, Power is the rank of the curve, and
LoopsNumber is the total number of iterations. Algorithm requires a location matrix L NL*NV in the variable number NV at the location count NL.
The main steps of Dolphin Echolocation (DE) for discrete optimization are as follows: 1. Create NL locations randomly for dolphin. 2. PP of current iteration is calculated using the equation (4). 3. Fitness is calculated for every location. 4. Calculate cumulative fitness according to the following dolphin rules where AF(A+k) j is the cumulative fitness of the selected alternative (A+k) for the j th variable (the numbering of the alternatives is the same as the ordering of the alternative matrix); Re is 𝐴𝐹 (𝐴+𝑘)𝑗 = 1𝑅𝑒 ∗ (𝑅𝑒 − |𝑘|) ∗ 𝐹𝑖𝑡𝑛𝑒𝑠𝑠(𝑖) + 𝐴𝐹 (𝐴+𝑘)𝑗 (a) for i = 1 to the number of locations for j = 1 to the number of variables find the position of L(i,j) in jth column of the Alternatives matrix and name it as A. for k = -Re to Re end end end Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016 the diameter of the influence of the neighbor affected by the cumulative fitness of alternative A . It is recommended that this diameter should not be more than 1/4 of the search space; Fitness(i) is the fitness of the i th location. The fitness should be defined as the best answers will get higher value. In other words, the goal of optimization should be to maximize the fitness. AF must be calculated using a reflective property by adding alternatives near the edges (if A + k is not valid, i.e.
A + k <0 or A + k> LA j ). In this case, if the distance of the alternative to the edge is small, the same alternatives appear in the mirror as if a mirror were placed on the edge. (b) A small έ value is added to AF sequences AF=AF+έ in order to distribute probabilities uniformly in search space. Here έ should be chosen according to the way of describing the fitness. The best choice is lower than the lowest fitness value achieved. (c) Find the best location for this loop and call it as "Best location" . Find the alternatives assigned to the best location variables and set their AF to zero. In another saying: 5. For the variable j (j = 1 to NV) , calculate the probability by choosing alternative i (i = 1 to ALj) according to the equation (6). 𝑃 𝑖𝑗 = 𝐴𝐹 𝑖𝑗 ∑ 𝐴𝐹 𝑖𝑗𝐿𝐴 𝑗 𝑖=1 Assign PP probability to all alternatives of all selected variables for the best location and distribute the remaining probability to other alternatives according to the form below: 7. Calculate the next step locations according to the assigned probability to each alternate. Repeat steps 2-6 maximum iteration number times. for j = 1 to Number of variables for i = 1 to Number of alternatives if i = The best location(j) 𝑃 𝑖𝑗 = 𝑃𝑃 else 𝑃 𝑖𝑗 = (1 − 𝑃𝑃) ∗ 𝑃 𝑖𝑗 end end end for j = 1: Number of variables for i = 1: Number of alternatives if i = The best location(j) 𝐴𝐹 𝑖𝑗 = 0 end end end Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016 A UTOMATIC K NOT A DJUSTMENT BY D OLPHIN E CHOLOCATION A LGORITHM
In the problem of B-Spline curve fitting, the fitted curve is tried to converge to the target curve with minimum tolerance and with minimum control point. In that case, such nodes must be selected for the given N points so that the error tolerance and the number of control points of the nearest curve are minimum. Thus, an array of N bits is expressed as selected nodes and as non-selected. Thus, the alternatives for each variable are [0,1]. Each location for a dolphin echolocation is called as solution. These solutions can be illustrated as Figure 1. Figure 1. Sample solution illustration For example, it is possible to express 10 points in this way with the control points to be calculated for the 5 selected nodes. The aim of dolphin echolocation is maximizing the fitness for equation (7) can be used as fitness function. 𝑓 = 1𝑁𝑢𝑚𝑏𝑒𝑟𝑜𝑓𝐶𝑜𝑛𝑡𝑟𝑜𝑙𝑃𝑜𝑖𝑛𝑡 ∗ 𝐸𝑟𝑟𝑜𝑟𝑉𝑎𝑙𝑢𝑒 The B-Spline curve fitting process with the dolphin echolocation algorithm is as follows. 1. Create random solutions for the startup population. 2. Calculate the PP of current iteration. 3. Calculate the fitness value for all possible solutions. 4. Calculate the cumulative fitness of the variables in each possible solution. 5. Find the best solution according to maximum fitness. 6. Set the cumulative fitness of all solutions variables to 0 which variables equal to the variables of the best solution. 7. Calculate the probabilities of alternatives for each variable in all solutions. 8. Set the probabilities of all alternatives equal to the variables of the best solution to probability of the current iteration. Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016
9. Find the possible solutions to be used in the next iteration by the probabilities of the alternatives for each variable. 10. Repeat steps 2-9 for the number of iteration times. 4. E XPERIMENTAL R ESULTS A. Experimental Curve
The target is a curve of 200 points. The approximation results of the 3rd degree B-Spline curves are as shown in Table 1.
GENETIC ALGORITHM DOLPHIN ECHOLOCATION ALGORITHM ITERATION
RMSE Euclidean Distance Number of Control Point Fitness RMSE Euclidean Distance Number of Control Point Fitness Table 1. Experimental results for different number of iteration. Plotted experimental results is shown in Figure 2. Figure 2. A) Original Curve, B) Genetic Algorithm, C) Dolphin Echolocation Algorithm
Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016 B. Epitrochoid Curve
The target is a curve of 361 points. The curve equation is as follows. 𝑥(𝑡) = (𝑎 + 𝑏) ∗ cos(𝑡) − ℎ ∗ cos ((𝑎𝑏 + 1) ∗ 𝑡) 𝑦(𝑡) = (𝑎 + 𝑏) ∗ sin(𝑡) − ℎ ∗ sin ((𝑎𝑏 + 1) ∗ 𝑡)
For the parameters a = 5 , b = 1 and h = 4 , The approximation results of the 3rd degree B-Spline curve for the curve calculated at -180 <= t <= 180 are as in Table 2. GENETIC ALGORITHM DOLPHIN ECHOLOCATION ALGORITHM ITERATION
RMSE Euclidean Distance Number of Control Point Fitness RMSE Euclidean Distance Number of Control Point Fitness
100 0,00460
500 0,00571
Table 2. Experimental results for different number of iteration.
Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016
Plotted experimental results is shown in Figure 3. Figure 3. A) Original Curve, B) Genetic Algorithm, C) Dolphin Echolocation Algorithm C. Archimedean Spiral
The target is a curve of 100 points. The curve equation is as follows. 𝑟 = 𝑎 ∗ 𝑡 𝑥(𝑡) = 𝑟 ∗ cos(𝑡) 𝑦(𝑡) = 𝑟 ∗ sin(𝑡)
For the a = 2 , The approximation results of the 3rd degree B-Spline curve for the curve calculated at are as shown in Table 3.
GENETIC ALGORITHM DOLPHIN ECHOLOCATION ALGORITHM ITERATION
RMSE Euclidean Distance Number of Control Point Fitness RMSE Euclidean Distance Number of Control Point Fitness
50 0,00150
100 0,00178
Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016
Plotted experimental results is shown in Figure 4. Figure 4. A) Original Curve, B) Genetic Algorithm, C) Dolphin Echolocation Algorithm D. Vivaldi Curve
The target curve is a curve of 241 points. The curve equation is as follows. 𝑥(𝑡) = 𝑎 ∗ (1 + cos(𝑡)) 𝑦(𝑡) = 𝑎 ∗ sin (𝑡) 𝑧(𝑡) = 2 ∗ 𝑎 ∗ sin (12 ∗ 𝑡)
For a = 0.5 , The approximation results of the 3rd degree B-Spline curve for the curve calculated at -360 <= t <= 360 are as shown in Table 4. Table 4. Experimental results for different number of iteration. Plotted experimental results is shown in Figure 5.
GENETIC ALGORITHM DOLPHIN ECHOLOCATION ALGORITHM ITERATION
RMSE Euclidean Distance Number of Control Point Fitness RMSE Euclidean Distance Number of Control Point Fitness Hasan Ali AKYÜREK*, Erkan ÜLKER**, Barış KOÇER**, JMTI Vol 4 Issue 1 2016
Figure 5. A) Original Curve, B) Genetic Algorithm, C) Dolphin Echolocation Algorithm 5. C ONCLUSION AND FEATURE WORK
This paper addresses the problem of curve fitting of noisy data points by using B-spline curves. Given a set of noisy data points, the goal is to compute all parameters of the approximating polynomial B-spline curve that best fits the set of data points in the least-squares sense. This is a very difficult, overdetermined, continuous, multimodal, and multivariate nonlinear optimization problem. Our proposed method solves it by applying the dolphin echolocation algorithm. Our experimental results show that the presented method performs very well by fitting the data points with a high degree of accuracy. A comparison with the most popular previous approach genetic algorithm to this problem is also carried out. It shows that our method outperforms previous approaches for the examples discussed in this paper. Future work includes the extension of this method to other families of curves, such as NURBS and the parametric B-spline curves. The extension of these results to the case of explicit surfaces is also part of our future work. R EFERENCES
Park, H., & Lee, J. H. (2007). B-spline curve fitting based on adaptive curve refinement using dominant points.
Computer-Aided Design , (6), 439-451. De Boor, C., De Boor, C., Mathématicien, E. U., De Boor, C., & De Boor, C. (1978). A practical guide to splines (Vol. 27, p. 325). New York: Springer-Verlag. Piegl, L., & Tiller, W. (2012).
The NURBS book . Springer Science & Business Media. Park, H. (2001). Choosing nodes and knots in closed B-spline curve interpolation to point data.
Computer-Aided Design , (13), 967-974. Vassilev, T. I. (1996). Fair interpolation and approximation of B-splines by energy minimization and points insertion. Computer-Aided Design , (9), 753-760. Wang, X., Cheng, F. F., & Barsky, B. A. (1997). Energy and B-spline interproximation. Computer-Aided Design , (7), 485-496. Kaveh, A., & Farhoudi, N. (2013). A new optimization method: Dolphin echolocation. Advances in Engineering Software ,59