# HG changeset patch
# User address@hidden
# Date 1224878022 25200
# Node ID d17dcde87d9d39c62010351ff327d2eaa689a65d
# Parent 095b3e4d64e99065bba14a14fcf849cc68a14fff
Add optional arguement, max_iter, to qp() that specifies maximum number of
iterations.
diff -r 095b3e4d64e9 -r d17dcde87d9d scripts/ChangeLog
--- a/scripts/ChangeLog Thu Oct 23 13:00:46 2008 -0400
+++ b/scripts/ChangeLog Fri Oct 24 12:53:42 2008 -0700
@@ -1,3 +1,7 @@ 2008-10-22 Ben Abbott
+
+ * scripts/optimization/qp.m: Add optional max_iter parameter to qp().
+
2008-10-22 Ben Abbott
* plot/cla.m: Fix error when no children to clear.
diff -r 095b3e4d64e9 -r d17dcde87d9d scripts/optimization/qp.m
--- a/scripts/optimization/qp.m Thu Oct 23 13:00:46 2008 -0400
+++ b/scripts/optimization/qp.m Fri Oct 24 12:53:42 2008 -0700
@@ -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{max_iter})
## Solve the quadratic program
## @iftex
## @tex
@@ -57,6 +57,7 @@
## 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.
+## If max_iter is present, it specifies the maximum number of iterations (default 200).
##
## The value @var{info} is a structure with the following fields:
## @table @code
@@ -79,9 +80,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, max_iter)
- if (nargin == 5 || nargin == 7 || nargin == 10)
+ if (nargin == 5 || nargin == 7 || nargin == 10 || nargin == 11)
+ if (nargin < 11)
+ max_iter = 200;
+ endif
## Checking the quadratic penalty
n = issquare (H);
@@ -271,11 +275,9 @@ function [x, obj, INFO, lambda] = qp (x0
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);
+ [x, lambda, info, iter] = __qp__ (x0, H, q, A, b, Ain, bin, max_iter);
else
iter = 0;
x = x0;