From: stevenj Date: Mon, 3 Sep 2007 21:25:23 +0000 (-0400) Subject: auto updating of constant .m files X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4c117224fe6e1e9f2a56b3bf61ce1106adb67f25;p=nlopt.git auto updating of constant .m files darcs-hash:20070903212523-c8de0-bcc71ab76958e9ce4f845ed01a649bab501de705.gz --- diff --git a/octave/Makefile.am b/octave/Makefile.am index bee74e1..8bdd59b 100644 --- a/octave/Makefile.am +++ b/octave/Makefile.am @@ -1,10 +1,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/api -MFILES = NLOPT_GN_DIRECT_L.m NLOPT_GN_DIRECT_L_RAND.m \ -NLOPT_GN_DIRECT.m NLOPT_GN_ORIG_DIRECT_L.m \ -NLOPT_GN_ORIG_DIRECT.m NLOPT_GD_STOGO.m \ -NLOPT_GD_STOGO_RAND.m NLOPT_LD_LBFGS.m \ -NLOPT_LN_SUBPLEX.m nlopt_minimize.m +MFILES = NLOPT_GN_DIRECT.m NLOPT_GN_DIRECT_L.m NLOPT_GN_DIRECT_L_RAND.m NLOPT_GN_DIRECT_NOSCAL.m NLOPT_GN_DIRECT_L_NOSCAL.m NLOPT_GN_DIRECT_L_RAND_NOSCAL.m NLOPT_GN_ORIG_DIRECT.m NLOPT_GN_ORIG_DIRECT_L.m NLOPT_LN_SUBPLEX.m NLOPT_GD_STOGO.m NLOPT_GD_STOGO_RAND.m NLOPT_LD_LBFGS.m NLOPT_LN_PRAXIS.m NLOPT_LD_VAR1.m NLOPT_LD_VAR2.m octdir = $(OCT_INSTALL_DIR) mdir = $(M_INSTALL_DIR) diff --git a/octave/NLOPT_GD_STOGO.m b/octave/NLOPT_GD_STOGO.m index 405226d..67575c0 100644 --- a/octave/NLOPT_GD_STOGO.m +++ b/octave/NLOPT_GD_STOGO.m @@ -1,2 +1,5 @@ -function a = NLOPT_GD_STOGO - a = 9; +% NLOPT_GD_STOGO: StoGO (global, derivative-based) +% +% See nlopt_minimize for more information. +function val = NLOPT_GD_STOGO + val = 9; diff --git a/octave/NLOPT_GD_STOGO_RAND.m b/octave/NLOPT_GD_STOGO_RAND.m index 39a6106..decd945 100644 --- a/octave/NLOPT_GD_STOGO_RAND.m +++ b/octave/NLOPT_GD_STOGO_RAND.m @@ -1,2 +1,5 @@ -function a = NLOPT_GD_STOGO_RAND - a = 10; +% NLOPT_GD_STOGO_RAND: StoGO with randomized search (global, derivative-based) +% +% See nlopt_minimize for more information. +function val = NLOPT_GD_STOGO_RAND + val = 10; diff --git a/octave/NLOPT_GN_DIRECT.m b/octave/NLOPT_GN_DIRECT.m index cfe4e9a..e6d9b81 100644 --- a/octave/NLOPT_GN_DIRECT.m +++ b/octave/NLOPT_GN_DIRECT.m @@ -1,2 +1,5 @@ -function a = NLOPT_GN_DIRECT - a = 0; +% NLOPT_GN_DIRECT: DIRECT (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_DIRECT + val = 0; diff --git a/octave/NLOPT_GN_DIRECT_L.m b/octave/NLOPT_GN_DIRECT_L.m index fe725d7..f2e7c61 100644 --- a/octave/NLOPT_GN_DIRECT_L.m +++ b/octave/NLOPT_GN_DIRECT_L.m @@ -1,2 +1,5 @@ -function a = NLOPT_GN_DIRECT_L - a = 1; +% NLOPT_GN_DIRECT_L: DIRECT-L (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_DIRECT_L + val = 1; diff --git a/octave/NLOPT_GN_DIRECT_L_NOSCAL.m b/octave/NLOPT_GN_DIRECT_L_NOSCAL.m new file mode 100644 index 0000000..9fd8330 --- /dev/null +++ b/octave/NLOPT_GN_DIRECT_L_NOSCAL.m @@ -0,0 +1,5 @@ +% NLOPT_GN_DIRECT_L_NOSCAL: Unscaled DIRECT-L (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_DIRECT_L_NOSCAL + val = 4; diff --git a/octave/NLOPT_GN_DIRECT_L_RAND.m b/octave/NLOPT_GN_DIRECT_L_RAND.m index fef4a5a..2af256e 100644 --- a/octave/NLOPT_GN_DIRECT_L_RAND.m +++ b/octave/NLOPT_GN_DIRECT_L_RAND.m @@ -1,2 +1,5 @@ -function a = NLOPT_GN_DIRECT_L_RAND - a = 2; +% NLOPT_GN_DIRECT_L_RAND: Randomized DIRECT-L (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_DIRECT_L_RAND + val = 2; diff --git a/octave/NLOPT_GN_DIRECT_L_RAND_NOSCAL.m b/octave/NLOPT_GN_DIRECT_L_RAND_NOSCAL.m new file mode 100644 index 0000000..58bbf60 --- /dev/null +++ b/octave/NLOPT_GN_DIRECT_L_RAND_NOSCAL.m @@ -0,0 +1,5 @@ +% NLOPT_GN_DIRECT_L_RAND_NOSCAL: Unscaled Randomized DIRECT-L (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_DIRECT_L_RAND_NOSCAL + val = 5; diff --git a/octave/NLOPT_GN_DIRECT_NOSCAL.m b/octave/NLOPT_GN_DIRECT_NOSCAL.m new file mode 100644 index 0000000..285a1b4 --- /dev/null +++ b/octave/NLOPT_GN_DIRECT_NOSCAL.m @@ -0,0 +1,5 @@ +% NLOPT_GN_DIRECT_NOSCAL: Unscaled DIRECT (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_DIRECT_NOSCAL + val = 3; diff --git a/octave/NLOPT_GN_ORIG_DIRECT.m b/octave/NLOPT_GN_ORIG_DIRECT.m index 9ffab0d..59e7c2b 100644 --- a/octave/NLOPT_GN_ORIG_DIRECT.m +++ b/octave/NLOPT_GN_ORIG_DIRECT.m @@ -1,2 +1,5 @@ -function a = NLOPT_GN_ORIG_DIRECT - a = 6; +% NLOPT_GN_ORIG_DIRECT: Original DIRECT version (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_ORIG_DIRECT + val = 6; diff --git a/octave/NLOPT_GN_ORIG_DIRECT_L.m b/octave/NLOPT_GN_ORIG_DIRECT_L.m index 52e182e..90e3c75 100644 --- a/octave/NLOPT_GN_ORIG_DIRECT_L.m +++ b/octave/NLOPT_GN_ORIG_DIRECT_L.m @@ -1,2 +1,5 @@ -function a = NLOPT_GN_ORIG_DIRECT_L - a = 7; +% NLOPT_GN_ORIG_DIRECT_L: Original DIRECT-L version (global, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_GN_ORIG_DIRECT_L + val = 7; diff --git a/octave/NLOPT_LD_LBFGS.m b/octave/NLOPT_LD_LBFGS.m index 992daa5..47e125f 100644 --- a/octave/NLOPT_LD_LBFGS.m +++ b/octave/NLOPT_LD_LBFGS.m @@ -1,2 +1,5 @@ -function a = NLOPT_LD_LBFGS - a = 11; +% NLOPT_LD_LBFGS: Low-storage BFGS (LBFGS) (local, derivative-based) +% +% See nlopt_minimize for more information. +function val = NLOPT_LD_LBFGS + val = 11; diff --git a/octave/NLOPT_LD_VAR1.m b/octave/NLOPT_LD_VAR1.m new file mode 100644 index 0000000..0385562 --- /dev/null +++ b/octave/NLOPT_LD_VAR1.m @@ -0,0 +1,5 @@ +% NLOPT_LD_VAR1: Limited-memory variable-metric, rank 1 (local, derivative-based) +% +% See nlopt_minimize for more information. +function val = NLOPT_LD_VAR1 + val = 13; diff --git a/octave/NLOPT_LD_VAR2.m b/octave/NLOPT_LD_VAR2.m new file mode 100644 index 0000000..fd9c229 --- /dev/null +++ b/octave/NLOPT_LD_VAR2.m @@ -0,0 +1,5 @@ +% NLOPT_LD_VAR2: Limited-memory variable-metric, rank 2 (local, derivative-based) +% +% See nlopt_minimize for more information. +function val = NLOPT_LD_VAR2 + val = 14; diff --git a/octave/NLOPT_LN_PRAXIS.m b/octave/NLOPT_LN_PRAXIS.m new file mode 100644 index 0000000..c768cae --- /dev/null +++ b/octave/NLOPT_LN_PRAXIS.m @@ -0,0 +1,5 @@ +% NLOPT_LN_PRAXIS: Principal-axis, praxis (local, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_LN_PRAXIS + val = 12; diff --git a/octave/NLOPT_LN_SUBPLEX.m b/octave/NLOPT_LN_SUBPLEX.m index 4fb3579..10f0b5b 100644 --- a/octave/NLOPT_LN_SUBPLEX.m +++ b/octave/NLOPT_LN_SUBPLEX.m @@ -1,2 +1,5 @@ -function a = NLOPT_LN_SUBPLEX - a = 8; +% NLOPT_LN_SUBPLEX: Subplex (local, no-derivative) +% +% See nlopt_minimize for more information. +function val = NLOPT_LN_SUBPLEX + val = 8; diff --git a/octave/mkconstants.sh b/octave/mkconstants.sh new file mode 100755 index 0000000..83876b1 --- /dev/null +++ b/octave/mkconstants.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +names=`egrep NLOPT_[LG][ND] ../api/nlopt.h |sed 's/ //g' |tr = , |cut -d, -f1` +i=0 + +desc_start=`grep -n nlopt_algorithm_names ../api/nlopt.c |cut -d: -f1 |head -1` + +for n in $names; do +# if test -r $n.m; then +# perl -pi -e "s/val = [0-9]+;/val = $i;/" $n.m +# else + descline=`expr $i + $desc_start + 1` + desc=`tail -n +$descline ../api/nlopt.c |head -1 |cut -d\" -f2` + cat > $n.m <