Optimization[NLPSolve]  solve a nonlinear program

Calling Sequence


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


Parameters


obj



algebraic; objective function

constr



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

bd



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

opfobj



procedure; objective function

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, maximize, method, optimalitytolerance, or output; specify options for the NLPSolve command





Description


•

The NLPSolve command solves a
nonlinear program
(NLP), which involves computing the
minimum
(or
maximum
) of a realvalued
objective function
, possibly subject to
constraints
. Generally, a
local
minimum is returned unless the problem is
convex
. However,
global
search is available in limited situations, as described in the following Notes section. Most of the algorithms used by the NLPSolve command assume that the objective function and the constraints are twice continuously differentiable. NLPSolve will sometimes succeed even if these conditions are not met.


This help page describes the use of the NLPSolve command when the NLP is specified in algebraic or operator form. Summaries of these forms are given in the Optimization/AlgebraicForm and Optimization/OperatorForm help pages. NLPSolve also recognizes the problem in Matrix form (see the NLPSolve (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 an algebraic expression.


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 where varname is a variable name and 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 (or maximum) 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.

•

evaluationlimit = posint  Set the maximum number of objective function evaluations performed by the algorithm. This option is only available when the method option is set to branchandbound, modifiednewton, nonlinearsimplex or quadratic.

•

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). The initial point is ignored when the quadratic interpolation method is used. For more information, see the Optimization/Methods help page.

•

iterationlimit = posint  Set the maximum number of iterations performed by the solver. This option is only available when the method option is set to pcg or sqp.

•

maximize or maximize = truefalse  Maximize the objective function when equal to true and minimize when equal to false. The option 'maximize' is equivalent to maximize = true. The default is maximize = false.

•

method = branchandbound, modifiednewton, nonlinearsimplex, pcg, quadratic, or sqp  Specify the method. See the Optimization/Methods help page for more information.

•

nodelimit = posint  Set the maximum number of nodes searched in the branchandbound tree. This option is only available with the method = branchandbound option.

•

objectivetarget = realcons  Set the target objective function value which, if reached, causes the global search to terminate. This option is only available with the method = branchandbound option.

•

optimalitytolerance = realcons(positive)  Set the tolerance that determines whether an optimal point has been found.

•

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



Notes


•

The NLPSolve 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, so it is recommended that you provide a point using the initialpoint option. Otherwise, a point is automatically generated.

•

The NLPSolve command also provides a global
branchandbound
search algorithm for univariate problems having finite bounds but no other constraints. This method, specified with the method = branchandbound option, returns a global solution on the given interval.

•

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, the computation is more efficient when derivatives of the objective function and constraints are available. NLPSolve 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 NLPSolve (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.


Unlike the situation for linear programming, it is difficult to detect unboundedness in the nonlinear case and no warning is issued by NLPSolve. If the solution values seem unexpectedly large or small, it is possible that the solution is unbounded.

•

If NLPSolve 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


>


Minimize a univariate function over a given range.
>


 (1) 
Use options to maximize the objective function and to provide an initial point.
>


 (2) 
Solve a constrained minimization problem and assume that all the variables are nonnegative.
>


 (3) 
Minimize an objective involving a special function.
>


 (4) 
Define a procedure f and use the operator form of input.
>

f := proc(x)
if x < 0 then
x^2+1;
else
cos(x);
end if;
end proc:

>


 (5) 


See Also


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

