Lecture 6&7 - Quadratic Programming
Problem 1 (50%) Quadratic Programming
a)
Given a Quadratic Programming Problem on Standard Form
Link to originalThis is a convex problem if the Hessian of is a Positive-Semidefinite Matrix. If the Hessian of is a Positive-Definite Matrix matrix, the QP is strictly convex.
Convexity is important due to many factors, if the QP is convex then:
- Any local solution is a global solution
- Algorithms are more efficient, and can often guarantee convergence.
b)
If instead of as in the proof of theorem 16.2 in page=475, we can only say that we have a local minimizer, but that it is not strict. We can see that in the last equation of the proof
Since can be , there is a possibility that , instead of guaranteeing that .
c)
page=497
Algorithm 16.3 is called the Active-Set Method for Convex QP. If we change the starting point to be , and we assume that the constraint is active (aka ), then the algorithm would do as follows.
We have the following problem
Rewriting this into a Quadratic Programming Problem on Standard Form
Link to originalWe get
Where we only have inequality constraints, . The constant value in the objective function which is (which we ignore) does not change the solution.
…
d) Duality for Nonlinear Programming
As seen in c), we know that we can write the QP on standard form, and we know the values for , , and .
We start by finding the Lagrangian
Then, the dual objective function, , is given by
The Infimum of a strictly convex quadratic function () with respect to is
Solving for , and putting this into the function for the Lagrangian, , gives us
Thus giving us the dual problem
e) Weak Duality
From theorem 12.11 in the book about Weak Duality, we know that
Link to originalWhich we can rewrite as
Thus giving us an over estimate when the optimal point is unknown.
Problem 2 (50%) Production Planning and Quadratic Programming
We are given the following optimization problem
Where
a)
Formulating this as a minimization problem can be done the following way
We can put this on standard form
Link to originalBy setting the following matrices
b)
The following Matlab script generated the figure below
% Define the range for x1 and x2
x1 = linspace(0, 10, 400);
x2 = linspace(0, 10, 400);
% Create a meshgrid for plotting
[X1, X2] = meshgrid(x1, x2);
% Calculate the objective function value over the grid
Z = -(3-0.4*X1).*X1 - (2-0.2*X2).*X2;
% Plot the contour of the objective function
figure;
contour(X1, X2, Z, 50); % Adjust the number of contours as needed
hold on;
xlabel('x_1');
ylabel('x_2');
title('Contour Plot with Constraints');
% Plot the constraints
% -2*x1 - x2 >= -8 -> x2 <= -2*x1 + 8
% -x1 - 3*x2 >= -15 -> x2 <= -1/3*x1 + 5
f1 = @(x1) -2*x1 + 8;
f2 = @(x1) -1/3*x1 + 5;
fplot(f1, [0,10], 'r', 'LineWidth', 2);
fplot(f2, [0,10], 'b', 'LineWidth', 2);
% Legend and grid
legend('Objective Function', 'Constraint 1', 'Constraint 2', 'Location', 'BestOutside');
grid on;
hold off;
c)
Changing the follow values in the Matlab script
% Objective function
G = [
0.8 0;
0 0.4;
];
c = [-3; -2];
% Constraints
A = [
-2 -1;
-1 -3
];
b = [-8; -15];
Gives me
Optimization terminated successfully.
Iteration sequence:
0 0 1.2586 1.8000 3.7500
0 0 3.7757 4.4000 5.0000
Solution:
3.7500
5.0000
The solution is not at a point of intersection between constraints, and no constraints are active.
d)
Active-Set Method for Convex QP We start at a (random really) feasible point, in this case . Not an optimal point, goes to the next. Etc…
e)
The solution we found in this task has no active constraint, but a LP will always have the solution on a point of intersection. This is quite logical, as the extreme point might be in the middle of the feasible set, but for a LP you can always move to decrease the objective function.