References and Bibliography 237
Example 4.16 Find the solution of the following quadratic programming problem
using MATLAB:
Minimizef= − 4 x 1 +x 12 − 2 x 1 x 2 + 2 x 22
subject to 2x 1 +x 2 ≤ 6 ,x 1 − 4 x 2 ≤ 0 ,x 1 ≥ 0 ,x 2 ≥ 0
SOLUTION
Step 1Express the objective function in the formf (x)=^12 xTH x+fTx nd identifya
the matrixHand vectorsf andx:
H=
(
2 − 2
−2 4
)
f=
(
− 4
0
)
x=
(
x 1
x 2
)
Step 2State the constraints in the form:A x≤band identify the matrixAand vector
b:
A=
(
2 1
1 − 4
)
b=
(
6
0
)
Step 3Use the command for executing quadratic programming as
[x,fval] = quadprog(H,f,A,b)
which returns the solution vectorxthat minimizes
f=^12 xTH x+fTx ubject tos Ax≤b
The MATLAB solution is given below:
clear;clc;
H = [2—2;–2 4];
f = [–4 0];
A = [2 1;1—4];
b = [6; 0];
[x,fval] = quadprog(H,f,A,b)
Warning: Large-scale method does not currently solve this
problem formulation, switching to medium-scale method.
x =
2.4615
1.0769
fval =
-6.7692
References and Bibliography
4.1 S. Gass,Linear Programming, McGraw-Hill, New York, 1964.
4.2 C. E. Lemke, The dual method of solving the linear programming problem,Naval
Research and Logistics Quarterly, Vol. 1, pp. 36–47, 1954.