From 9bddf6a0f900b0b1a8843790a89d432d1020520a Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Tue, 27 Aug 2013 12:57:31 -0400 Subject: [PATCH] rm defunct Nocedal code references (but keep NLOPT_LD_LBFGS_NOCEDAL constant for binary compatibility and as a placeholder if we are able to add in the new BSD-licensed Nocedal code --- Makefile.am | 8 ++------ api/general.c | 6 +----- api/optimize.c | 38 -------------------------------------- configure.ac | 11 ----------- lbfgs/Makefile.am | 9 --------- lbfgs/README | 26 -------------------------- 6 files changed, 3 insertions(+), 95 deletions(-) delete mode 100644 lbfgs/Makefile.am delete mode 100644 lbfgs/README diff --git a/Makefile.am b/Makefile.am index dc344e9..c400475 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,16 +8,12 @@ CXX_DIRS = stogo CXX_LIBS = stogo/libstogo.la endif -SUBDIRS = util direct cdirect $(CXX_DIRS) praxis luksan crs mlsl mma cobyla newuoa lbfgs neldermead auglag bobyqa isres slsqp esch api . octave test swig +SUBDIRS = util direct cdirect $(CXX_DIRS) praxis luksan crs mlsl mma cobyla newuoa neldermead auglag bobyqa isres slsqp esch api . octave test swig EXTRA_DIST = autogen.sh nlopt.pc.in m4 -if WITH_NOCEDAL -NOCEDAL_LBFGS=lbfgs/liblbfgs.la -endif - libnlopt@NLOPT_SUFFIX@_la_SOURCES = libnlopt@NLOPT_SUFFIX@_la_LIBADD = direct/libdirect.la \ -cdirect/libcdirect.la $(CXX_LIBS) praxis/libpraxis.la $(NOCEDAL_LBFGS) \ +cdirect/libcdirect.la $(CXX_LIBS) praxis/libpraxis.la \ luksan/libluksan.la crs/libcrs.la mlsl/libmlsl.la mma/libmma.la \ cobyla/libcobyla.la newuoa/libnewuoa.la neldermead/libneldermead.la \ auglag/libauglag.la bobyqa/libbobyqa.la isres/libisres.la \ diff --git a/api/general.c b/api/general.c index 39287f6..d1a8d82 100644 --- a/api/general.c +++ b/api/general.c @@ -61,11 +61,7 @@ static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][256] = { "StoGO (NOT COMPILED)", "StoGO randomized (NOT COMPILED)", #endif -#ifdef WITH_NOCEDAL_LBFGS - "original NON-FREE L-BFGS code by Nocedal et al. (local, deriv.-based)", -#else - "original NON-FREE L-BFGS code by Nocedal et al. (NOT COMPILED)", -#endif + "original L-BFGS code by Nocedal et al. (NOT COMPILED)", "Limited-memory BFGS (L-BFGS) (local, derivative-based)", "Principal-axis, praxis (local, no-derivative)", "Limited-memory variable-metric, rank 1 (local, derivative-based)", diff --git a/api/optimize.c b/api/optimize.c index 329c5f9..e17187f 100644 --- a/api/optimize.c +++ b/api/optimize.c @@ -44,10 +44,6 @@ static int my_isnan(double x) { return x != x; } #include "cdirect.h" -#ifdef WITH_NOCEDAL -# include "l-bfgs-b.h" -#endif - #include "luksan.h" #include "crs.h" @@ -537,40 +533,6 @@ static nlopt_result nlopt_optimize_(nlopt_opt opt, double *x, double *minf) step, ni, x, f_bound, opt, &stop, minf); } -#ifdef WITH_NOCEDAL - case NLOPT_LD_LBFGS_NOCEDAL: { - int iret, *nbd = (int *) malloc(sizeof(int) * n); - if (!nbd) return NLOPT_OUT_OF_MEMORY; - for (i = 0; i < n; ++i) { - int linf = nlopt_isinf(lb[i]) && lb[i] < 0; - int uinf = nlopt_isinf(ub[i]) && ub[i] > 0; - nbd[i] = linf && uinf ? 0 : (uinf ? 1 : (linf ? 3 : 2)); - } - iret = lbfgsb_minimize(ni, f, f_data, x, nbd, lb, ub, - ni < 5 ? ni : 5, 0.0, stop.ftol_rel, - stop.xtol_abs[0] > 0 ? stop.xtol_abs[0] - : stop.xtol_rel, - stop.maxeval); - free(nbd); - if (iret <= 0) { - switch (iret) { - case -1: return NLOPT_INVALID_ARGS; - case -2: default: return NLOPT_FAILURE; - } - } - else { - *minf = f(n, x, NULL, f_data); - switch (iret) { - case 5: return NLOPT_MAXEVAL_REACHED; - case 2: return NLOPT_XTOL_REACHED; - case 1: return NLOPT_FTOL_REACHED; - default: return NLOPT_SUCCESS; - } - } - break; - } -#endif - case NLOPT_LD_LBFGS: return luksan_plis(ni, f, f_data, lb, ub, x, minf, &stop, opt->vector_storage); diff --git a/configure.ac b/configure.ac index 2852d27..b6626fe 100644 --- a/configure.ac +++ b/configure.ac @@ -94,16 +94,6 @@ if test "$ok" = "yes"; then fi AC_MSG_RESULT(${ok}) -dnl ----------------------------------------------------------------------- - -if test "x$with_cxx" = xyes; then - test -r $srcdir/lbfgs/ap.cpp && test -r $srcdir/lbfgs/ap.h && test -r $srcdir/lbfgs/l-bfgs-b.cpp && test -r $srcdir/lbfgs/l-bfgs-b.h && have_lbfgs=yes -fi -AM_CONDITIONAL(WITH_NOCEDAL, test -n "$have_lbfgs") -if test -n "$have_lbfgs"; then - AC_DEFINE(WITH_NOCEDAL, [1], [Define if we have the non-free Nocedal LBFGS code]) -fi - dnl ----------------------------------------------------------------------- dnl SWIG wrappers @@ -407,7 +397,6 @@ AC_CONFIG_FILES([ cdirect/Makefile stogo/Makefile praxis/Makefile - lbfgs/Makefile luksan/Makefile crs/Makefile mlsl/Makefile diff --git a/lbfgs/Makefile.am b/lbfgs/Makefile.am deleted file mode 100644 index 42055bb..0000000 --- a/lbfgs/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -# non-free, so we cannot distribute with the nlopt library, hence "nodist" - -if WITH_NOCEDAL -noinst_LTLIBRARIES = liblbfgs.la -endif - -nodist_liblbfgs_la_SOURCES = ap.cpp ap.h l-bfgs-b.cpp l-bfgs-b.h - -EXTRA_DIST = README diff --git a/lbfgs/README b/lbfgs/README deleted file mode 100644 index 531407d..0000000 --- a/lbfgs/README +++ /dev/null @@ -1,26 +0,0 @@ -Limited-memory BFGS code by Ciyou Zhu, Richard Byrd, Peihuang Lu, and -Jorge Nocedal, which can be found (in various translations) at various -online sites: - - http://www.alglib.net/optimization/lbfgsb.php - http://plato.asu.edu/ftp/other_software/toms778_f90.tar.gz - -Unfortunately, since it was published in ACM TOMS, it seems to be -under the restrictive (semi-free) ACM copyright conditions. This was -confirmed in a private email from the author, Prof. Nocedal. - -Therefore, we no longer use this code in NLopt. - -Fortunately, Prof. Luksan's PLIN.FOR code (see the luksan/ directory) -is an independent implementation of the same algorithm, and is licensed -under the LGPL. - -UPDATE: Nocedal has apparently gotten permission from ACM to distribute - his L-BFGS code under the terms of the GPL: - - http://www.eecs.northwestern.edu/~nocedal/lbfgsb.html - - Therefore, it seems possible to re-incorporate this code into - NLopt, and I will look into this for a future release. - However, that will put NLopt under the terms of the GPL, so I - will need to keep it as an optional package. -- 2.30.2