提交 de69e2fb 编写于 作者: S stevenj

support both Jones and Gablonsky direct variants

darcs-hash:20070824133727-c8de0-7bc31c4491e8d18853f961ed48aba7c4c6c3ab77.gz
上级 8ac018ad
...@@ -15,4 +15,7 @@ link it with -lnlopt -lm. You may need to use the C++ compiler to link ...@@ -15,4 +15,7 @@ link it with -lnlopt -lm. You may need to use the C++ compiler to link
in order to include the C++ libraries (which are used internally by NLopt, in order to include the C++ libraries (which are used internally by NLopt,
even though it has a C API). even though it has a C API).
The minimization function, nlopt_minimize, is described in the man
page (api/nlopt_minimize.3, which is installed by 'make install'.
Interfaces for other languages may be added in the future. Interfaces for other languages may be added in the future.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][128] = { static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][128] = {
"DIRECT (global)", "DIRECT (global)",
"DIRECT-L (global)",
"Subplex (local)", "Subplex (local)",
"StoGO (global)", "StoGO (global)",
"Low-storage BFGS (LBFGS) (local)" "Low-storage BFGS (LBFGS) (local)"
...@@ -74,11 +75,15 @@ nlopt_result nlopt_minimize( ...@@ -74,11 +75,15 @@ nlopt_result nlopt_minimize(
switch (algorithm) { switch (algorithm) {
case NLOPT_GLOBAL_DIRECT: case NLOPT_GLOBAL_DIRECT:
case NLOPT_GLOBAL_DIRECT_L:
switch (direct_optimize(f_direct, &d, n, lb, ub, x, fmin, switch (direct_optimize(f_direct, &d, n, lb, ub, x, fmin,
maxeval, 500, ftol_rel, ftol_abs, maxeval, 500, ftol_rel, ftol_abs,
xtol_rel, xtol_rel, xtol_rel, xtol_rel,
DIRECT_UNKNOWN_FGLOBAL, -1.0, DIRECT_UNKNOWN_FGLOBAL, -1.0,
NULL, DIRECT_GABLONSKY)) { NULL,
algorithm == NLOPT_GLOBAL_DIRECT
? DIRECT_ORIGINAL
: DIRECT_GABLONSKY)) {
case DIRECT_INVALID_BOUNDS: case DIRECT_INVALID_BOUNDS:
case DIRECT_MAXFEVAL_TOOBIG: case DIRECT_MAXFEVAL_TOOBIG:
case DIRECT_INVALID_ARGS: case DIRECT_INVALID_ARGS:
......
...@@ -13,6 +13,7 @@ typedef double (*nlopt_func)(int n, const double *x, ...@@ -13,6 +13,7 @@ typedef double (*nlopt_func)(int n, const double *x,
typedef enum { typedef enum {
/* non-gradient algorithms */ /* non-gradient algorithms */
NLOPT_GLOBAL_DIRECT = 0, NLOPT_GLOBAL_DIRECT = 0,
NLOPT_GLOBAL_DIRECT_L,
NLOPT_LOCAL_SUBPLEX, NLOPT_LOCAL_SUBPLEX,
/* gradient-based algorithms */ /* gradient-based algorithms */
......
...@@ -28,6 +28,9 @@ nlopt_minimize \- Minimize a multivariate nonlinear function ...@@ -28,6 +28,9 @@ nlopt_minimize \- Minimize a multivariate nonlinear function
.BI " const double* " "xtol_abs" , .BI " const double* " "xtol_abs" ,
.BI " int " "maxeval" , .BI " int " "maxeval" ,
.BI " double " "maxtime" ); .BI " double " "maxtime" );
.sp
You should link the resulting program with the linker flags
-lnlopt -lm on Unix.
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.BR nlopt_minimize () .BR nlopt_minimize ()
......
文件已添加
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册