Algebraic - Maple Help

Algebraic Form of Input for Optimization Package Commands

 This help page describes the algebraic form of input for commands in the Optimization package.  For general information on all the input forms accepted by the Optimization package commands, see the Optimization/InputForms help page.  For more information about options mentioned below, see the Optimization/Options help page.

Objective Function

 • The objective function of the optimization problem must be an algebraic expression in the problem variables, for example, exp(tan(x)) and ${x}^{2}+{y}^{2}-3x+3y+3$. The problem variables are the indeterminates in the objective function and, if provided, the constraints. They can also be specified using the variables option.
 • Some commands impose additional restrictions.  For example, Optimization[QPSolve] requires the objective function to be quadratic in the problem variables.
 • The Optimization[LSSolve] command accepts an objective function in least-squares form. This objective function is specified as a list of algebraic expressions $[{r}_{1},{r}_{2},...,{r}_{q}]$, where ${r}_{1}$, ${r}_{2}$, ..., ${r}_{q}$ represent the residuals to be minimized in a least-squares sense.  Thus, the objective function is $\left(\frac{1}{2}\right)\left({\left({r}_{1}\right)}^{2}+{\left({r}_{2}\right)}^{2}+...+{\left({r}_{q}\right)}^{2}\right)$.

Constraints

 • The constraints must be a set or list of relations.  Only relations of type <= and = are allowed.  An example is $\left\{w=1,2\le {y}^{2}+z,x\le 5\right\}$.
 • Some commands impose additional restrictions.  For example, Optimization[LPSolve] requires all relations in the constraint set to be linear in the problem variables.

Bounds

 • Specify the bounds as a sequence of arguments of the form $\mathrm{vname}=\mathrm{vrange}$, where vname is the name of a problem variable and vrange is its range, for example $y=-1..2$.
 • Bounds can be included with the general constraints.  For example, adding the inequalities $1.5\le x$ and $x\le 3.2$ to the constraint set is equivalent to specifying $x=1.5..3.2$.  Bounds are not required to be specified separately, though this usually leads to more efficient computation.
 • The problem variables are not assumed to be non-negative by default, but the $\mathrm{assume}=\mathrm{nonnegative}$ option can be used to specify this.

Initial Values

 • Specify the initial values using the option $\mathrm{initialpoint}=p$, where p is a set or list of equalities in the form $\mathrm{varname}=\mathrm{value}$. Each varname is one of the problem variables and value is the value to which it is initially set.  An example is $\mathrm{initialpoint}=\left\{x=-1.2,y=5.7\right\}$.

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 list containing elements of the form $\mathrm{varname}=\mathrm{value}$, where varname is a problem variable and value is its value.

Examples

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

Solve a linear program, quadratic program, and nonlinear program, all expressed in algebraic form.

 > $\mathrm{LPSolve}\left(-4x-5y,\left\{0\le x,0\le y,x+2y\le 6,5x+4y\le 20\right\}\right)$
 $\left[{-19.}{,}\left[{x}{=}{2.66666666666667}{,}{y}{=}{1.66666666666667}\right]\right]$ (1)
 > $\mathrm{QPSolve}\left(2x+5y+3{x}^{2}+3xy+2{y}^{2},\left\{2\le x-y\right\}\right)$
 $\left[{-3.53333333333333}{,}\left[{x}{=}{0.466666666666667}{,}{y}{=}{-1.60000000000000}\right]\right]$ (2)
 > $\mathrm{NLPSolve}\left(\frac{\mathrm{sin}\left(x\right)}{x},x=1..10\right)$
 $\left[{-0.217233628211222}{,}\left[{x}{=}{4.49340945753529}\right]\right]$ (3)