solve a quadratic program - Maple Help

Online Help

All Products    Maple    MapleSim

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

Optimization[QPSolve] - solve a quadratic program

Calling Sequence

QPSolve(obj, constr, bd, opts)




algebraic; quadratic objective function



(optional) set(relation) or list(relation); linear constraints



(optional) sequence of name = range; bounds for one or more variables



(optional) equation(s) of the form option = value where option is one of assume, feasibilitytolerance, infinitebound, initialpoint, iterationlimit, maximize, or output; specify options for the QPSolve command



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 varname&equals;varrange where varname is a variable name and 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.



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 varname&equals;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.


variables = list(name) or set(name) -- Specify the problem variables.



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.



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




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




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




See Also

Optimization, Optimization/AlgebraicForm, Optimization/Computation, Optimization/MatrixForm, Optimization/Options, Optimization/Solution, Optimization[LPSolve], Optimization[QPSolve] (MatrixForm), realcons

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam