From: stevenj Date: Wed, 16 Jun 2010 00:45:10 +0000 (-0400) Subject: change lb/ub field in Matlab interface to lower_bounds/upper_bounds, for consistency X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e20f4b4eb7fb21c3665245ff87c1689dfc052501;p=nlopt.git change lb/ub field in Matlab interface to lower_bounds/upper_bounds, for consistency darcs-hash:20100616004510-c8de0-9ef715297bbfeaf62e5ee94485294500f41dd1cf.gz --- diff --git a/octave/nlopt_minimize_constrained.m b/octave/nlopt_minimize_constrained.m index fb9d503..8d3cee6 100644 --- a/octave/nlopt_minimize_constrained.m +++ b/octave/nlopt_minimize_constrained.m @@ -95,8 +95,8 @@ if (isfield(stop, 'minf_max')) end opt.algorithm = algorithm; opt.min_objective = @(x) f(x, f_data{:}); -opt.lb = lb; -opt.ub = ub; +opt.lower_bounds = lb; +opt.upper_bounds = ub; for i = 1:length(fc) opt.fc{i} = @(x) fc{i}(x, fc_data{i}{:}); end diff --git a/octave/nlopt_optimize-mex.c b/octave/nlopt_optimize-mex.c index cde3a44..56ca0d9 100644 --- a/octave/nlopt_optimize-mex.c +++ b/octave/nlopt_optimize-mex.c @@ -135,9 +135,9 @@ nlopt_opt make_opt(const mxArray *opts, unsigned n) opt = nlopt_create(algorithm, n); CHECK1(opt, "nlopt: out of memory"); - nlopt_set_lower_bounds(opt, struct_arrval(opts, "lb", n, + nlopt_set_lower_bounds(opt, struct_arrval(opts, "lower_bounds", n, fill(tmp, n, -HUGE_VAL))); - nlopt_set_upper_bounds(opt, struct_arrval(opts, "ub", n, + nlopt_set_upper_bounds(opt, struct_arrval(opts, "upper_bounds", n, fill(tmp, n, +HUGE_VAL))); nlopt_set_stopval(opt, struct_val_default(opts, "stopval", -HUGE_VAL)); diff --git a/octave/nlopt_optimize-oct.cc b/octave/nlopt_optimize-oct.cc index f95f7ec..f5b1dd6 100644 --- a/octave/nlopt_optimize-oct.cc +++ b/octave/nlopt_optimize-oct.cc @@ -151,13 +151,13 @@ nlopt_opt make_opt(Octave_map &opts, int n) CHECK1(opt, "nlopt: out of memory"); Matrix m_inf(1, n, -HUGE_VAL); - Matrix lb = struct_val_default(opts, "lb", m_inf); - CHECK1(n == lb.length(), "wrong length of opt.lb"); + Matrix lb = struct_val_default(opts, "lower_bounds", m_inf); + CHECK1(n == lb.length(), "wrong length of opt.lower_bounds"); CHECK1(nlopt_set_lower_bounds(opt, lb.data()) > 0, "nlopt: out of memory"); Matrix p_inf(1, n, +HUGE_VAL); - Matrix ub = struct_val_default(opts, "ub", p_inf); - CHECK1(n == ub.length(), "wrong length of opt.ub"); + Matrix ub = struct_val_default(opts, "upper_bounds", p_inf); + CHECK1(n == ub.length(), "wrong length of opt.upper_bounds"); CHECK1(nlopt_set_upper_bounds(opt, ub.data()) > 0, "nlopt: out of memory"); nlopt_set_stopval(opt, struct_val_default(opts, "stopval", -HUGE_VAL)); diff --git a/octave/nlopt_optimize.m b/octave/nlopt_optimize.m index 6d0d85b..1377689 100644 --- a/octave/nlopt_optimize.m +++ b/octave/nlopt_optimize.m @@ -35,11 +35,12 @@ % BOUND CONSTRAINTS: % % Lower and/or upper bounds for the design variables x are specified -% via opt.lb and/or opt.ub, respectively: these are vectors (of the -% same length as xinit, above) giving the bounds in each component. -% An unbounded component may be specified by a lower/upper bound of -% -inf/+inf, respectively. If opt.lb and/or opt.ub are not specified, -% the default bounds are -inf/+inf (i.e. unbounded), respectively. +% via opt.lower_bounds and/or opt.upper_bounds, respectively: these +% are vectors (of the same length as xinit, above) giving the bounds +% in each component. An unbounded component may be specified by a +% lower/upper bound of -inf/+inf, respectively. If opt.lower_bounds +% and/or opt.upper_bounds are not specified, the default bounds are +% -inf/+inf (i.e. unbounded), respectively. % % NONLINEAR CONSTRAINTS: %