# HG changeset patch # User Joshua Redstone # Date 1233531619 28800 # Node ID 5edcde5a1f0599e726e05b6d8e047dae932261ae # Parent e50b44b7589155edd047c49f73f918d0c9214389 Add option to qp() to specify maximum iterations diff -r e50b44b75891 -r 5edcde5a1f05 ChangeLog --- a/ChangeLog Sun Feb 01 20:40:10 2009 +0100 +++ b/ChangeLog Sun Feb 01 15:40:19 2009 -0800 @@ -1,3 +1,8 @@ +2009-02-01 Joshua Redstone + + * scripts/optimization/qp.m: Add extra argument, max_iter, to qp(), + specifying the maximum number of iterations. + 2009-02-01 Thorsten Meyer * autogen.sh: Remove printing of cvs motd. diff -r e50b44b75891 -r 5edcde5a1f05 scripts/optimization/qp.m --- a/scripts/optimization/qp.m Sun Feb 01 20:40:10 2009 +0100 +++ b/scripts/optimization/qp.m Sun Feb 01 15:40:19 2009 -0800 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} address@hidden, @var{obj}, @var{info}, @var{lambda}] =} qp (@var{x0}, @var{H}, @var{q}, @var{A}, @var{b}, @var{lb}, @var{ub}, @var{A_lb}, @var{A_in}, @var{A_ub}) +## @deftypefn {Function File} address@hidden, @var{obj}, @var{info}, @var{lambda}] =} qp (@var{x0}, @var{H}, @var{q}, @var{A}, @var{b}, @var{lb}, @var{ub}, @var{A_lb}, @var{A_in}, @var{A_ub}, @var{maxit}) ## Solve the quadratic program ## @iftex ## @tex @@ -57,6 +57,8 @@ ## Any bound (@var{A}, @var{b}, @var{lb}, @var{ub}, @var{A_lb}, ## @var{A_ub}) may be set to the empty matrix (@code{[]}) if not ## present. If the initial guess is feasible the algorithm is faster. +## maxit, if present, specifies the maximum number of iterations to execute for +## (default 200). ## ## The value @var{info} is a structure with the following fields: ## @table @code @@ -79,9 +81,12 @@ ## @end table ## @end deftypefn -function [x, obj, INFO, lambda] = qp (x0, H, q, A, b, lb, ub, A_lb, A_in, A_ub) +function [x, obj, INFO, lambda] = qp (x0, H, q, A, b, lb, ub, A_lb, A_in, A_ub, maxit) - if (nargin == 5 || nargin == 7 || nargin == 10) + if (nargin == 5 || nargin == 7 || nargin == 10 || nargin == 11) + if (nargin < 11) + maxit = 200; + endif ## Checking the quadratic penalty n = issquare (H); @@ -309,10 +314,8 @@ endif if (info == 0) - ## FIXME -- make maxit a user option. ## The initial (or computed) guess is feasible. ## We call the solver. - maxit = 200; [x, lambda, info, iter] = __qp__ (x0, H, q, A, b, Ain, bin, maxit); else iter = 0;