Optimization - Maple Programming Help

Home : Support : Online Help : Mathematics : Optimization : Optimization Package : Optimization/QPSolve

Optimization

 QPSolve

 Calling Sequence QPSolve(obj, constr, bd, opts)

Parameters

 obj - algebraic; quadratic objective function constr - (optional) set(relation) or list(relation); linear constraints bd - (optional) sequence of name = range; bounds for one or more variables opts - (optional) equation(s) of the form option = value where option is one of assume, feasibilitytolerance, infinitebound, initialpoint, iterationlimit, maximize, output, or useunits; specify options for the QPSolve command

Description

 • The QPSolve command solves a quadratic program (QP), which involves computing the minimum (or maximum) of a quadratic objective function possibly subject to linear constraints.
 • This help page describes the use of the QPSolve command when the QP is specified in algebraic form.  A summary of this form is given in the Optimization/AlgebraicForm help page. QPSolve also recognizes the problem in Matrix form (see the QPSolve (Matrix Form) help page). Matrix form leads to more efficient computation, but is more complex .
 • The first parameter obj is the objective function, which must be an algebraic expression, quadratic in the problem variables.  If obj is linear, the Optimization[LPSolve] command is automatically called.
 The second parameter constr is optional and is a set or list of relations (of type <= or =), linear in the problem variables.  The problem variables are the indeterminates of type name found in obj and constr. They can also be specified using the variables option.
 Bounds on one or more of the variables are given as additional arguments, each of the form $\mathrm{varname}=\mathrm{varrange}$ where varname is a variable name and $\mathrm{varrange}$ is its range.  The range endpoints can include values of type infinity. Non-negativity of the problem variables is not assumed by default, but can be specified with the assume = nonnegative option.
 • Maple returns the solution as a list containing the final minimum (or maximum) value and a point (the extremum).  If the output = solutionmodule option is provided, then a module is returned.  See the Optimization/Solution help page for more information.
 If the quadratic program is convex, a global minimum is returned. Otherwise, the solution may be a local minimum.

Options

 The opts argument can contain one or more of the following options. These options are described in more detail in the Optimization/Options help page.
 • assume = nonnegative -- Assume all variables are non-negative.
 • feasibilitytolerance = realcons(positive) -- Set the maximum absolute allowable constraint violation.
 • infinitebound = realcons(positive) -- Set any value of a variable greater than the infinitebound value to be equivalent to infinity during the computation.
 • initialpoint = set(equation) or list(equation) -- Use the provided initial point, which is a set or list of equations $\mathrm{varname}=\mathrm{value}$.
 • iterationlimit = posint -- Set the maximum number of iterations performed by the active-set algorithm.
 • maximize or maximize = truefalse -- Maximize the objective function when equal to true and minimize when equal to false.  The option 'maximize' is equivalent to maximize = true. The default is maximize = false.
 • output = solutionmodule -- Return a module as described in the Optimization/Solution help page.
 • useunits = true or false or a list.  See Optimization/Units.
 • variables = list(name) or set(name) -- Specify the problem variables.

Notes

 • The QPSolve command uses an iterative active-set method implemented in a built-in library provided by the Numerical Algorithms Group (NAG). An initial point can be provided using the initialpoint option. Otherwise, a default point is used.
 • The computation is performed in floating-point. Therefore, all data provided must have type realcons and all returned solutions are floating-point, even if the problem is specified with exact values.  For more information about numeric computation in the Optimization package, see the Optimization/Computation help page.
 • QPSolve returns an error if the problem is infeasible.  If the problem appears to be unbounded, QPSolve issues a warning and returns the last computed result. This result may be meaningless.
 • Although the assume = nonnegative option is accepted, general assumptions are not supported by commands in the Optimization package.

Examples

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

Use QPSolve to minimize a quadratic function of two variables subject to a linear constraint.

 > $\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]$ (1)

Use the assume = nonnegative option instead of including non-negative constraints explicitly.

 > $\mathrm{QPSolve}\left(2x+5y+3{x}^{2}+3xy+2{y}^{2},\left\{2\le x-y\right\},\mathrm{assume}=\mathrm{nonnegative}\right)$
 $\left[{16.}{,}\left[{x}{=}{2.}{,}{y}{=}{0.}\right]\right]$ (2)

Bounds can be provided for one or more of the variables.

 > $\mathrm{QPSolve}\left(2x+5y+3{x}^{2}+3xy+2{y}^{2},\left\{2\le x-y\right\},x=1.5..\mathrm{\infty }\right)$
 $\left[{-1.53125000000000}{,}\left[{x}{=}{1.50000000000000}{,}{y}{=}{-2.37500000000000}\right]\right]$ (3)

Compatibility

 • The Optimization[QPSolve] command was updated in Maple 2018.
 • The useunits option was introduced in Maple 2018.