Optimization
QPSolve
solve a quadratic program
Calling Sequence
Parameters
Description
Options
Notes
Examples
Compatibility
QPSolve(obj, constr, bd, opts)
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
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=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=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.
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.
with⁡Optimization:
Use QPSolve to minimize a quadratic function of two variables subject to a linear constraint.
QPSolve⁡2⁢x+5⁢y+3⁢x2+3⁢x⁢y+2⁢y2,2≤x−y
−3.53333333333333,x=0.466666666666667,y=−1.60000000000000
Use the assume = nonnegative option instead of including non-negative constraints explicitly.
QPSolve⁡2⁢x+5⁢y+3⁢x2+3⁢x⁢y+2⁢y2,2≤x−y,assume=nonnegative
16.,x=2.,y=0.
Bounds can be provided for one or more of the variables.
QPSolve⁡2⁢x+5⁢y+3⁢x2+3⁢x⁢y+2⁢y2,2≤x−y,x=1.5..∞
−1.53125000000000,x=1.50000000000000,y=−2.37500000000000
The Optimization[QPSolve] command was updated in Maple 2018.
The useunits option was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Optimization/AlgebraicForm
Optimization/Computation
Optimization/MatrixForm
Optimization/Options
Optimization/Solution
Optimization[LPSolve]
Optimization[QPSolve] (MatrixForm)
realcons
Download Help Document