1@menu 2* Introduction to cobyla:: 3* Functions and Variables for cobyla:: 4* Examples for cobyla:: 5@end menu 6 7@node Introduction to cobyla, Functions and Variables for cobyla, cobyla-pkg, cobyla-pkg 8@section Introduction to cobyla 9 10@code{fmin_cobyla} is a Common Lisp translation (via @code{f2cl}) of the 11Fortran constrained optimization routine COBYLA by Powell[1][2][3]. 12 13COBYLA minimizes an objective function F(X) subject to M inequality 14constraints of the form g(X) >= 0 on X, where X is a vector of 15variables that has N components. 16 17Equality constraints g(X)=0 can often be implemented by a pair of inequality 18constraints g(X)>=0 and -g(X)>= 0. Maxima's interface to COBYLA 19allows equality constraints and internally converts the equality 20constraints to a pair of inequality constraints. 21 22The algorithm employs linear approximations to the 23objective and constraint functions, the approximations being formed by 24linear interpolation at N+1 points in the space of the variables. 25The interpolation points are regarded as vertices of a simplex. The 26parameter RHO controls the size of the simplex and it is reduced 27automatically from RHOBEG to RHOEND. For each RHO the subroutine tries 28to achieve a good vector of variables for the current size, and then 29RHO is reduced until the value RHOEND is reached. Therefore RHOBEG and 30RHOEND should be set to reasonable initial changes to and the required 31accuracy in the variables respectively, but this accuracy should be 32viewed as a subject for experimentation because it is not guaranteed. 33The routine treats each constraint individually when calculating 34a change to the variables, rather than lumping the constraints together 35into a single penalty function. The name of the subroutine is derived 36from the phrase Constrained Optimization BY Linear Approximations. 37 38 39References: 40 41[1] Fortran Code is from @url{http://plato.asu.edu/sub/nlores.html#general} 42 43[2] M. J. D. Powell, "A direct search optimization method that models the objective and constraint functions by linear interpolation," in Advances in Optimization and Numerical Analysis, eds. S. Gomez and J.-P. Hennart (Kluwer Academic: Dordrecht, 1994), p. 51-67. 44 45[3] M. J. D. Powell, "Direct search algorithms for optimization calculations," Acta Numerica 7, 287-336 (1998). Also available as University of Cambridge, Department of Applied Mathematics and Theoretical Physics, Numerical Analysis Group, Report NA1998/04 from @url{http://www.damtp.cam.ac.uk/user/na/reports.html} 46 47@opencatbox 48@category{Numerical methods} 49@category{Optimization} 50@category{Share packages} 51@category{Package cobyla} 52@closecatbox 53 54@node Functions and Variables for cobyla, Examples for cobyla, Introduction to cobyla, cobyla-pkg 55@section Functions and Variables for cobyla 56 57@anchor{fmin_cobyla} 58@deffn {Function} fmin_cobyla @ 59@fname{fmin_cobyla} (@var{F}, @var{X}, @var{Y}) @ 60@fname{fmin_cobyla} (@var{F}, @var{X}, @var{Y}, optional_args) 61 62Returns an approximate minimum of the expression @var{F} with respect 63to the variables @var{X}, subject to an optional set of constraints. 64@var{Y} is a list of initial guesses for @var{X}. 65 66@var{F} must be an ordinary expressions, not names of functions or lambda expressions. 67 68@code{optional_args} represents additional arguments, 69specified as @code{@var{symbol} = @var{value}}. 70The optional arguments recognized are: 71 72@table @code 73@item constraints 74List of inequality and equality constraints that must be satisfied by 75@var{X}. The inequality constraints must be actual inequalities of 76the form @code{g(@var{X}) >= h(@var{X})} or @code{g(@var{X}) <= 77h(@var{X})}. The equality constraints must be of the form 78@code{g(@var{X}) = h(@var{X})}. 79@item rhobeg 80Initial value of the internal RHO variable which controls 81the size of simplex. (Defaults to 1.0) 82@item rhoend 83The desired final value rho parameter. It is approximately 84 the accuracy in the variables. (Defaults to 1d-6.) 85@item iprint 86 Verbose output level. (Defaults to 0) 87@itemize 88@item 890 - No output 90@item 911 - Summary at the end of the calculation 92@item 932 - Each new value of RHO and SIGMA is printed, including 94 the vector of variables, some function information when RHO is reduced. 95@item 963 - Like 2, but information is printed when F(X) is computed. 97@end itemize 98@item maxfun 99The maximum number of function evaluations. (Defaults to 1000). 100@end table 101 102On return, a vector is given: 103@enumerate 104@item 105The value of the variables giving the minimum. This is a list of 106elements of the form @code{@var{var} = @var{value}} for each of the 107variables listed in @var{X}. 108@item 109The minimized function value 110@item 111The number of function evaluations. 112@item 113Return code with the following meanings 114 @enumerate 115 @item 116 0 - No errors. 117 @item 118 1 - Limit on maximum number of function evaluations reached. 119 @item 120 2 - Rounding errors inhibiting progress. 121 @end enumerate 122@end enumerate 123 124@code{load("fmin_cobyla")} loads this function. 125 126@end deffn 127 128@anchor{bf_fmin_cobyla} 129@deffn {Function} bf_fmin_cobyla @ 130@fname{bf_fmin_cobyla} (@var{F}, @var{X}, @var{Y}) @ 131@fname{bf_fmin_cobyla} (@var{F}, @var{X}, @var{Y}, optional_args) 132 133This function is identical to @code{fmin_cobyla}, except that bigfloat 134operations are used, and the default value for @var{rhoend} is 135@code{10^(fpprec/2)}. 136 137See @mref{fmin_cobyla} for more information. 138 139@code{load("bf_fmin_cobyla")} loads this function. 140 141@end deffn 142 143@node Examples for cobyla, , Functions and Variables for cobyla, cobyla-pkg 144@section Examples for cobyla 145 146Minimize x1*x2 with 1-x1^2-x2^2 >= 0. 147The theoretical solution is x1 = 1/sqrt(2), x2 = -1/sqrt(2). 148 149@c ===beg=== 150@c load("fmin_cobyla")$ 151@c fmin_cobyla(x1*x2, [x1, x2], [1,1], 152@c constraints = [x1^2+x2^2<=1], iprint=1); 153@c ===end=== 154@example 155(%i1) load("fmin_cobyla")$ 156@group 157(%i2) fmin_cobyla(x1*x2, [x1, x2], [1,1], 158 constraints = [x1^2+x2^2<=1], iprint=1); 159@end group 160 Normal return from subroutine COBYLA 161 162 NFVALS = 66 F =-5.000000E-01 MAXCV = 1.999845E-12 163 X = 7.071058E-01 -7.071077E-01 164(%o2) [[x1 = 0.70710584934848, x2 = - 0.7071077130248], 165 - 0.49999999999926, [[-1.999955756559757e-12],[]], 66] 166@end example 167 168There are additional examples in the share/cobyla/ex directory. 169 170