Matrix Form of Input for the GlobalOptimization Package - Global Optimization Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Toolboxes : Global Optimization : General information : GlobalOptimization/General/MatrixForm

Matrix Form of Input for the GlobalOptimization Package


This help page describes the Matrix form of input for commands in the GlobalOptimization package.  For general information on the input forms accepted by the GlobalOptimization package commands, see the GlobalOptimization/InputForms help page.

Using Matrix Form


The solvers perform most efficiently when given problems in Matrix form, with all the input specified as Vectors or procedures taking Vector parameters. Matrix form requires the least amount of preprocessing because it is most similar to the format used by the internal solvers.  This leads to reduced storage needs and faster computation.


Consider an optimization problem in the form:


minimize fx


subject to


vx0 (nonlinear inequality constraints)


wx=0 (nonlinear equality constraints)


 blxbu (bounds)


where x is the vector of problem variables, fx is the real-valued objective function, vx and wx are vector-valued functions of x, and bl and bu are vectors.  The dimension of x is n. The relations involving vectors are element-wise. The specifications of each component are given in the following sections.

Objective Function


The GlobalOptimization[GlobalSolve] command accepts a general nonlinear objective function fx specified by a procedure p of type procedure[float](Vector).  The procedure takes one input Vector parameter of size n representing x and returns the value of fx.  The value of n is passed separately to the GlobalSolve command because it cannot be determined from the procedure p.



Nonlinear constraints are accepted by the GlobalOptimization solvers. Unlike the Matrix form for the Optimization package, as described in Optimization/MatrixForm, the Matrix form for the GlobalOptimization package does not allow separate specification of linear constraints.  Both nonlinear and linear constraints are specified in a single procedure.


Consider nonlinear inequality constraints vx0 and nonlinear equality constraints wx=0.  Let yx be the vector consisting of vx followed by wx.  Then yx is represented by a procedure pcons of type procedure(Vector, Vector), where the first parameter is the current point x and the second is an output parameter containing the values of y at the point x. Because the GlobalSolve command cannot determine the number of inequality and equality constraints, this information must be specified in the calling sequence.


Procedures created for the Optimization package using the needc parameter, as described in Optimization/MatrixForm, are accepted by the GlobalSolve command, but the needc parameter is not used. For best performance, construct the pcons procedure without it.



Bounds on the problem variables are required by the GlobalSolve command.  They are provided as a list [bl, bu] containing lower bounds followed by upper bounds.  Bounds must evaluate to finite numeric values.


The bounds bl and bu can be specified as Vectors of dimension n or as numeric values.  If a numeric value is provided, it is interpreted as a Vector of dimension n in which each element is equal to that value.


Because finite bounds are required, the assume=nonnegative option, available in the Optimization package, is not accepted by GlobalOptimization commands.

Initial Values


The GlobalSolve command accepts initial values. Initial values are specified using the option initialpoint=p, where p is a Vector of dimension n. For more information on the initialpoint option, see the GlobalOptimization/Options help page.



The solution is a list objval,solpt where objval is a floating-point number representing the final minimum (or maximum) value and solpt is a Vector representing a point (the computed extremum).

Additional Requirements


For best performance, the components described previously must satisfy the following additional conditions.


All Vector arguments must be constructed with datatype=float. Otherwise, the solvers must perform conversions.


When possible, input procedures must be created so that they can be evaluated by the evalhf command. Otherwise, the solvers cannot take advantage of the more efficient evalhf mode of computation.


Procedures returning a scalar result must return a floating-point value in all cases, not simply an expression that evaluates to a float.


The following additional condition must be met. If a procedure returns a Vector result using an output parameter, only floating-point values can be assigned to the parameter.  Otherwise, an error is issued.



Minimize the objective function x12+y22 with constraints x21 and x+y12 over the region x=1..1,y=1..1.

The objective function is a procedure taking as input a Vector containing the x and y values.

p := proc (V)
     end proc:

The constraints are specified as a procedure that accepts a Vector containing the x and y values as input and returns a Vector containing the constraint values.

nlc := proc(V, W)
          W[1] := V[1]^2-1:
          W[2] := V[1]+V[2]-1/2
end proc:

The bounds are specified as Vectors of dimension 2.




Find the global solution to the problem.




See Also

GlobalOptimization, GlobalOptimization/InputForms, GlobalOptimization/Options, GlobalOptimization[GlobalSolve] (MatrixForm), Optimization, Optimization/MatrixForm

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam