| 1 |
\section{The line search optimisation algorithm |
\section{The line search optimisation algorithm |
| 2 |
\label{sectionoptim}} |
\label{sectionoptim}} |
| 3 |
|
\begin{rawhtml} |
| 4 |
|
<!-- CMIREDIR:lsearch_optim: --> |
| 5 |
|
\end{rawhtml} |
| 6 |
|
|
| 7 |
|
Author: Patrick Heimbach |
| 8 |
|
|
| 9 |
\subsection{General features} |
\subsection{General features} |
| 10 |
|
|
| 11 |
The line search algorithm is based on a quasi-Newton |
The line search algorithm is based on a quasi-Newton |
| 12 |
variable storage method which was implemented by |
variable storage method which was implemented by |
| 13 |
\cite{gil-mar:89}. |
\cite{gil-lem:89}. |
| 14 |
|
|
| 15 |
TO BE CONTINUED... |
TO BE CONTINUED... |
| 16 |
|
|
| 225 |
|
|
| 226 |
\newpage |
\newpage |
| 227 |
|
|
| 228 |
\begin{figure}[b!] |
\begin{figure} |
| 229 |
\input{part8/lsopt_flow_1} |
%\input{s_ecco/text/lsopt_flow_1} |
| 230 |
|
{\scriptsize |
| 231 |
|
\begin{verbatim} |
| 232 |
|
lsopt_top |
| 233 |
|
| |
| 234 |
|
|---- check arguments |
| 235 |
|
|---- CALL INSTORE |
| 236 |
|
| | |
| 237 |
|
| |---- determine whether OPWARMI available: |
| 238 |
|
| * if no: cold start: create OPWARMI |
| 239 |
|
| * if yes: warm start: read from OPWARMI |
| 240 |
|
| create or open OPWARMD |
| 241 |
|
| |
| 242 |
|
|---- check consistency between OPWARMI and model parameters |
| 243 |
|
| |
| 244 |
|
|---- >>> if COLD start: <<< |
| 245 |
|
| | first simulation with f.g. xx_0; output: first ff_0, gg_0 |
| 246 |
|
| | set first preconditioner value xdiff_0 to 1 |
| 247 |
|
| | store xx(0), gg(0), xdiff(0) to OPWARMD (first 3 entries) |
| 248 |
|
| | |
| 249 |
|
| >>> else: WARM start: <<< |
| 250 |
|
| read xx(i), gg(i) from OPWARMD (first 2 entries) |
| 251 |
|
| for first warm start after cold start, i=0 |
| 252 |
|
| |
| 253 |
|
| |
| 254 |
|
| |
| 255 |
|
|---- /// if ITMAX > 0: perform optimization (increment loop index i) |
| 256 |
|
| ( |
| 257 |
|
| )---- save current values of gg(i-1) -> gold(i-1), ff -> fold(i-1) |
| 258 |
|
| (---- CALL LSUPDXX |
| 259 |
|
| ) | |
| 260 |
|
| ( |---- >>> if jmax=0 <<< |
| 261 |
|
| ) | | first optimization after cold start: |
| 262 |
|
| ( | | preconditioner estimated via ff_0 - ff_(first guess) |
| 263 |
|
| ) | | dd(i-1) = -gg(i-1)*preco |
| 264 |
|
| ( | | |
| 265 |
|
| ) | >>> if jmax > 0 <<< |
| 266 |
|
| ( | dd(i-1) = -gg(i-1) |
| 267 |
|
| ) | CALL HESSUPD |
| 268 |
|
| ( | | |
| 269 |
|
| ) | |---- dd(i-1) modified via Hessian approx. |
| 270 |
|
| ( | |
| 271 |
|
| ) |---- >>> if <dd,gg> >= 0 <<< |
| 272 |
|
| ( | ifail = 4 |
| 273 |
|
| ) | |
| 274 |
|
| ( |---- compute step size: tact(i-1) |
| 275 |
|
| ) |---- compute update: xdiff(i) = xx(i-1) + tact(i-1)*dd(i-1) |
| 276 |
|
| ( |
| 277 |
|
| )---- >>> if ifail = 4 <<< |
| 278 |
|
| ( goto 1000 |
| 279 |
|
| ) |
| 280 |
|
| (---- CALL OPTLINE / LSLINE |
| 281 |
|
| ) | |
| 282 |
|
... ... ... |
| 283 |
|
\end{verbatim} |
| 284 |
|
} |
| 285 |
\caption{Flow chart (part 1 of 3)} |
\caption{Flow chart (part 1 of 3)} |
| 286 |
\label{fig:lsoptflow1} |
\label{fig:lsoptflow1} |
| 287 |
\end{figure} |
\end{figure} |
| 288 |
|
|
| 289 |
\begin{figure}[b!] |
\begin{figure} |
| 290 |
\input{part8/lsopt_flow_2} |
%\input{s_ecco/text/lsopt_flow_2} |
| 291 |
|
{\scriptsize |
| 292 |
|
\begin{verbatim} |
| 293 |
|
... ... |
| 294 |
|
| ) |
| 295 |
|
| (---- CALL OPTLINE / LSLINE |
| 296 |
|
| ) | |
| 297 |
|
| ( |---- /// loop over simulations |
| 298 |
|
| ) ( |
| 299 |
|
| ( )---- CALL SIMUL |
| 300 |
|
| ) ( | |
| 301 |
|
| ( ) |---- input: xdiff(i) |
| 302 |
|
| ) ( |---- output: ff(i), gg(i) |
| 303 |
|
| ( ) |---- >>> if ONLINE <<< |
| 304 |
|
| ) ( runs model and adjoint |
| 305 |
|
| ( ) >>> if OFFLINE <<< |
| 306 |
|
| ) ( reads those values from file |
| 307 |
|
| ( ) |
| 308 |
|
| ) (---- 1st Wolfe test: |
| 309 |
|
| ( ) ff(i) <= tact*xpara1*<gg(i-1),dd(i-1)> |
| 310 |
|
| ) ( |
| 311 |
|
| ( )---- 2nd Wolfe test: |
| 312 |
|
| ) ( <gg(i),dd(i-1)> >= xpara2*<gg(i-1),dd(i-1)> |
| 313 |
|
| ( ) |
| 314 |
|
| ) (---- >>> if 1st and 2nd Wolfe tests ok <<< |
| 315 |
|
| ( ) | 320: update xx: xx(i) = xdiff(i) |
| 316 |
|
| ) ( | |
| 317 |
|
| ( ) >>> else if 1st Wolfe test not ok <<< |
| 318 |
|
| ) ( | 500: INTERpolate new tact: |
| 319 |
|
| ( ) | barr*tact < tact < (1-barr)*tact |
| 320 |
|
| ) ( | CALL CUBIC |
| 321 |
|
| ( ) | |
| 322 |
|
| ) ( >>> else if 2nd Wolfe test not ok <<< |
| 323 |
|
| ( ) 350: EXTRApolate new tact: |
| 324 |
|
| ) ( (1+barmin)*tact < tact < 10*tact |
| 325 |
|
| ( ) CALL CUBIC |
| 326 |
|
| ) ( |
| 327 |
|
| ( )---- >>> if new tact > tmax <<< |
| 328 |
|
| ) ( | ifail = 7 |
| 329 |
|
| ( ) | |
| 330 |
|
| ) (---- >>> if new tact < tmin OR tact*dd < machine precision <<< |
| 331 |
|
| ( ) | ifail = 8 |
| 332 |
|
| ) ( | |
| 333 |
|
| ( )---- >>> else <<< |
| 334 |
|
| ) ( update xdiff for new simulation |
| 335 |
|
| ( ) |
| 336 |
|
| ) \\\ if nfunc > 1: use inter-/extrapolated tact and xdiff |
| 337 |
|
| ( for new simulation |
| 338 |
|
| ) N.B.: new xx is thus not based on new gg, but |
| 339 |
|
| ( rather on new step size tact |
| 340 |
|
| ) |
| 341 |
|
| (---- store new values xx(i), gg(i) to OPWARMD (first 2 entries) |
| 342 |
|
| )---- >>> if ifail = 7,8,9 <<< |
| 343 |
|
| ( goto 1000 |
| 344 |
|
| ) |
| 345 |
|
... ... |
| 346 |
|
\end{verbatim} |
| 347 |
|
} |
| 348 |
\caption{Flow chart (part 2 of 3)} |
\caption{Flow chart (part 2 of 3)} |
| 349 |
\label{fig:lsoptflow2} |
\label{fig:lsoptflow2} |
| 350 |
\end{figure} |
\end{figure} |
| 351 |
|
|
| 352 |
\begin{figure}[b!] |
\begin{figure} |
| 353 |
\input{part8/lsopt_flow_3} |
%\input{s_ecco/text/lsopt_flow_3} |
| 354 |
|
{\scriptsize |
| 355 |
|
\begin{verbatim} |
| 356 |
|
... ... |
| 357 |
|
| ) |
| 358 |
|
| (---- store new values xx(i), gg(i) to OPWARMD (first 2 entries) |
| 359 |
|
| )---- >>> if ifail = 7,8,9 <<< |
| 360 |
|
| ( goto 1000 |
| 361 |
|
| ) |
| 362 |
|
| (---- compute new pointers jmin, jmax to include latest values |
| 363 |
|
| ) gg(i)-gg(i-1), xx(i)-xx(i-1) to Hessian matrix estimate |
| 364 |
|
| (---- store gg(i)-gg(i-1), xx(i)-xx(i-1) to OPWARMD |
| 365 |
|
| ) (entries 2*jmax+2, 2*jmax+3) |
| 366 |
|
| ( |
| 367 |
|
| )---- CALL DGSCALE |
| 368 |
|
| ( | |
| 369 |
|
| ) |---- call dostore |
| 370 |
|
| ( | | |
| 371 |
|
| ) | |---- read preconditioner of previous iteration diag(i-1) |
| 372 |
|
| ( | from OPWARMD (3rd entry) |
| 373 |
|
| ) | |
| 374 |
|
| ( |---- compute new preconditioner diag(i), based upon diag(i-1), |
| 375 |
|
| ) | gg(i)-gg(i-1), xx(i)-xx(i-1) |
| 376 |
|
| ( | |
| 377 |
|
| ) |---- call dostore |
| 378 |
|
| ( | |
| 379 |
|
| ) |---- write new preconditioner diag(i) to OPWARMD (3rd entry) |
| 380 |
|
| ( |
| 381 |
|
|---- \\\ end of optimization iteration loop |
| 382 |
|
| |
| 383 |
|
| |
| 384 |
|
| |
| 385 |
|
|---- CALL OUTSTORE |
| 386 |
|
| | |
| 387 |
|
| |---- store gnorm0, ff(i), current pointers jmin, jmax, iterabs to OPWARMI |
| 388 |
|
| |
| 389 |
|
|---- >>> if OFFLINE version <<< |
| 390 |
|
| xx(i+1) needs to be computed as input for offline optimization |
| 391 |
|
| | |
| 392 |
|
| |---- CALL LSUPDXX |
| 393 |
|
| | | |
| 394 |
|
| | |---- compute dd(i), tact(i) -> xdiff(i+1) = x(i) + tact(i)*dd(i) |
| 395 |
|
| | |
| 396 |
|
| |---- CALL WRITE_CONTROL |
| 397 |
|
| | | |
| 398 |
|
| | |---- write xdiff(i+1) to special file for offline optim. |
| 399 |
|
| |
| 400 |
|
|---- print final information |
| 401 |
|
| |
| 402 |
|
O |
| 403 |
|
\end{verbatim} |
| 404 |
|
} |
| 405 |
\caption{Flow chart (part 3 of 3)} |
\caption{Flow chart (part 3 of 3)} |
| 406 |
\label{fig:lsoptflow3} |
\label{fig:lsoptflow3} |
| 407 |
\end{figure} |
\end{figure} |