Quickguide QPBLOCK Problem: Difference between revisions
(Created page with "The general formulation in TOMLAB for a quadratic programming problem is: <math> \begin{array}{ll} \min\limits_{x} & f(x) = \frac{1}{2} x^T F x + c^T x \\ & \\ s/t & \begin{ar...") |
No edit summary |
||
Line 1: | Line 1: | ||
{{Part Of Manual|title=the Quickguide Manual|link=[[Quickguide|Quickguide]]}} | |||
The general formulation in TOMLAB for a quadratic programming problem is: | The general formulation in TOMLAB for a quadratic programming problem is: | ||
Revision as of 05:40, 11 August 2011
This page is part of the Quickguide Manual. See Quickguide. |
The general formulation in TOMLAB for a quadratic programming problem is:
where Failed to parse (unknown function "\MATHSET"): {\displaystyle c, x, x_L, x_U \in \MATHSET{R}^n} , Failed to parse (unknown function "\MATHSET"): {\displaystyle F \in \MATHSET{R}^{n \times n}} , Failed to parse (unknown function "\MATHSET"): {\displaystyle A \in \MATHSET{R}^{m_1 \times n}} , and Failed to parse (unknown function "\MATHSET"): {\displaystyle b_L,b_U \in \MATHSET{R}^{m_1}} . Equality constraints are defined by setting the lower bound equal to the upper bound, i.e. for constraint : . Fixed variables are handled the same way.
When using a general nonlinear solver such as SNOPT, KNITRO or CONOPT it is possible to define the objective on a block structure. The objective can take the following formats.
Case 1:
The quadratic objective can be separated into main sparse matrix F and one or more additional two part blocks. min 0.5 * x' * F * x + d' * x + 0.5 * x' * Fb.out' * Fb.inn * Fb.out * x (for i=1...p)
Case 2:
The quadratic objective can be separated into a main sparse matrix F and two outer blocks. min 0.5 * x' * F * x + d' * x + 0.5 * x' * Fb.out' * Fb.out * x (for i=1...p)
Case 3:
Case number 1 above, but F is supplied as a nx1 vector (diagonal)
Case 4:
Case number 2 above, but F is supplied as a nx1 vector (diagonal)
The following file defines a test case in TOMLAB.
File: tomlab/quickguide/qpblockQG.m
Open the file for viewing, and execute qpblockQG in Matlab.
% qpblockQG is a small example problem for defining and solving
% quadratic programming on a block structure using the TOMLAB format.
% See help qpblockAssign for more information.
Name = 'QP Block Example';
switch 1
case 1
F = [ 8 0
0 8 ];
Fb(1).out = ones(3,2);
Fb(1).inn = ones(3,3);
Fb(2).out = ones(4,2);
Fb(2).inn = ones(4,4);
d = [ 3 -4 ]';
case 2
F = [ 8 0
0 8 ];
Fb(1).out = ones(3,2);
Fb(2).out = ones(4,2);
d = [ 3 -4 ]';
case 3
F = [ 8 8]';
Fb(1).out = ones(3,2);
Fb(1).inn = ones(3,3);
Fb(2).out = ones(4,2);
Fb(2).inn = ones(4,4);
d = [ 3 -4 ]';
case 4
F = [ 8 8]';
Fb(1).out = ones(3,2);
Fb(2).out = ones(4,2);
d = [ 3 -4 ]';
end
A = [ 1 1 % Constraint matrix
1 -1 ];
b_L = [-inf 0 ]'; % Lower bounds on the linear constraints
b_U = [ 5 0 ]'; % Upper bounds on the linear constraints
x_L = [ 0 0 ]'; % Lower bounds on the variables
x_U = [ inf inf ]'; % Upper bounds on the variables
x_0 = [ 0 1 ]'; % Starting point
x_min = [-1 -1 ]; % Plot region lower bound parameters
x_max = [ 6 6 ]; % Plot region upper bound parameters
% Assign routine for defining a QP problem.
Prob = qpblockAssign(F, Fb, d, x_L, x_U, Name, x_0, A, b_L, b_U);
% Calling driver routine tomRun to run the solver.
% The 1 sets the print level after optimization.
Result = tomRun('snopt', Prob, 1);
% Result = tomRun('knitro', Prob, 1);
% Result = tomRun('conopt', Prob, 1);