chiark / gitweb /
auto updating of constant .m files
authorstevenj <stevenj@alum.mit.edu>
Mon, 3 Sep 2007 21:25:23 +0000 (17:25 -0400)
committerstevenj <stevenj@alum.mit.edu>
Mon, 3 Sep 2007 21:25:23 +0000 (17:25 -0400)
darcs-hash:20070903212523-c8de0-bcc71ab76958e9ce4f845ed01a649bab501de705.gz

17 files changed:
octave/Makefile.am
octave/NLOPT_GD_STOGO.m
octave/NLOPT_GD_STOGO_RAND.m
octave/NLOPT_GN_DIRECT.m
octave/NLOPT_GN_DIRECT_L.m
octave/NLOPT_GN_DIRECT_L_NOSCAL.m [new file with mode: 0644]
octave/NLOPT_GN_DIRECT_L_RAND.m
octave/NLOPT_GN_DIRECT_L_RAND_NOSCAL.m [new file with mode: 0644]
octave/NLOPT_GN_DIRECT_NOSCAL.m [new file with mode: 0644]
octave/NLOPT_GN_ORIG_DIRECT.m
octave/NLOPT_GN_ORIG_DIRECT_L.m
octave/NLOPT_LD_LBFGS.m
octave/NLOPT_LD_VAR1.m [new file with mode: 0644]
octave/NLOPT_LD_VAR2.m [new file with mode: 0644]
octave/NLOPT_LN_PRAXIS.m [new file with mode: 0644]
octave/NLOPT_LN_SUBPLEX.m
octave/mkconstants.sh [new file with mode: 0755]

index bee74e18c407c3ea3b3187b8c4a5623c9a6e5041..8bdd59b2842f88651a646b54ba949c69e6ad54c6 100644 (file)
@@ -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)
index 405226d70ccf68306da5bd7046c71ec1cc6b23af..67575c09dc17c7fffca553917506cb86761fdb76 100644 (file)
@@ -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;
index 39a6106ee23aa415d6c4fec8212ec8a798ee1828..decd945794d5b07146e38f88fe6e59e8dc18237e 100644 (file)
@@ -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;
index cfe4e9a591cd98705b79dd23658beab9185e1079..e6d9b81791e4f4c729d140bc43528caa920e1c1a 100644 (file)
@@ -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;
index fe725d7a60551fd42804eadbe888a4cf9a014988..f2e7c61d7e1cead3375a7f7d587b02b10a44d864 100644 (file)
@@ -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 (file)
index 0000000..9fd8330
--- /dev/null
@@ -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;
index fef4a5a5ef940f369b64500556abc1b6de0ca71e..2af256e1f1b34f955d630d98f40ada22cc48fd31 100644 (file)
@@ -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 (file)
index 0000000..58bbf60
--- /dev/null
@@ -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 (file)
index 0000000..285a1b4
--- /dev/null
@@ -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;
index 9ffab0d851fc5244406cbd7383d751a140f40f8a..59e7c2bca920518cfae45fb61362771b559566dc 100644 (file)
@@ -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;
index 52e182ea1ae89de2c9eaadb2b7d99f09db06542f..90e3c7531a11e7accd76f5db7be98cc3ab56c290 100644 (file)
@@ -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;
index 992daa505b76a7d775d6ebfccba8fdedb7b1ede9..47e125fe5ad78399c599cd90f5c01f2d06758c85 100644 (file)
@@ -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 (file)
index 0000000..0385562
--- /dev/null
@@ -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 (file)
index 0000000..fd9c229
--- /dev/null
@@ -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 (file)
index 0000000..c768cae
--- /dev/null
@@ -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;
index 4fb3579a4dbca043cddfbb4bb2c0d571f2b68152..10f0b5b9ef621b4b4c932874be548c0985354914 100644 (file)
@@ -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 (executable)
index 0000000..83876b1
--- /dev/null
@@ -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 <<EOF
+% $n: $desc
+%
+% See nlopt_minimize for more information.
+function val = $n
+  val = $i;
+EOF
+#    fi  
+    i=`expr $i + 1`
+done
+
+mfiles=`echo "$names" | tr '\n' ' ' | sed 's/ /.m /g'`
+perl -pi -e "s/^MFILES = .*\$/MFILES = $mfiles/" Makefile.am