]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for range of function calls in bfgs tests. 13751/head
authorMarc Fehling <mafehling.git@gmail.com>
Thu, 19 May 2022 21:17:14 +0000 (15:17 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Thu, 19 May 2022 21:17:14 +0000 (15:17 -0600)
tests/optimization/bfgs_05.cc
tests/optimization/bfgs_05.output
tests/optimization/bfgs_05b.cc
tests/optimization/bfgs_05b.output

index bd12085ce3943e0d1f84821fdc22421e085ea309..cfccb7352326ab675078c9afe02a9e8a1092537b 100644 (file)
@@ -210,7 +210,13 @@ test()
   SolverBFGS<VectorType>                          solver(solver_control, data);
   solver.connect_line_search_slot(line_min);
   solver.connect_preconditioner_slot(preconditioner);
-  solver.solve(func, x);
+
+  // We will check whether the number of function calls is within a specified
+  // range.
+  check_solver_within_range(solver.solve(func, x),
+                            (tot_fun_calls - 1) /*one evaluation above*/,
+                            130,
+                            140);
 
   Assert(tot_fun_calls == line_search_iterations + 1, ExcInternalError());
 
@@ -221,9 +227,6 @@ test()
 
   x.add(-1, location);
   deallog << "Linf error in solution: " << x.linfty_norm() << std::endl;
-
-  // deallog << "function calls: "
-  //         << (tot_fun_calls - 1) /*one evaluation above*/ << std::endl;
 }
 
 int
index a9c30079912519f882f0786b77a262de5a0235d1..ed87759cccb5b9efdb10d15825ae380d76414ce4 100644 (file)
@@ -1,5 +1,4 @@
 
-DEAL:BFGS::Starting value 63.201
 ------------------------------------------------
 Line search 0
 
@@ -156,7 +155,7 @@ function value: 9.39817  stepsize: 1.00000
          -0.10382         -2.78767          0.00745
          -0.04649         -1.29372          0.00407
           0.00033          0.06337         -0.00053
-DEAL:BFGS::Convergence step 127 value 8.1397e-06
+DEAL::Solver stopped within 130 - 140 iterations
 DEAL::Limited memory BFGS solution:
 -4.483e-09 5.000e-02 1.000e-01 1.500e-01 2.000e-01 2.500e-01 3.000e-01 3.500e-01 4.000e-01 4.500e-01 5.000e-01 5.500e-01 6.000e-01 6.500e-01 7.000e-01 7.500e-01 8.000e-01 8.500e-01 9.000e-01 9.500e-01 1.000e+00 
 DEAL::Function value: 1.3096e-13
index 5d5257aee941cee0366493d91a4de3ff6c189870..b2632f9e4d0e5aca57cdb4aa73a6a066381cd18e 100644 (file)
@@ -113,7 +113,13 @@ test()
   typename SolverBFGS<VectorType>::AdditionalData data(m_max, false);
   SolverBFGS<VectorType>                          solver(solver_control, data);
   solver.connect_preconditioner_slot(preconditioner);
-  solver.solve(func, x);
+
+  // We will check whether the number of function calls is within a specified
+  // range.
+  check_solver_within_range(solver.solve(func, x),
+                            (tot_fun_calls - 1) /*one evaluation above*/,
+                            130,
+                            140);
 
   deallog << "Limited memory BFGS solution:" << std::endl;
   x.print(deallog.get_file_stream());
@@ -122,9 +128,6 @@ test()
 
   x.add(-1, location);
   deallog << "Linf error in solution: " << x.linfty_norm() << std::endl;
-
-  // deallog << "function calls: "
-  //         << (tot_fun_calls - 1) /*one evaluation above*/ << std::endl;
 }
 
 int
index e3b6ff726880686a962be7b2519a6c638c3f4f94..bc2b2c92d4a50d8a8d1d7ea881a362134b1a9f1b 100644 (file)
@@ -1,6 +1,5 @@
 
-DEAL:BFGS::Starting value 63.201
-DEAL:BFGS::Convergence step 127 value 8.1397e-06
+DEAL::Solver stopped within 130 - 140 iterations
 DEAL::Limited memory BFGS solution:
 -4.483e-09 5.000e-02 1.000e-01 1.500e-01 2.000e-01 2.500e-01 3.000e-01 3.500e-01 4.000e-01 4.500e-01 5.000e-01 5.500e-01 6.000e-01 6.500e-01 7.000e-01 7.500e-01 8.000e-01 8.500e-01 9.000e-01 9.500e-01 1.000e+00 
 DEAL::Function value: 1.3096e-13

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.