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:
v⁡x≤0 (nonlinear inequality constraints)
w⁡x=0 (nonlinear equality constraints)
where x is the vector of problem variables, f⁡x is the real-valued objective function, v⁡x and w⁡x 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.
The GlobalOptimization[GlobalSolve] command accepts a general nonlinear objective function f⁡x 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 f⁡x. 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 v⁡x≤0 and nonlinear equality constraints w⁡x=0. Let y⁡x be the vector consisting of v⁡x followed by w⁡x. Then y⁡x 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.
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).
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 x−12+y−22 with constraints x2≤1 and x+y≤12 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)
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 := V^2-1:
W := V+V-1/2
The bounds are specified as Vectors of dimension 2.
bl ≔ Vector⁡−1,−1,datatype=float:
bu ≔ Vector⁡1,1,datatype=float:
bd ≔ bl,bu:
Find the global solution to the problem.
Download Help Document
What kind of issue would you like to report? (Optional)