Optimization[LSSolve]  solve a leastsquares problem

Calling Sequence


LSSolve(obj, constr, bd, opts)
LSSolve(opfobj, ineqcon, eqcon, opfbd, opts)


Parameters


obj



list(algebraic); leastsquares residuals

constr



(optional) set(relation) or list(relation); constraints

bd



(optional) sequence of name = range; bounds for one or more variables

opfobj



list(procedure); leastsquares residuals

ineqcon



(optional) set(procedure) or list(procedure); inequality constraints

eqcon



(optional) set(procedure) or list(procedure); equality constraints

opfbd



(optional) sequence of ranges; bounds for all variables

opts



(optional) equation(s) of the form option = value where option is one of assume, feasibilitytolerance, infinitebound, initialpoint, iterationlimit, method, optimalitytolerance, or output; specify options for the LSSolve command





Description


•

This help page describes the use of the LSSolve command when the LS problem is specified in algebraic or operator form. Summaries of these forms are given in the Optimization/AlgebraicForm and Optimization/OperatorForm help pages. LSSolve also recognizes problems in Matrix form (see the LSSolve (Matrix Form) help page). Matrix form leads to more efficient computation, but is more complex.

•

The first calling sequence uses the algebraic form of input. The first parameter obj is the objective function, which must be a list of algebraic expressions .


The second parameter constr is optional and is a set or list of relations (of type `<=` or `=`) involving the problem variables. The problem variables are the indeterminates of type name found in obj and constr. They can also be specified using the variables option.


Bounds, bd, on one or more of the variables are given as additional arguments, each of the form varname = varrange where varname is a variable name and varrange is its range.


Inequality and equality constraints are provided using the optional ineqcon and eqcon parameters. An inequality constraint is specified by a procedure v in ineqcon that has the same form as opfobj and returns the lefthand side value of the constraint. Similarly, an equality constraint is specified by a procedure w in eqcon. Either ineqcon or eqcon may be empty.

•

For either form of input, nonnegativity of the variables is not assumed by default, but can be specified using the assume = nonnegative option. Bounds can include values having type infinity.

•

Maple returns the solution as a list containing the final minimum value and a point (the extremum). If the output = solutionmodule option is provided, then a module is returned. See the Optimization/Solution help page for more information.



Options



The opts argument can contain one or more of the following options. These options are described in more detail in the Optimization/Options help page.

•

assume = nonnegative  Assume that all variables are nonnegative.

•

feasibilitytolerance = realcons(positive)  Set the maximum absolute allowable constraint violation.

•

infinitebound = realcons(positive)  Set any value of a variable greater than the infinitebound value to be equivalent to infinity during the computation.

•

initialpoint = set(equation), list(equation), or list(numeric)  Use the provided initial point, which is a set or list of equations (for algebraic form input) or a list of exactly values (for operator form input).

•

iterationlimit = posint  Set the maximum number of iterations performed by the algorithm.

•

method = modifiednewton or sqp  Specify the method. See the Optimization/Methods help page for more information.

•

optimalitytolerance = realcons(positive)  Set the tolerance that determines whether an optimal point has been found. This option is not available when the problem is linear.

•

variables = list(name) or set(name)  Specify the problem variables when the objective function is in algebraic form.



Notes


•

The LSSolve command uses various methods implemented in a builtin library provided by the Numerical Algorithms Group (NAG). See the Optimization/Methods help page for more details. The solvers are iterative in nature and require an initial point. The quality of the solution can depend greatly on the point chosen, particularly for nonlinear problems, so it is recommended that you provide a point using the initialpoint option. Otherwise, a point is automatically generated.

•

The computation is performed in floatingpoint. Therefore, all data provided must have type realcons and all returned solutions are floatingpoint, even if the problem is specified with exact values. Because the solver fails when a complex value is encountered, it is sometimes necessary to add additional constraints to ensure that the objective function and constraints always evaluate to real values. For more information about numeric computation in the Optimization package, see the Optimization/Computation help page.

•

For some methods of solving nonlinear problems, the computation is more efficient when derivatives of the objective function and constraints are available. LSSolve attempts to compute these derivatives automatically, but better performance can be achieved by directly providing derivatives using the Matrix form calling sequence described in the LSSolve (Matrix Form) help page. For information on the methods that use derivatives, see the Optimization/Methods help page.

•

Although the assume = nonnegative option is accepted, general assumptions are not supported by commands in the Optimization package.

•

An answer is returned when necessary firstorder conditions for optimality have been met and the iterates have converged. If the initial point already satisfies the conditions, then a warning is issued. Generally, the result is a local extremum but it is possible for the solver to return a
saddle point
. It is recommended that you try different initial points with each problem to verify that the solution is indeed an extremum.


Occasionally the solver will return a solution even if the iterates have not converged but the point satisfies the firstorder conditions. Setting infolevel[Optimization] to 1 or higher will produce a message indicating this situation if it occurs.

•

If LSSolve returns an error saying that no solution could be found, it is recommended that you try a different initial point or use tolerance parameters that are less restrictive.



Examples


>


Solve an LS problem with three linear residuals. The objective function in this case is .
>


 (1) 
Solve an LS problem with nonlinear residuals. Provide an initial point using the initialpoint option.
>


 (2) 
Solve a linearly constrained linear LS problem.
>


 (3) 
Solve an LS problem with a nonlinear constraint.
>


 (4) 


See Also


CurveFitting, Optimization, Optimization/AlgebraicForm, Optimization/Computation, Optimization/MatrixForm, Optimization/Methods, Optimization/OperatorForm, Optimization/Options, Optimization/Solution, Optimization[LSSolve] (MatrixForm), realcons

