From: Jean-Paul Pelteret Date: Mon, 17 Sep 2018 12:36:48 +0000 (+0200) Subject: Increase debug output for line search X-Git-Tag: v9.1.0-rc1~696^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7dd465296467990460770c92a96e9909430c09d;p=dealii.git Increase debug output for line search --- diff --git a/include/deal.II/optimization/line_minimization.h b/include/deal.II/optimization/line_minimization.h index 160913b74d..e6d47539d0 100644 --- a/include/deal.II/optimization/line_minimization.h +++ b/include/deal.II/optimization/line_minimization.h @@ -442,11 +442,16 @@ namespace LineMinimization if (debug_output) deallog << "Bracketing phase: " << i << std::endl - << ai << " " << fi << " " << gi << std::endl; + << ai << " " << fi << " " << gi << " " << w1(ai, fi) << " " + << w2(gi) << " " << f_min << std::endl; // first check if we can stop bracketing or the whole line search: if (fi <= f_min || ai == a_max) - return std::make_pair(ai, i); + { + if (debug_output) + deallog << "Reached the maximum step size." << std::endl; + return std::make_pair(ai, i); + } if (!w1(ai, fi) || (fi >= f_prev && i > 1)) // violate first Wolfe or not descending @@ -463,6 +468,10 @@ namespace LineMinimization if (w2(gi)) // satisfies both Wolfe conditions { + if (debug_output) + deallog << "Satisfied both Wolfe conditions during Bracketing." + << std::endl; + Assert(w1(ai, fi), ExcInternalError()); return std::make_pair(ai, i); } @@ -541,9 +550,12 @@ namespace LineMinimization if (debug_output) deallog << "Sectioning phase: " << i << std::endl - << a_lo << " " << f_lo << " " << g_lo << std::endl - << a_hi << " " << f_hi << " " << g_hi << std::endl - << ai << " " << fi << " " << gi << std::endl; + << a_lo << " " << f_lo << " " << g_lo << " " << w1(a_lo, f_lo) + << " " << w2(g_lo) << std::endl + << a_hi << " " << f_hi << " " << g_hi << " " << w1(a_hi, f_hi) + << " " << w2(g_hi) << std::endl + << ai << " " << fi << " " << gi << " " << w1(ai, fi) << " " + << w2(gi) << std::endl; if (!w1(ai, fi) || fi >= f_lo) // take [a_lo, ai] @@ -560,6 +572,8 @@ namespace LineMinimization { if (w2(gi)) // satisfies both wolf { + if (debug_output) + deallog << "Satisfied both Wolfe conditions." << std::endl; Assert(w1(ai, fi), ExcInternalError()); return std::make_pair(ai, i); } diff --git a/tests/optimization/line_minimization.output b/tests/optimization/line_minimization.output index e1a7ffbcd4..62ca697723 100644 --- a/tests/optimization/line_minimization.output +++ b/tests/optimization/line_minimization.output @@ -1,18 +1,19 @@ DEAL::Bracketing phase: 1 -DEAL::0.100000 0.820000 -1.40000 +DEAL::0.100000 0.820000 -1.40000 1 0 -1.00000 DEAL::Bracketing phase: 2 -DEAL::1.00000 100.000 400.000 +DEAL::1.00000 100.000 400.000 0 0 -1.00000 DEAL::Sectioning phase: 3 -DEAL::0.100000 0.820000 -1.40000 -DEAL::1.00000 100.000 400.000 -DEAL::0.333333 1.67901 13.4815 +DEAL::0.100000 0.820000 -1.40000 1 0 +DEAL::1.00000 100.000 400.000 0 0 +DEAL::0.333333 1.67901 13.4815 0 0 DEAL::Sectioning phase: 4 -DEAL::0.100000 0.820000 -1.40000 -DEAL::0.333333 1.67901 13.4815 -DEAL::0.167641 0.771802 0.219785 +DEAL::0.100000 0.820000 -1.40000 1 0 +DEAL::0.333333 1.67901 13.4815 0 0 +DEAL::0.167641 0.771802 0.219785 1 0 DEAL::Sectioning phase: 5 -DEAL::0.167641 0.771802 0.219785 -DEAL::0.100000 0.820000 -1.40000 -DEAL::0.159668 0.771152 -0.0524435 +DEAL::0.167641 0.771802 0.219785 1 0 +DEAL::0.100000 0.820000 -1.40000 1 0 +DEAL::0.159668 0.771152 -0.0524435 1 1 +DEAL::Satisfied both Wolfe conditions. DEAL::Solution: 0.159668 DEAL::Distance: 0.00159407 diff --git a/tests/optimization/line_minimization_02.output b/tests/optimization/line_minimization_02.output index 5a8e71a380..98ceb6c460 100644 --- a/tests/optimization/line_minimization_02.output +++ b/tests/optimization/line_minimization_02.output @@ -1,37 +1,40 @@ DEAL::Case 1: DEAL::Bracketing phase: 1 -DEAL::13.0000 -0.618070 -0.0128665 +DEAL::13.0000 -0.618070 -0.0128665 1 1 -1.14750 +DEAL::Satisfied both Wolfe conditions during Bracketing. DEAL::Solution: 13.0000 DEAL::Distance: 11.5255 DEAL::Case 2: DEAL::Bracketing phase: 1 -DEAL::0.100000 -0.152254 -1.50769 +DEAL::0.100000 -0.152254 -1.50769 1 0 -1.14750 DEAL::Bracketing phase: 2 -DEAL::1.00000 -1.03000 -0.363333 +DEAL::1.00000 -1.03000 -0.363333 1 0 -1.14750 DEAL::Bracketing phase: 3 -DEAL::9.10000 -0.594896 0.00370484 +DEAL::9.10000 -0.594896 0.00370484 1 1 -1.14750 DEAL::Sectioning phase: 4 -DEAL::1.00000 -1.03000 -0.363333 -DEAL::9.10000 -0.594896 0.00370484 -DEAL::3.09290 -0.895024 0.139676 +DEAL::1.00000 -1.03000 -0.363333 1 0 +DEAL::9.10000 -0.594896 0.00370484 1 1 +DEAL::3.09290 -0.895024 0.139676 1 1 DEAL::Sectioning phase: 5 -DEAL::1.00000 -1.03000 -0.363333 -DEAL::3.09290 -0.895024 0.139676 -DEAL::1.60613 -1.10031 0.0529144 +DEAL::1.00000 -1.03000 -0.363333 1 0 +DEAL::3.09290 -0.895024 0.139676 1 1 +DEAL::1.60613 -1.10031 0.0529144 1 1 +DEAL::Satisfied both Wolfe conditions. DEAL::Solution: 1.60613 DEAL::Distance: 0.131601 DEAL::Case 3: DEAL::Bracketing phase: 1 -DEAL::1.00000 -1.03000 -0.363333 +DEAL::1.00000 -1.03000 -0.363333 1 0 -1.14750 DEAL::Bracketing phase: 2 -DEAL::10.0000 -0.594118 -0.00174164 +DEAL::10.0000 -0.594118 -0.00174164 1 1 -1.14750 DEAL::Sectioning phase: 3 -DEAL::1.00000 -1.03000 -0.363333 -DEAL::10.0000 -0.594118 -0.00174164 -DEAL::3.36365 -0.858821 0.127629 +DEAL::1.00000 -1.03000 -0.363333 1 0 +DEAL::10.0000 -0.594118 -0.00174164 1 1 +DEAL::3.36365 -0.858821 0.127629 1 1 DEAL::Sectioning phase: 4 -DEAL::1.00000 -1.03000 -0.363333 -DEAL::3.36365 -0.858821 0.127629 -DEAL::1.65166 -1.09756 0.0676998 +DEAL::1.00000 -1.03000 -0.363333 1 0 +DEAL::3.36365 -0.858821 0.127629 1 1 +DEAL::1.65166 -1.09756 0.0676998 1 1 +DEAL::Satisfied both Wolfe conditions. DEAL::Solution: 1.65166 DEAL::Distance: 0.177131