Advances in Applied Mathematics
Vol.3 No.04(2014), Article ID:14299,8 pages
DOI:10.12677/AAM.2014.34024

Least Squares Fitting with B-Spline by Genetic Algorithm

Lian Liu, Renzhong Feng

School of Mathematics and System Science, Beijing University of Aeronautics and Astronautics, Beijing

Email: buaaliulian@163.com

Copyright © 2014 by authors and Hans Publishers Inc.

Received: Jul. 24th, 2014; revised: Sep. 2nd, 2014; accepted: Sep. 14th, 2014

ABSTRACT

In this paper, we propose genetic algorithm to obtain a good approximation for least squares fitting with linear and nonlinear B-spline, and four different two-dimensional airfoil data fittings are given to show that genetic algorithm solves this kind of problem feasibly and effectively.

Keywords:B-Spline Curve, The Least Squares Fitting, Genetic Algorithm

Email: buaaliulian@163.com

B样条曲线，最小二乘拟合，遗传算法

1. 引言

2. 基于B样条曲线的最小二乘拟合

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(9)

3. 遗传算法求解B样条曲线最小二乘拟合

3.1. 适应度函数

(10)

(11)

(12)

3.2. 遗传参数的选取

(13)

(14)

3.3. 实数编码

3.4. 选择，交叉，变异，精英保留机制

Step a. 已知图1的初始数据种群，计算种群个体的

Step b. 将第i个个体复制份，保存值最大的个体至bestnow。

Step c. if则复制份的bestnow个体，否则跳出。

Figure 1. Real coding of [a, b]=[0, 1]

(a) (b)

Figure 2. (a) Before crossover, (b) After crossover

3.5. 遗传算法工作流程

Step.1 给定SIZE，MAX，，L，初始种群空间，，设定gen = 0，BEST = 0。

Step.2 根据给定公式(1)~(14)，必要时对T进行排序，计算个体i的

Step.3 选择操作，保存当前最优值至bestnow。

Step.4 if bestnow < BEST，BEST = bestnow，否则执行Step.5 Step.5 交叉，变异操作，生成新一代种群空间。

Step.6 gen = gen + 1，if gen < MAX，重复Step.2，否则结束。

4. 数值实验

4.1. 线性B样条曲线最小二乘拟合结果

Figure 3. Q and average error of fitness function is (10)

Table 1. The average error of profile data fitting

Figure 4. Graph by least squares, from left to right is NACA0012, NACA64A010, RAE2822, SC(2)0712

Figure 5. Graph by genetic algorithm, from left to right is NACA0012, NACA64A010, RAE2822, SC(2)0712

4.2. 非线性B样条曲线最小二乘拟合结果

5. 结论

Figure 6. Q and average error, fitness function is (11)

Figure 7. Q and average error, fitness function is (12)

Figure 8. Graph of Table 2, from left to right is NACA0012, NACA64A010, RAE2822, SC(2)0712

Table 2. Results of the nonlinear data fitting (a)

Table 3. Results of the nonlinear data fitting (b)

Figure 9. Graph of Table 3, from left to right is NACA0012, NACA64A010, RAE2822, SC(2)0712

1. [1]   施法中 (2001) 计算机辅助几何设计与非均匀有理B样条. 高等教育出版社, 北京.

2. [2]   Ma, W. and Kruth, J.P. (1995) Parametrization of randomly measured points for least squares ﬁtting of B-spline curves and surfaces. Computer-Aided Design, 27, 663-675.

3. [3]   王晓鹏 (2001) 遗传算法及其在气动优化设计中的应用研究. 博士论文, 西北工业大学, 西安.

4. [4]   潘立登 (2009) 遗传算法及其工程应用. 机械工业出版社, 北京.

5. [5]   Dierckx, P. (1993) Curve and surface ﬁtting with splines. Oxford University Press, Oxford.

6. [6]   蒋尔雄, 赵风光, 苏仰峰 (2007) 数值逼近. 复旦大学出版社, 上海.

7. [7]   Powell, M.J.D. (1970) Curve ﬁtting by splines in one variable. In: Hayes, J.G., Ed., Numerical approximation to functions and data, Athlone Press, London.

8. [8]   Anthony, H.M., Cox, M.G. and Harris, P.M. (1989) The use of local polynomial approximations in a knot-placement strategy for least-squares spline ﬁtting. NPL Report, DITC, 148/89.