Forms of Input for Optimization Package Commands

Algebraic Form


•

Algebraic form is the most commonly used form for specifying optimization problems. The
objective function
and
constraints
are given as algebraic expressions, such as or .

•

Algebraic form is accepted by all the Optimization package exports. It is the only form accepted by the Optimization[Interactive] Maplet application.

•

All computations performed by solvers in the Optimization package use floatingpoint Vectors and Matrices. Problems specified in algebraic form are converted to Matrix form by the solvers. The computation performed is numeric and floatingpoint results are returned, even if symbols or exact data are provided.



Operator Form


•

Using operator form, the objective function and the constraints are provided as procedures taking one or more parameters and returning a scalar.

•

Input in operator form is converted to Matrix form by the solver. Specifically, procedures are converted to take Vector parameters.



Matrix Form


•

Matrix form provides the greatest flexibility in specifying the problem and results in the most efficient performance by the solvers. However, it is also the most complex. Using Matrix form, the objective function and the constraints are specified as Vectors, Matrices, and procedures accepting and returning Vectors.

•

Matrix form input is converted to floatingpoint data if it is not of floatingpoint type. The Optimization solvers attempt to use hardware floatingpoint computation when possible and appropriate. To avoid unnecessary copying of Matrices and Vectors, create these objects with the datatype and storage recommended in the help pages of the specific Optimization commands.



Examples


>


Solve a linear programming problem specified using algebraic form. The objective function and the constraints are expressions in x and y.
>


 (1) 
Solve a linear programming problem specified using Matrix form.
>


 (2) 
Quadratic programming problems can be specified in algebraic form or in Matrix form.
>


 (3) 
>


 (4) 
Nonlinear programs can be specified in algebraic form or in Matrix form.
>


 (5) 
You should provide the gradient of the objective function if you want to use NLPSolve in Matrix form.
>

obj := proc(v)
10*v[1]^2  2*v[1]*v[2]^2 + v[2]^4 + 1  2*v[2] + v[2]^2
end proc:

>

objgrad := proc(v, w)
w[1] := 20*v[1]  2*v[2]^2:
w[2] := 4*v[1]*v[2] + 4*v[2]^3  2 + 2*v[2]
end proc:

>


 (6) 


See Also


Optimization, Optimization/AlgebraicForm, Optimization/MatrixForm, Optimization/OperatorForm, Optimization[Interactive], Optimization[LPSolve], Optimization[LSSolve], Optimization[Maximize], Optimization[Minimize], Optimization[NLPSolve], Optimization[QPSolve]

