Quickguide QPCON Problem: Difference between revisions

From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the Quickguide Manual|link=Quickguide}} When solving a problem with a quadratic objective and nonlinear constraints TOMLAB automatically sup...")
 
No edit summary
 
Line 18: Line 18:




where <math>x, x_L, x_U, d \in \MATHSET{R}^n</math>, <math>F \in \MATHSET{R}^{n
where <math>x, x_L, x_U, d \in \mathbb{R}^n</math>, <math>F \in \mathbb{R}^{n
\times n}</math>, <math>f(x) \in \MATHSET{R}</math>, <math>A \in \MATHSET{R}^{m_1 \times
\times n}</math>, <math>f(x) \in \mathbb{R}</math>, <math>A \in \mathbb{R}^{m_1 \times
n}</math>, <math>b_L,b_U \in \MATHSET{R}^{m_1}</math> and <math>c_L,c(x),c_U \in
n}</math>, <math>b_L,b_U \in \mathbb{R}^{m_1}</math> and <math>c_L,c(x),c_U \in
\MATHSET{R}^{m_2}</math>.
\mathbb{R}^{m_2}</math>.


The following files define and solve an example problem in TOMLAB.
The following files define and solve an example problem in TOMLAB.
Line 39: Line 39:
Open the file for viewing, and execute qpconQG in Matlab.
Open the file for viewing, and execute qpconQG in Matlab.


<syntaxhighlight lang="matlab">
<source lang="matlab">
  % qpconQG is a small example problem for defining and solving quadratic
  % qpconQG is a small example problem for defining and solving quadratic
  % nonlinearly constrained programming problems using the TOMLAB format.
  % nonlinearly constrained programming problems using the TOMLAB format.
Line 69: Line 69:
  % Result3 = tomRun('npsol', Prob, 1);
  % Result3 = tomRun('npsol', Prob, 1);
  % Result4 = tomRun('knitro', Prob, 1);
  % Result4 = tomRun('knitro', Prob, 1);
</syntaxhighlight>
</source>

Latest revision as of 07:49, 17 January 2012

Notice.png

This page is part of the Quickguide Manual. See Quickguide.

When solving a problem with a quadratic objective and nonlinear constraints TOMLAB automatically supplies objective derivatives (gradient and Hessian) if qpconAssign is used.

The quadratic constrained nonlinear programming problem is defined as:



where , , , , and .

The following files define and solve an example problem in TOMLAB.

File: tomlab/quickguide/qpconQG.m, qpconQG_c.m, qpconQG_dc.m, qpcon_d2c.m

c:   Nonlinear constraint vector
dc:  Nonlinear constraint gradient matrix
d2c: The second part of the Hessian to the Lagrangian function for the nonlinear constraints.

The following file illustrates how to solve this QPCON problem in TOMLAB. Also view the m-files specified above for more information.

File: tomlab/quickguide/qpconQG.m

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

 % qpconQG is a small example problem for defining and solving quadratic
 % nonlinearly constrained programming problems using the TOMLAB format.
 
 Name  = 'QP constrained problem';
 x_0   = ones(10,1);
 x_L   = [];
 x_U   = [];
 A     = ones(8,10);
 for i = 1:8
     A(i,i) = 1/2;
 end
 b_L   = ones(8,1);
 b_U   = ones(8,1);
 c_L   = 4;
 c_U   = 4;
 
 % Objective f = -x'*x + sum(x), assign as quadratic/linear matrix/vector
 
 F     = -2*speye(10);
 d     = ones(10,1);
 
 Prob = qpconAssign(F, d, x_L, x_U, Name, x_0, A, b_L, b_U,...
     'qpconQG_c', 'qpconQG_dc', 'qpconQG_d2c', [], c_L, c_U);
 
 % Run SNOPT as a local solver
 Result = tomRun('snopt', Prob, 1);
 % Result2 = tomRun('minos', Prob, 1);
 % Result3 = tomRun('npsol', Prob, 1);
 % Result4 = tomRun('knitro', Prob, 1);