 Input Form: Operator - Maple Help

Operator Form of Input for the GlobalOptimization Package

 This help page describes the operator 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.
 The descriptions of the various components below assume that the optimization problem involves minimizing or maximizing a function of the variables $\mathrm{x1},\mathrm{x2},...,\mathrm{xn}$. Objective Function

 • Specify the objective function as a procedure that accepts $n$ floating-point parameters corresponding to the problem variables and returns a float. Constraints

 • Specify the inequality constraints as a set or list of procedures.  A single constraint $v\left(\mathrm{x1},\mathrm{x2},...,\mathrm{xn}\right)\le 0$ is specified as a procedure v of the same form as the objective function previously described and returning the left-hand side value of the constraint.
 • Specify the equality constraints also as a set or list of procedures.  Each constraint $w\left(\mathrm{x1},\mathrm{x2},...,\mathrm{xn}\right)=0$ is specified as a procedure returning the left-hand side value of the constraint. Bounds

 • Specify bounds as a sequence of ranges.  For example, the sequence $-1.0..2.5,0.5..3.2$ indicates that the first problem variable is constrained between $-1.0$ and $2.5$, and the second is constrained between $0.5$ and $3.2$.  There must be exactly one range for each problem variable and the endpoints of each range must evaluate to finite numeric values.
 • Because finite bounds are required, the assume=nonnegative option, available in the Optimization package, is not accepted by GlobalOptimization commands. Initial Values

 • Specify the initial values using the option initialpoint=p, where p is a list of realcons.  The list must contain one value for each problem variable.  For more information on the initialpoint option, see the GlobalOptimization/Options help page. Solution

 • Maple returns the solution as a list containing the final minimum (or maximum) value and a point (the computed extremum).  The point is a Vector containing the values of the problem variables. Notes

 • In general, the GlobalOptimization solvers attempt to evaluate procedures with the evalhf command, but this is not possible with operator form procedures.  It is recommended that you do not use operator form unless ease-of-use is more important than efficiency. For more information on how to achieve efficient computation, see the GlobalOptimization/Computation help page. Examples

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

Solve a minimization problem using operator form.  The objective function ${x}^{2}-y$ is specified as a procedure taking two input parameters, corresponding to the problem variables, and returning a scalar.

 > GlobalSolve(proc(x,y) x^2-y end proc, -1..1, -1..1);
 $\left[{-1.}{,}\left[\begin{array}{c}{-1.65436122510606}{×}{{10}}^{{-24}}\\ {1.}\end{array}\right]\right]$ (1)

Solve a minimization problem with the objective function $x-y$ and constraints $x-y\le 1$ and ${y}^{2}-x\le 2$.  Each constraint is specified in the same way as the objective function.

 > $\mathrm{GlobalSolve}\left(\left(x,y\right)→x-y,\left\{\left(x,y\right)→x-y-1,\left(x,y\right)→{y}^{2}-x-2\right\},0..3,0..3\right)$
 $\left[{-1.41421356237922335}{,}\left[\begin{array}{c}{0.}\\ {1.41421356237922}\end{array}\right]\right]$ (2)

Find the global minimum of a piecewise function.

 > p:= proc(x)     piecewise(x < -1, x^4-x+2, x < 1, x^3+x^2+7, x < 3, x^2+3) end proc;
 ${p}{≔}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{piecewise}}{}\left({x}{<}{−}{1}{,}{x}{^}{4}{-}{x}{+}{2}{,}{x}{<}{1}{,}{x}{^}{3}{+}{x}{^}{2}{+}{7}{,}{x}{<}{3}{,}{x}{^}{2}{+}{3}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (3)
 > $\mathrm{GlobalSolve}\left(p,-2..2\right)$
 $\left[{4.00000005349798}{,}\left[\begin{array}{c}{-1.00000001069960}\end{array}\right]\right]$ (4)