Ensure and track monotonicity
This is a collection of many interacting patches that help to ensure monotonicity of the TNNMG iteration and add more diagnostic output to track the latter:
- Implement
ScalarSumFunctional::operator()
in a way that is consistent with the global energy evaluation. Unfortunately this means we cannot use the evaluation of the individual constrained functionals. - Implement
derivative(ScalarSumFunctional)
. The functional is in general not differentiable, hence we return the minimal norm entry of the subdifferential or, equivalently, the projection of zero into the subdifferential. Finding a root of the subdifferential is equivalent to find a root of this single-valued map. Furthermore a subdifferential-aware bisection is equivalent to a bisection for the single-valued map. - To ensure monotonicity of the coarse grid correction add a postprocessing step to the line search: After an approximate root of the derivative has been found, check if this decreases energy. If not, then half the step size until it does. Since we have a descent direction this must terminate. This step is necessary because the functional is not convex.
- When comparing energies take care to always evaluate it exactly the same way, to avoid non-monotonicity due to inconsistent evaluation algorithms.
- Track energy decrease of nonlinear smoother and coarse grid correction. While the latter is guaranteed by the above changes, it may happen that the smoother is not monotone - either because of local solves with uncontrolled inexactness (called exact in our terminalogy, arg...) or because of round-off-errors.
- Add more diagnostic output to the table:
- Number of subdifferential evaluations during line search. Hint on interpretation: This will be at least 2+#bisectionSteps.
- Number of functional evaluations during line search. Hint on interpretation: This will be 2+#reductionSteps, where #reductionSteps is the number of halving steps done to ensure monotonicity (see above).
- Energy after TNNMG step with 16 digits.
- Energy after nonlinear pre-smoothing with 16 digits.
- If the nonlinear pre-smoother is not monotone:
Relative monotonicity violation of the smoother with an additional
X
marker for easier grepping.