# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1316880264 18000 # Node ID 88bd1d1d66575b9da92f923641bfe9e40f77bc1c # Parent bd2cd4fd3edf77902fcde6a0130a98222e3f4c33 Reword sqp's docstring diff --git a/scripts/optimization/sqp.m b/scripts/optimization/sqp.m --- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}) ## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}) ## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}) -## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}, @var{tolerance}) +## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}, @var{tol}) ## Solve the nonlinear program ## @tex ## $$ @@ -62,14 +62,8 @@ ## The first argument is the initial guess for the vector @var{x0}. ## ## The second argument is a function handle pointing to the objective -## function. The objective function must be of the form -## -## @example -## @var{y} = phi (@var{x}) -## @end example -## -## @noindent -## in which @var{x} is a vector and @var{y} is a scalar. +## function @var{phi}. The objective function must accept one vector +## argument and return a scalar. ## ## The second argument may also be a 2- or 3-element cell array of ## function handles. The first element should point to the objective @@ -80,40 +74,18 @@ ## differences. If the Hessian function is not supplied, a BFGS update ## formula is used to approximate the Hessian. ## -## When supplied, the gradient function must be of the form -## -## @example -## @var{g} = gradient (@var{x}) -## @end example -## -## @noindent -## in which @var{x} is a vector and @var{g} is a vector. -## -## When supplied, the Hessian function must be of the form -## -## @example -## @var{h} = hessian (@var{x}) -## @end example +## When supplied, the gradient function @code{@var{phi}@{2@}} must accept +## one vector argument and return a vector. When supplifed, the Hessian +## function @code{@var{phi}@{3@}} must accept one vector argument and +## return a matrix. ## -## @noindent -## in which @var{x} is a vector and @var{h} is a matrix. -## -## The third and fourth arguments are function handles pointing to -## functions that compute the equality constraints and the inequality -## constraints, respectively. -## -## If the problem does not have equality (or inequality) constraints, -## then use an empty matrix ([]) for @var{cef} (or @var{cif}). -## -## When supplied, the equality and inequality constraint functions must be -## of the form -## -## @example -## @var{r} = f (@var{x}) -## @end example -## -## @noindent -## in which @var{x} is a vector and @var{r} is a vector. +## The third and fourth arguments @var{g} and @var{h} are function +## handles pointing to functions that compute the equality constraints +## and the inequality constraints, respectively. If the problem does +## not have equality (or inequality) constraints, then use an empty +## matrix ([]) for @var{g} (or @var{h}). When supplied, these equality +## and inequality constraint functions must accept one vector argument +## and return a vector. ## ## The third and fourth arguments may also be 2-element cell arrays of ## function handles. The first element should point to the constraint @@ -137,19 +109,20 @@ ## @end example ## ## @end ifnottex -## The fifth and sixth arguments contain lower and upper bounds -## on @var{x}. These must be consistent with the equality and inequality -## constraints @var{g} and @var{h}. If the arguments are vectors then -## @var{x}(i) is bound by @var{lb}(i) and @var{ub}(i). A bound can also -## be a scalar in which case all elements of @var{x} will share the same -## bound. If only one bound (lb, ub) is specified then the other will -## default to (-@var{realmax}, +@var{realmax}). +## The fifth and sixth arguments, @var{lb} and @var{ub}, contain lower +## and upper bounds on @var{x}. These must be consistent with the +## equality and inequality constraints @var{g} and @var{h}. If the +## arguments are vectors then @var{x}(i) is bound by @var{lb}(i) and +## @var{ub}(i). A bound can also be a scalar in which case all elements +## of @var{x} will share the same bound. If only one bound (lb, ub) is +## specified then the other will default to (-@var{realmax}, +## +@var{realmax}). ## -## The seventh argument specifies the maximum number of iterations. -## The default value is 100. +## The seventh argument @var{maxiter} specifies the maximum number of +## iterations. The default value is 100. ## -## The eighth argument specifies the tolerance for the stopping criteria. -## The default value is @code{sqrt(eps)}. +## The eighth argument @var{tol} specifies the tolerance for the +## stopping criteria. The default value is @code{sqrt(eps)}. ## ## The value returned in @var{info} may be one of the following: ## @@ -163,7 +136,7 @@ ## @ifnottex ## delta @var{x}, ## @end ifnottex -## is less than @code{tol * norm (x)}. +## is less than @code{@var{tol} * norm (x)}. ## ## @item 102 ## The BFGS update failed.