Quickguide QPBLOCK Problem
The general formulation in TOMLAB for a quadratic programming problem is:
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{array}{ll} \min\limits_{x} & f(x) = \frac{1}{2} x^T F x + c^T x \\ & \\ s/t & \begin{array}{lcccl} x_{L} & \leq & x & \leq & x_{U} \\ b_{L} & \leq & A x & \leq & b_{U} \\ \end{array} \end{array} }
where Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\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 Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle i} : Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b_{L}(i) = b_{U}(i)} . 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);