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