Quadratic Programming: NCSS Statistical Software
Quadratic Programming: NCSS Statistical Software
com
Chapter 483
Quadratic
Programming
Introduction
Quadratic programming maximizes (or minimizes) a quadratic objective function subject to one or more
constraints. The technique finds broad use in operations research and is occasionally of use in statistical work.
The mathematical representation of the quadratic programming (QP) problem is
Maximize
1
𝑧𝑧 = 𝑪𝑪𝑪𝑪 + 2 𝑿𝑿′𝑯𝑯𝑯𝑯 or 𝑧𝑧 = 𝑪𝑪𝑪𝑪 + 𝑿𝑿′𝑫𝑫𝑫𝑫
subject to
AX ≤ b, X ≥ 0
where
𝑿𝑿 = (𝑥𝑥1 , 𝑥𝑥2 , … , 𝑥𝑥𝑛𝑛 )′
𝑪𝑪 = (𝑐𝑐1 , 𝑐𝑐2 , … , 𝑐𝑐𝑛𝑛 )
𝒃𝒃 = (𝑏𝑏1 , 𝑏𝑏2 , … , 𝑏𝑏𝑚𝑚 )′
𝑎𝑎11 ⋯ 𝑎𝑎1𝑛𝑛
𝑨𝑨 = � ⋮ ⋱ ⋮ �
𝑎𝑎𝑚𝑚1 ⋯ 𝑎𝑎𝑚𝑚𝑚𝑚
ℎ11 ⋯ ℎ1𝑛𝑛
𝑯𝑯 = � ⋮ ⋱ ⋮ �
ℎ𝑛𝑛1 ⋯ ℎ𝑛𝑛𝑛𝑛
𝑑𝑑11 ⋯ 𝑑𝑑1𝑛𝑛
𝑫𝑫 = � ⋮ ⋱ ⋮ �
𝟎𝟎 ⋯ 𝑑𝑑𝑛𝑛𝑛𝑛
The symmetric matrix H is often called the Hessian. The upper-triangular matrix D is constructed from H using
2ℎ11 ⋯ ℎ1𝑖𝑖 ⋯ ℎ1𝑛𝑛
⎛ ⋮ ⋱ ⋮ ⋱ ⋮ ⎞
𝑫𝑫 = ⎜ 0 ⋯ 2ℎ𝑖𝑖𝑖𝑖 ⋯ ℎ𝑖𝑖𝑖𝑖 ⎟
⋮ ⋱ ⋮ ⋱ ⋮
⎝ 0 ⋯ 0 ⋯ 2ℎ 𝑛𝑛𝑛𝑛 ⎠
The xi’s are the decision variables (the unknowns), the first equation is called the objective function and the m
inequalities (and equalities) are called constraints. The constraint bounds, the bi’s, are often called right-hand
sides (RHS).
483-1
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
NCSS solves a particular quadratic program using a primal active set method available in the Extreme
Optimization mathematical subroutine package.
Example
We will solve the following problem using NCSS:
Minimize
𝑧𝑧 = 𝑥𝑥1 − 2𝑥𝑥2 + 4𝑥𝑥3 + 𝑥𝑥12 + 2𝑥𝑥22 + 3𝑥𝑥32 + 𝑥𝑥1 𝑥𝑥3
subject to
3𝑥𝑥1 + 4𝑥𝑥2 − 2𝑥𝑥3 ≤ 10
−3𝑥𝑥1 + 2𝑥𝑥2 + 𝑥𝑥3 ≥ 2
2𝑥𝑥1 + 3𝑥𝑥2 + 4𝑥𝑥3 = 5
0 ≤ 𝑥𝑥1 ≤ 5
1 ≤ 𝑥𝑥2 ≤ 5
0 ≤ 𝑥𝑥3 ≤ 5
The solution (see Example 1 below) is x1 = 0.290, x2 = 1.413, and x3 = 0.045, which results in z = 1.741.
Data Structure
This technique requires a special data format which will be discussed under the Specifications tab. Here is the way
the above example would be entered. It is stored in the dataset QP.
QP dataset
Type Logic RHS X1 X2 X3 D1 D2 D3
O 1 -2 4 1 0 1
C < 10 3 4 -2 2 0
C > 2 -3 2 1 3
C = 5 2 3 4
L 0 1 0
U 5 5 5
483-2
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
Procedure Options
This section describes the options available in this procedure.
Specifications Tab
Set the specifications for the analysis.
Optimum Type
Type of Optimum
Specify whether to find the minimum or the maximum of the objective function in the constrained region.
483-3
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
483-4
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
483-5
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
Reports Tab
Select Reports
Objective Function and Solution – Quadratic Portion of the Objective Function
Indicate which reports you want to view.
Report Options
Variable Names
This option lets you select whether to display only variable names, variable labels, or both.
Precision
Specify the precision of numbers in the report. Single precision will display seven-place accuracy, while double
precision will display thirteen-place accuracy.
483-6
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
483-7
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
Objective Value
Function at Lower Upper
Variable Coefficient Minimum Bound Bound
X1 1.0 0.290 0.0 5.0
X2 -2.0 1.413 1.0 5.0
X3 4.0 0.045 0.0 5.0
This report lists the linear portion of the objective function coefficients, the values of the variables at the
minimum (that is, the solution), and the lower and upper bonds if specified. It also shows the value of the
objective function at the solution as well as the status of the algorithm when it terminated.
Constraints
Constraints
This report presents the coefficients of the constraints as they were input.
RHS at
Row, Logic RHS Solution
Con1, ≤ 10.0 6.435
Con2, ≥ 2.0 2.000
Con3, = 5.0 5.000
This report presents the right hand side of each constraint along with its value at the optimal values of the
variables.
Hessian Matrix
Hessian Matrix
Variables X1 X2 X3
X1 2.0 0.0 1.0
X2 0.0 4.0 0.0
X3 1.0 0.0 6.0
This report shows the Hessian matrix calculated from the D matrix that was input.
483-8
© NCSS, LLC. All Rights Reserved.
NCSS Statistical Software NCSS.com
Quadratic Programming
Variables X1 X2 X3
X1 1.0 0.0 1.0
X2 2.0 0.0
X3 3.0
This report shows the coefficients of the quadratic portion of the objective function presented in matrix format.
483-9
© NCSS, LLC. All Rights Reserved.