2 .\" Copyright (c) 2007 Massachusetts Institute of Technology
4 .\" Copying and distribution of this file, with or without modification,
5 .\" are permitted in any medium without royalty provided the copyright
6 .\" notice and this notice are preserved.
8 .TH NLOPT_MINIMIZE 3 2007-08-23 "MIT" "NLopt programming manual"
10 nlopt_minimize \- Minimize a multivariate nonlinear function
15 .BI "nlopt_result nlopt_minimize(nlopt_algorithm " "algorithm" ,
18 .BI " nlopt_func " "f" ,
19 .BI " void* " "f_data" ,
20 .BI " const double* " "lb" ,
21 .BI " const double* " "ub" ,
23 .BI " double* " "fmin" ,
24 .BI " double " "fmin_max" ,
25 .BI " double " "ftol_rel" ,
26 .BI " double " "ftol_abs" ,
27 .BI " double " "xtol_rel" ,
28 .BI " const double* " "xtol_abs" ,
29 .BI " int " "maxeval" ,
30 .BI " double " "maxtime" );
32 You should link the resulting program with the linker flags
37 attempts to minimize a nonlinear function
41 design variables using the specified
43 The minimum function value found is returned in
45 with the corresponding design variable values stored in the array
55 containing lower and upper bounds, respectively, on the design variables
57 The other parameters specify stopping criteria (tolerances, the maximum
58 number of function evaluations, etcetera) and other information as described
59 in more detail below. The return value is a integer code indicating success
60 (positive) or failure (negative), as described below.
62 By changing the parameter
64 among several predefined constants described below, one can switch easily
65 between a variety of minimization algorithms. Some of these algorithms
66 require the gradient (derivatives) of the function to be supplied via
68 and other algorithms do not require derivatives. Some of the
69 algorithms attempt to find a global minimum within the given bounds,
70 and others find only a local minimum (with the initial value of
76 function is a wrapper around several free/open-source minimization packages.
77 You could, of course, compile and call these packages separately, and in
78 some cases this will provide greater flexibility than is available via the
80 interface. However, depending upon the specific function being minimized,
81 the different algorithms will vary in effectiveness. The intent of
83 is to allow you to quickly switch between algorithms in order to experiment
84 with them for your problem, by providing a simple unified interface to
86 .SH OBJECTIVE FUNCTION
88 minimizes an objective function
92 .BI " double f(int " "n" ,
94 .BI " const double* " "x" ,
96 .BI " double* " "grad" ,
98 .BI " void* " "f_data" );
100 The return value should be the value of the function at the point
104 points to an array of length
106 of the design variables. The dimension
108 is identical to the one passed to
109 .BR nlopt_minimize ().
111 In addition, if the argument
115 points to an array of length
117 which should (upon return) be set to the gradient of the function with
118 respect to the design variables at
122 should upon return contain the partial derivative df/dx[i],
126 Not all of the optimization algorithms (below) use the gradient information:
127 for algorithms listed as "derivative-free," the
129 argument will always be NULL and need never be computed. (For
130 algorithms that do use gradient information, however,
132 may still be NULL for some calls.)
136 argument is the same as the one passed to
137 .BR nlopt_minimize (),
138 and may be used to pass any additional data through to the function.
139 (That is, it may be a pointer to some caller-defined data
140 structure/type containing information your function needs, which you
141 convert from void* by a typecast.)
145 parameter can take on any of the following values:
147 .B NLOPT_GLOBAL_DIRECT
148 Perform a global derivative-free optimization using the DIRECT search
149 algorithm by Jones et al., based on the free implementation by Gablonsky
152 The value returned is one of the following enumerated constants.
153 (Positive return values indicate successful termination, while negative
154 return values indicate an error condition.)
156 Currently the NLopt library is in pre-alpha stage. Most algorithms
157 currently do not support all termination conditions: the only
158 termination condition that is consistently supported right now is
161 Written by Steven G. Johnson.
163 Copyright (c) 2007 Massachusetts Institute of Technology.