Quickguide NLP Problem: Difference between revisions

From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the Quickguide Manual|link=Quickguide}} TOMLAB requires that general nonlinear problems are defined in Matlab m-files. The function to be op...")
 
No edit summary
 
Line 18: Line 18:




where <math>x, x_L, x_U \in \MATHSET{R}^n</math>, <math>f(x) \in \MATHSET{R}</math>, <math>A \in \MATHSET{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 \MATHSET{R}^{m_2}</math>.
where <math>x, x_L, x_U \in \mathbb{R}^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 \mathbb{R}^{m_1}</math> and <math>c_L,c(x),c_U \in \mathbb{R}^{m_2}</math>.


Example problem:
Example problem:
Line 41: Line 41:
Open the file for viewing, and execute nlpQG in Matlab.
Open the file for viewing, and execute nlpQG in Matlab.


<syntaxhighlight lang="matlab">
<source lang="matlab">
  % nlpQG is a small example problem for defining and solving
  % nlpQG is a small example problem for defining and solving
  % nonlinear programming problems using the TOMLAB format.
  % nonlinear programming problems using the TOMLAB format.
Line 63: Line 63:
  % Result = tomRun('conopt', Prob, 1);
  % Result = tomRun('conopt', Prob, 1);
  % Result = tomRun('snopt', Prob, 1);
  % Result = tomRun('snopt', Prob, 1);
</syntaxhighlight>
</source>

Latest revision as of 07:48, 17 January 2012

Notice.png

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

TOMLAB requires that general nonlinear problems are defined in Matlab m-files. The function to be optimized must always be supplied. It is recommended that the user supply as many analytical functions as possible. There are six methods available for numerical differentiation and also two for automatic.

The constrained nonlinear programming problem is defined as:



where , , , and .

Example problem:

The following files define the problem in TOMLAB.

File: tomlab/quickguide/rbb_f.m, rbb_g.m, rbb_H.m, rbb_c.m, rbb_dc.m, rbb_d2c.m

f:   Function value
g:   Gradient vector
H:   Hessian matrix
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 NLP (CON) problem in TOMLAB. Also view the m-files specified above for more information.

File: tomlab/quickguide/nlpQG.m

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

 % nlpQG is a small example problem for defining and solving
 % nonlinear programming problems using the TOMLAB format.
 
 Name = 'RBB Problem';
 x_0 = [-1.2 1]';     % Starting values for the optimization.
 x_L = [-10;-10];     % Lower bounds for x.
 x_U = [2;2];         % Upper bounds for x.
 fLowBnd = 0;         % Lower bound on function.
 
 c_L = -1000;         % Lower bound on nonlinear constraints.
 c_U = 0;             % Upper bound on nonlinear constraints.
 
 Prob = conAssign('rbbQG_f', 'rbbQG_g', 'rbbQG_H', [], x_L, x_U, Name, x_0,...
     [], fLowBnd, [], [], [], 'rbbQG_c', 'rbbQG_dc', 'rbbQG_d2c', [], c_L, c_U);
 
 Prob.Warning = 0;    % Turning off warnings.            
             
 Result = tomRun('ucSolve', Prob, 1);  % Ignores constraints.
 
 % Result = tomRun('conopt', Prob, 1);
 % Result = tomRun('snopt', Prob, 1);