Repository navigation
Truncated CG diagnostics - #49
Alexey-Voronin wants to merge 4 commits into
Conversation
|
@Alexey-Voronin @dridzal The other Krylov methods and subproblem solvers would benefit from this type of output as well. |
|
@dpkouri : Is this extension sufficient, for now? |
3581ca6 to
0b141c7
Compare
|
@dridzal is still ironing out the details. There were some inconsistencies in the previous push. The truncated-CG diagnostics are now a single shared printer that all the Krylov solvers and trust-region subproblem solvers can use. I had to modify the function interface to pass the output stream rather than each solver owning its own. Example outputCG on a small SPD system: Truncated CG stopping on the trust-region boundary: RecreateSet the Krylov verbosity to 1 in any solve. |
|
@Alexey-Voronin and @dridzal I am not sure about the use of ROL::GlobalMPISession. Typically, the user is responsible for all things MPI-related, including providing an ostream that accounts for MPI. Thoughts? |
55d2161 to
dcbedd4
Compare
|
@dpkouri good call about GlobalMPISession. I think this should do it. |
|
@dpkouri : Any further requests? |
Added opt-in per-iterate output to the truncated CG trust-region subproblem solver. The output reports how the residual, step norm, and predicted reduction change as the Krylov space grows.
TruncatedCG_Ucurrently allows one to see only its final result. This makes it hard to inspect convergence within one trust-region subproblem.Any suggestions on how to improve or further test it are welcome.
User interface
The PR adds one parameter:
Each table (one per outer iteration) contains:
iter: inner CG iteration.rnorm: residual norm.snorm: accumulated step norm.alpha: CG step length.pRed: accumulated predicted reduction.flag: solver exit flag.Diagnostics are currently implemented only for
TruncatedCG_U. Other trust-region subproblem solvers can add similar output in follow-up work.Test coverage
Added TruncatedCGDiagnostics test for the new Verbosity key covering gating, and optimizer non-perturbation.
Sample output
From the Maxwell trust-region (MrHyDE code base) convergence test:
Truncated CG Trust-Region Solver ------------------------------------------------------------------------------------------------------------------ Trust-Region status output definitions iter - Number of iterates (steps taken) value - Objective function value gnorm - Norm of the gradient snorm - Norm of the step (update to optimization vector) delta - Trust-Region radius #fval - Number of times the objective function was evaluated #grad - Number of times the gradient was computed tr_flag - Trust-Region flag 0 - Both actual and predicted reductions are positive (success) 1 - Actual reduction is positive and predicted reduction is negative (impossible) 2 - Actual reduction is nonpositive and predicted reduction is positive 3 - Actual reduction is nonpositive and predicted reduction is negative (impossible) 4 - Actual and/or predicted reduction is a NaN 5 - Subproblem solution did not produce sufficient decrease iterCG - Number of Truncated CG iterations flagGC - Trust-Region Truncated CG flag 0 - Residual tolerance met 1 - Iteration limit exceeded 2 - Negative curvature detected 3 - Trust-Region radius exceeded 4 - Initial right hand side is zero ------------------------------------------------------------------------------------------------------------------ iter value gnorm snorm delta #fval #grad tr_flag iterCG flagCG 0 1.230816e-09 8.489304e+01 --- 1.000000e+08 1 1 --- --- --- ------------------------------------------------------------------------------------------------------------------ iter rnorm snorm alpha pRed flag 0 8.489304e+01 --- --- --- --- 1 1.873778e+01 2.640788e-11 3.110724e-13 1.120923e-09 0 2 1.556263e+01 2.921492e-11 4.189361e-13 1.194468e-09 0 3 1.411113e+01 2.974840e-11 7.931455e-14 1.204073e-09 0 4 9.905355e+00 3.036595e-11 9.323619e-14 1.213355e-09 0 5 8.448704e+00 3.074698e-11 9.734039e-14 1.218131e-09 0 6 7.009111e+00 3.107088e-11 9.665340e-14 1.221580e-09 0 7 6.070776e+00 3.136131e-11 1.069577e-13 1.224208e-09 0 8 4.840363e+00 3.158337e-11 9.390436e-14 1.225938e-09 0 9 3.942215e+00 3.174684e-11 9.579257e-14 1.227060e-09 0 10 3.478318e+00 3.187799e-11 1.032030e-13 1.227862e-09 0 CG done: flag=1 In TrustRegionUtilities::analyzeRatio Current objective function value: 1.23082e-09 New objective function value: 2.95411e-12 Actual reduction: 1.22786e-09 Predicted reduction: 1.22786e-09 Safeguard: 2.22045e-15 Actual reduction with safeguard: 1.22786e-09 Predicted reduction with safeguard: 1.22786e-09 Ratio of actual and predicted reduction: 1 Trust-region flag: 0 ------------------------------------------------------------------------------------------------------------------ Trust-Region status output definitions iter - Number of iterates (steps taken) value - Objective function value gnorm - Norm of the gradient snorm - Norm of the step (update to optimization vector) delta - Trust-Region radius #fval - Number of times the objective function was evaluated #grad - Number of times the gradient was computed tr_flag - Trust-Region flag 0 - Both actual and predicted reductions are positive (success) 1 - Actual reduction is positive and predicted reduction is negative (impossible) 2 - Actual reduction is nonpositive and predicted reduction is positive 3 - Actual reduction is nonpositive and predicted reduction is negative (impossible) 4 - Actual and/or predicted reduction is a NaN 5 - Subproblem solution did not produce sufficient decrease iterCG - Number of Truncated CG iterations flagGC - Trust-Region Truncated CG flag 0 - Residual tolerance met 1 - Iteration limit exceeded 2 - Negative curvature detected 3 - Trust-Region radius exceeded 4 - Initial right hand side is zero ------------------------------------------------------------------------------------------------------------------ iter value gnorm snorm delta #fval #grad tr_flag iterCG flagCG 1 2.954107e-12 3.478318e+00 3.187799e-11 1.000000e+09 2 2 0 10 1 Optimization Terminated with Status: Iteration Limit ExceededPost processing this style output enables one get a better look at the convergence dynamics of truncated CG.
