 Journal of Mathematical Finance, 2011, 1, 8-13 doi:10.4236/jmf.2011.11002 Published Online May 2011 (http://www.SciRP.org/journal/jmf) Copyright © 2011 SciRes. JMF Legendre App roximation for Solving a Class of Nonlinear Optimal Control Problems Emran Tohidi, Omid Reza Navid Samadi, Mohammad Hadi Farahi Department of Applied Mathematics, School of Mathematical Sciences, Ferdowsi University of Mashhad, Mashhad, Iran E-mail: {emran.tohidi, om_na92}@stu-mail.um.ac.ir, farahi@math.um.ac.ir Received March 24, 2011; revised May 16, 2011; accepted M ay 19, 2011 Abstract This paper introduces a numerical technique for solving a class of optimal control problems containing non- linear dynamical system and functional of state variables. This numerical method consists of two major parts. In the first part, using linear combination property of intervals, we convert the nonlinear dynamical system into an equivalent linear system. And in the second part, which we are dealing with a linear dynamical sys-tem, using Legendre expansions for approximating both the state and associated control together with discre-tizing the constraints over the Chebyshev-Gauss-Lobatto points, the optimal control problem is transformed into a corresponding NLP problem which is diretly solved. The proposed idea is illustrated by several nu-merical examples. Keywords: Optimal Control, Legendre Polynomials, Linear Combination Property of Intervals, Chebyshev-Gauss-Lobatto Points, Nonlinear Programming 1. Introduction Optimal control theory is widely applied in aerospace, engineering, economics and other areas of science and has received considerable attention of researchers. Dur-ing the past two decades, enormous effort has been spent on the development of computational methods for gene-rating solutions of optimal control problems [1-8]. Al-though many computational methods have been devel-oped and proposed, modification of the existing methods and development of new methods should yet be explored to obtain accurate solutions successfully. The approaches to numerical solutions of optimal con-trol problems may be divided into two major classes: the indirect methods and the direct methods. The indirect methods are based on the pontryagin maximum principle and require the numerical solution of boundary value problems that result from the necessary conditions of optimal control . For many practical optimization problems, these boundary value problems are quite dif-ficult to solve. In fact, the manner in which pontryagin maximum principle is used differs so significantly from one type of problem to another that no standard solution procedure can be devised. Therefore, one has to devise direct computational algorithms to solve optimal control problems. Direct optimization methods transcribe the (infinite- dimensional) continuous problem to a finite-dimensional nonlinear programming problem (NLP) through some parametrization of the state and/or control variables. In the direct methods, initial guesses have to be provided only for physically intuitive quantities such as the states and possibly controls. However, continuous advances in NLP algorithms and software have made these the me-thods of choice in many applications . In this paper, we present a direct approach that based upon linear combination property of intervals and Le-gendre polynomials approximations together with the Chebyshev-Gauss-Lobatto (CGL) points as the colloca-tion nodes to determine the optimal trajectories of high order nonlinear ( possibly discontinuous ) dynamic sys-tems. The most important reason of CGL points consid-eration instead of Legendre-Gauss-Lobatto (LGL) points is that CGL’s have a closed-form formula, but, LGL's have no analytic forms. Our method consists of two ma-jor parts. In the first part, using linear combination prop-erty of intervals, we transform nonlinear dynamical sys-tem into a corresponding linear system. And in the second part, using general ideas of Razzaghi  (i.e., E. TOHIDI ET AL. Copyright © 2011 SciRes. JMF 9Legendre method for linear systems), and applying the CGL points as collocation nodes for discretizing the lat-ter linear dynamical system and inequality state con-straints, the optimal control problem is converted into an NLP problem, which its parameters are the unknown Legendre coefficients. We also apply high-order Gauss- -lobatto quadrature rules  for approximating the inte- gral involved in the performance index in the discretiza-tion procedure. The advantages of recasting the optimal control problem as an NLP are: 1) the proposed method eliminates the requirement of solving a (2PBVP); 2) state and control inequality are easier to handle. Numerical examples are given to demonstrate the ap-plicability of the proposed technique. Moreover, a com-parison is made with optimal solutions obtained by the presented approach and a collocation method . 2. Preliminaries 2.1. Properties of the Shifted Legendre Polynomials The Legendre polynomials which are orthogonal in the interval [−1,1] satisfy the following recurrence relation   1121=, 111iiiiiPxxPx Pxiii (2.1.1) with 0=1Px and 1=Px x. In order to use these polynomials on the interval 0, h, one can apply the change of variables 2=1txh in (2.1.1). Therefore, the shifted Legendre polynomials are constructed as follows 2ˆ=1 ,. iitPtPt ohh (2.1.2) The orthogonal property of shifted Legendre polyno- mials is given by  00ˆˆd= =21hijijPtPt thiji (2.1.3) A function, ft, which is absolutely integrable within 0th may be expressed in terms of a shifted Legendre series as  =0ˆ=iiiftfPt (2.1.4) where  021 ˆ=d.hiiifftPt th (2.1.5) If we assume that the derivative of ft in Equation (2.1.4) is described by  =0ˆ=iiiftgPt (2.1.6) the relationship between the coefficients if in (2.1.4) and ig in (2.1.6) can be obtained as follows  11232122123 =0=1,2,ii ihigi giifi  (2.1.7) Further, the product of two shifted Legendre poly- nomials ˆiPt and ˆjPt can be approximated by  0ˆˆ ˆ=Nijijn nnPtPt Pt (2.1.8) where  021ˆˆ ˆ=d, =0,1,,. hijnij nnPtPtPtt nNh(2.1.9) 2.2. Linear Combination Property of Intervals This property states that every uniform continuous func-tion with a compact and connected domain can be writ-ten as a convex linear combination of its maximum and minimum. In other words, if  and  are the maxi-mum and minimum of the uniform continuous function Hx, one can write =1, 01.Hx  (2.2.1) 3. Problem Statement Consider the following nonlinear system =,xtAtxtHtut (3.1) with known initial and final conditions 00=xx, =hxhx, where xt and ut are 1n and 1q state and control vectors respectively, nnAtR and ut U where U is a compact and connected subset of qR. It is assumed that =nq and ,Htut is a smooth or non-smooth continuous function over 0, hU. Moreover, there exists a pair of state and control variables ,xtut such that satisfy (3.1) and two point boundary conditions 00=xx and =hxhx. The problem is to find the optimal control ut and the corresponding state trajectory xt, 0th , satisfy- ing Equation (3.1) while minimizing the cost functional 0=,d.hJftxt t (3.2) Two special cases of ,ftxt in (3.2) are ,=Tftxtctxt and E. TOHIDI ET AL. Copyright © 2011 SciRes. JMF 10   1,=2Tftxtxtqtxt . Also, with the assumption of enough smoothness one can consider the following inequality state constraint ,0.txt (3.3) 4. Linearization o f th e Dy na mi ca l S ys te m Since :0, nHhU R is a continuous function and 0, hU is a compact and connected subset of 1nR, then ,:Htutu U is a closed set in nR clearly. Thus, ,:iHtutu U for =1,2, ,in is closed in R. Now, suppose that the lower and upper bounds of the ,:iHtutu U are igt and iwt respec- tively. Therefore,  ,, 0,.ii igtHtut wtth (4.1) In other words  =,:, 0,,iuigtMinHtutuUth (4.2)  =,:, 0,.iuiwtMaxHtutu Uth (4.3) Using linear combination property of intervals, that explained briefly in Section 2, ,iHtut can be ex- pressed as a convex linear combination of its minimum igt and maximum iwt as follows   ,= 1 ,iiiiiii iHtutt wttgtttgt (4.4) where  =iiitwtgt and 0,1it. Note that according to Equation (4.4), it is the associated control variable. Now, the main problem with the assumption of  ,=Tftxtctxt is transformed into the following optimal control problem 0min dhTctxtt (4.5) Subject to =, 0,1xtAtxttt gtt   (4.6) ,0,txt (4.7)  00=, =.hxxxh x (4.8) For solving the above-mentioned problem one can apply the Legendre polynomials together with Cheby- shev-Gauss-Lobatto (CGL) points (as collocation nodes). In the next section, the state variable xt and associated control variable t are expanded in terms of Legendre polynomials with unknown coefficients. Then, using CGL points as the collocation nodes the latter problem is converted to an NLP problem which its parameters are the unknown coefficients of the state and associated control. 5. Discretization A discretization of the interval 010=< <<=Nsssh is chosen, where =, =0,1,,22iihhsti N (5.1) with π=cosiitN. Trivially, si’s are shifted CGL points in the interval 0, h. We use the following expansions to approximate both xt and associated control t  =0ˆ== ,NNiiixtxt aPt (5.2)  =0ˆ== ,NNiiittbPt (5.3) where ˆiPt’s are the ith order shifted Legendre polynomials. To find the Legendre expansion coeffi- cients ic of the derivative Nxt such that  =0 =0ˆˆ==NNNii iiiixtaPtcPt (5.4) we use the recurrence relation (2.1.7). Using CGL points for discretizing dynamical system (4.6) together with the inequality state constraints (4.7) and boundedness of associated control t, the opti- mal control problem (4.5) - (4.8) is changed into the following NLP problem 01min ,,,NLa aa (5.5)  Subject to=,=0,,NNNiiiiiixsAsxss sgsiN (5.6) ,0, 01, =0,,NNii isxss iN (5.7)  00=0 =0=1=, ==.NNiNNiihiixsaxxhax (5.8) TT12 01,,,=,,, ,NNaaaMcc c (5.9) where 01,,,NLa aa is a linear objective function, 0ˆˆ0== 1iiiPPs and ˆˆ==1iiNPh Ps. Note that the constraints of (5.9) arise from the fol- lowing relations 11=, =1,2,,.221 23iiicchaiNii (5.10) E. TOHIDI ET AL. Copyright © 2011 SciRes. JMF 11where 1==0NNcc. Hint. After obtaining optimal state *xt and asso- ciated control *t, for evaluating optimal control *ut we use the following equation  **,= .Htu tttgt (5.11) 6. Illustrative Examples In this section, we conduct two numerical examples to illustrate the effectiveness of the proposed method. We use the method that stated in Sections 4 and 5 to transform the main problems into the equivalent NLP problems, and comparisons of our solutions with a col- location method solutions  are presented. All the problems are programmed in MAPLE 12 and run on a PC with 1.8 GHz and 1 GB RAM. Example 6.1 We first consider a problem containing non-smooth function ,Htut which indirect approa- ches (base upon pontryagin maximum principle) can not dealing with this case in a proper way. The problem is to find the control ut and the state xt which mini- mize 10=sin2πedtJtxtt (6.1) subject to  3sin 2π52=etxtt ttxtut  (6.2) with 1,1ut , 0=0.9x and 1=0.4x. Here 3sin 2π,= etHtut ut, and according to the (4.2) and (4.3) we have  sin 2π=min,:1,1 = etugtHtut u and  =max,:1,1 =0uwtHtut u , thus sin 2π==e.ttwtgt In Figures 1 and 2 we plot the optimized state xt and control ut for =11N. Also, the numerical results compared with the colloca- tion method  are listed in Table 1. From Table 1. one can see that our method achieves good result with a relatively smaller of nodes than . Example 6.2 Find the control ut and the state xt, which minimize 101=e2 d2tJtxt t (6.3) subject to  =ln 3xttxtut t  (6.4) with 1,1ut , 0=0x and 1=0.8x. Here ,=ln 3Htutut t , and according to the (4.2) and (4.3) we have Figure 1. Optimal state x*(.) of example 6.1. Figure 2. Optimal control u*(.) of example 6.1. Table 1. Comparison of J* between methods. NLegendre Method Collocation Method  6−0.0331943700 −0.0354240398 8−0.0346216260 −0.0356414811 10 −0.0370224908 −0.0368552070 11 −0.0387730644 −0.0377178920  =min,:1,1 =ln2ugtHtut ut and  =max,:1,1 =ln4uwtHtut ut , thus 4==ln4ln2=ln2ttwtgt ttt In Figures 3 and 4 we plot the optimized state xt and control ut for =12N. Also, the numerical results compared with the collocation method  are listed in Table 2. From Table 2. we see that the performance E. TOHIDI ET AL. Copyright © 2011 SciRes. JMF 12 Figure 3. Optimal state x*(.) of example 6.2. Figure 4. Optimal control u*(.) of example 6.2. Table 2. Comparison of J* between methods. N Legendre Method Collocation Method  7 −0.1820295698 −0.1815318828 9 −0.1825806940 −0.1821287778 11 −0.1826754624 −0.1823052407 12 −0.1828354838 −0.1826714837 index got by our approach are better than those obtained by the method in . 7. Conclusions The aim of the present work is the determination of the optimal control and state vectors by a direct method of solution based upon linear combination property of in-tervals and shifted Legendre series expansions together with the CGL points as collocation nodes respectively. The method is based upon reducing a nonlinear optimal control problem to an NLP. The unity of the weight function of orthogonality for shifted Legendre series and the simplicity of the discretization are merits that make the approach very attractive. Moreover, only a small number of shifted Legendre series is needed to obtain a very satisfactory solution. The given numerical examples supports this claim. 8. References  R. R. Bless, D. H. Hoges and H. Seywald, “Finite Ele-ment Method for the Solution of State-Constrained Op-timal Control Problems,” Journal of Guidance, Control, and Dynamics, Vol. 18, No. 5, 1995, pp. 1036-1043. doi:10.2514/3.21502  R. Bulrisch and D. Kraft, “Computational Optimal Con-trol,” Birkhauser, Boston, 1994.  G. Elnagar, M. A. Kazemi and M. Razzaghi, “The Pseu-dospectral Legendre Method for Discretizing Optimal Control Problems,” IEEE Transactions on Automatic C on- trol, Vol. 40, No. 10, 1995, pp. 1793-1796. doi:10.1109/9.467672  G. N. Elnagar and M. A. Kazemi, “Pseudospectral Che-byshev Optimal Control of Constrained Nonlinear Dy-namical Systems,” Computational Optimization and Ap-plications, Vol. 11, No. 2, 1998, pp. 195-217. doi:10.1109/9.467672  W. W. Hager, “Multiplier Methods for Nonlinear Optim-al Control Problems,” SIAM Journal on Numerical Anal, Vol. 27, No. 4, 1990, pp. 1061-1080. doi:10.1137/0727063  A. L. Herman and B. A. Conway, “Direct Trajectory Optimization Using Collocation Based on High-Order Gauss-Lobatoo Quadrature Rules,” Journal of Guidance, Control, and Dynamics, and Dynamics, Vol. 19, No. 3, 1996, pp. 592-599. doi:10.2514/3.21662  M. Ross and F. Fahroo, “Legendre Pseudospectral Ap-proximations of Optimal Control Problems,” Lecture Note s in Control and Information Sciences, Vol. 295, No. 1, 2003, pp. 327-342.  J. Vlassenbroeck and R. V. Dooren, “A Chebyshev Tech-nique for Solving Nonlinear Optimal Control Problems,” IEEE Transactions on Automatic Control, Vol. 33, No. 4, 1988, pp. 333-340. 10.1109/9.192187  H. Seywald and R. R. Kumar, “Finite Difference Scheme for Automatic Costate Calculation,” Journal of Guidance, Control, and Dynamics, and Dynamics, Vol. 19, No. 1, 1996, pp. 231-239. doi:10.2514/3.21603  K. Schittkowskki, “NLPQL: A Fortran Subroutine for E. TOHIDI ET AL. Copyright © 2011 SciRes. JMF 13Solving Constrained Nonlinear Programming Problems,” Operations Research Annals, Vol. 5, No. 2, 1985, pp. 385-400.  M. Razzaghi and G. Elnagar, “A Legendre Technique For Solving Time-Varing Linear Quadratic Optimal Control Problems,” Journal of the Franklin Institute, Vol. 330, No. 3, 1993, pp. 453-463. doi:10.1016/0016-0032(93)90092-9  O. V. Stryk, “Numerical Solution of Optimal Control Problems by Direct Collocation,” In: R. Bulrisch, A. Miele, J. Stoer and K. H. Well, Eds., Optional Control of Variations, Optimal Control Theory and Numerical Me-thods, International Series of Numerical Mathematics, Birkhäuser Verlag, Basel, 1993, pp. 129-143.