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

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 $f\left(x\right)$
 subject to
 $v\left(x\right)\le 0$ (nonlinear inequality constraints)
 $w\left(x\right)=0$ (nonlinear equality constraints)
 $\mathrm{bl}\le x\le \mathrm{bu}$ (bounds)
 where $x$ is the vector of problem variables, $f\left(x\right)$ is the real-valued objective function, $v\left(x\right)$ and $w\left(x\right)$ are vector-valued functions of $x$, and $\mathrm{bl}$ and $\mathrm{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 $f\left(x\right)$ 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\left(x\right)$.  The value of $n$ is passed separately to the GlobalSolve command because it cannot be determined from the procedure p.

Constraints

 • 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\left(x\right)\le 0$ and nonlinear equality constraints $w\left(x\right)=0$.  Let $y\left(x\right)$ be the vector consisting of $v\left(x\right)$ followed by $w\left(x\right)$.  Then $y\left(x\right)$ 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

 • 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.

Solution

 • The solution is a list $\left[\mathrm{objval},\mathrm{solpt}\right]$ 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.

Examples

 > $\mathrm{with}\left(\mathrm{GlobalOptimization}\right):$

Minimize the objective function ${\left(x-1\right)}^{2}+{\left(y-2\right)}^{2}$ with constraints ${x}^{2}\le 1$ and $x+y\le \frac{1}{2}$ 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)         (V[1]-1)^2+(V[2]-2)^2      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.

 > $\mathrm{bl}≔\mathrm{Vector}\left(\left[-1,-1\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{bu}≔\mathrm{Vector}\left(\left[1,1\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{bd}≔\left[\mathrm{bl},\mathrm{bu}\right]:$

Find the global solution to the problem.

 > $\mathrm{GlobalSolve}\left(2,p,\left[2,0\right],\mathrm{nlc},\mathrm{bd}\right)$
 $\left[{3.12499975185340784}{,}\left[\begin{array}{c}{-}{0.249978570091025}\\ {0.749978669715350}\end{array}\right]\right]$ (1)