Models Quadratic Programming Problems: qp prob: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 21: Line 21:
the lower bound equal to the upper bound, i.e. for constraint <math>i</math>:
the lower bound equal to the upper bound, i.e. for constraint <math>i</math>:
<math>b_{L}(i) = b_{U}(i)</math>. Fixed variables are handled the same way.
<math>b_{L}(i) = b_{U}(i)</math>. Fixed variables are handled the same way.
An example of a problem of this class, (that is also found in the TOMLAB quickguide) is qpQG:
<math>
\begin{array}{ll}\min\limits_{x} & f(x)=4x_{1}^2+x_{1}x_{2}+4x_{2}^2+3x_{1}-4x_{2} \\& \\s/t & \begin{array}{lll}x_{1}+x_{2} \leq 5 \\x_{1}-x_{2}  =  0 \\x_{1} \geq 0 \\x_{2} \geq 0 \\\end{array}\end{array}
</math>


'''File: '''tomlab/quickguide/qpQG.m
'''File: '''tomlab/quickguide/qpQG.m

Revision as of 12:31, 11 August 2011

Notice.png

This page is part of TOMLAB Models. See TOMLAB Models.

In qp_prob there are 41 quadratic programming test problems with sizes to nearly 1200 variables and nearly 500 constraints. In order to define the problem n and solve it execute the following in Matlab:

Prob = probInit('qp_prob',n); Result  = tomRun('',Prob);

The basic structure of a general nonlinear Quadratic Programming problem is:

An example of a problem of this class, (that is also found in the TOMLAB quickguide) is qpQG:


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 : . Fixed variables are handled the same way.

An example of a problem of this class, (that is also found in the TOMLAB quickguide) is qpQG:


File: tomlab/quickguide/qpQG.m

Open the file for viewing, and execute qpQG in Matlab.

% qpQG is a small example problem for defining and solving
% quadratic programming problems using the TOMLAB format.

Name  = 'QP Example';
F     = [ 8   1        % Matrix F in 1/2 * x' * F * x + c' * x
          1   8 ];
c     = [ 3  -4 ]';    % Vector c in 1/2 * x' * F * x + c' * x
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 = qpAssign(F, c, A, b_L, b_U, x_L, x_U, x_0, Name,...
       [], [], [], x_min, x_max);

% Calling driver routine tomRun to run the solver.
% The 1 sets the print level after optimization.

Result = tomRun('qpSolve', Prob, 1);
%Result = tomRun('snopt', Prob, 1);
%Result = tomRun('sqopt', Prob, 1);
%Result = tomRun('cplex', Prob, 1);
%Result = tomRun('knitro', Prob, 1);
%Result = tomRun('conopt', Prob, 1);