Quickguide NLLS Problem
|
This page is part of the Quickguide Manual. See Quickguide. |
The constrained nonlinear least squares (cls) problem is defined as
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} r(x)^T r(x) \\ & \\ s/t & \begin{array}{lcccl} x_{L} & \leq & x & \leq & x_{U}, \\ b_{L} & \leq & A x & \leq & b_{U} \\ c_{L} & \leq & c(x) & \leq & c_{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 x, x_L, x_U \in \mathbb{R}^n}
, 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 r(x) \in \mathbb{R}^M}
,
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 A \in \mathbb{R}^{m_1 \times n}}
, 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,b_U \in \mathbb{R}^{m_1}}
and 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_L,c(x),c_U \in \mathbb{R}^{m_2}}
. The
following file defines and solves a problem in TOMLAB.
The following files define a problem in TOMLAB.
File: tomlab/quickguide/nllsQG_r.m, nllsQG_J.m
r: Residual vector J: Jacobian matrix
The following file illustrates how to solve an NLLS problem in TOMLAB. Also view the m-files specified above for more information.
File: tomlab/quickguide/nllsQG.m
Open the file for viewing, and execute nllsQG in Matlab.
% nllsQG is a small example problem for defining and solving
% nonlinear least squares using the TOMLAB format.
Name='Gisela';
t = [0.25; 0.5; 0.75; 1; 1.5; 2; 3; 4; 6; 8; 12; 24; 32; 48; 54; 72; 80;...
96; 121; 144; 168; 192; 216; 246; 276; 324; 348; 386];
y = [30.5; 44; 43; 41.5; 38.6; 38.6; 39; 41; 37; 37; 24; 32; 29; 23; 21;...
19; 17; 14; 9.5; 8.5; 7; 6; 6; 4.5; 3.6; 3; 2.2; 1.6];
x_0 = [6.8729, 0.0108, 0.1248]';
% See help clsAssign for more information.
Prob = clsAssign('nllsQG_r', 'nllsQG_J', [], [], [], Name, x_0, ...
y, t);
% Parameter which is passed to r and J routines.
Prob.uP = 5;
Result = tomRun('clsSolve', Prob, 1);
%Result = tomRun('nlssol', Prob, 1);
% Any nonlinear solver can be used. TOMLAB automatically
% uses gateway routines for problem mapping.
%Result = tomRun('filterSQP', Prob, 1);
%Result = tomRun('knitro', Prob, 1);
%Result = tomRun('conopt', Prob, 1);
%Result = tomRun('snopt', Prob, 1);
%Result = tomRun('npsol', Prob, 1);
%Result = tomRun('minos', Prob, 1);
%Result = tomRun('oqnlp', Prob, 1);