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());
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
-DEAL:BFGS::Starting value 63.201
------------------------------------------------
Line search 0
-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
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());
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
-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