@@ -42,8 +42,8 @@ namespace cppoptlib::solver {
4242// Returns the default callback function.
4343template <class FunctionType , class StateType >
4444auto PrintCallback () {
45- return [](const FunctionType & function, const StateType & state,
46- const Progress<FunctionType, StateType> & progress) {
45+ return [](const FunctionType& function, const StateType& state,
46+ const Progress<FunctionType, StateType>& progress) {
4747 std::cout << " Function-State"
4848 << " \t " ;
4949 std::cout << " value " << function (state.x ) << " \t " ;
@@ -73,8 +73,8 @@ auto PrintCallback() {
7373
7474template <class FunctionType , class StateType >
7575auto NoOpCallback () {
76- return [](const FunctionType & /* function*/ , const StateType & /* state*/ ,
77- const Progress<FunctionType, StateType> & /* progress*/ ) {};
76+ return [](const FunctionType& /* function*/ , const StateType& /* state*/ ,
77+ const Progress<FunctionType, StateType>& /* progress*/ ) {};
7878}
7979
8080// Specifies a solver implementation (of a given order) for a given function
@@ -93,26 +93,22 @@ class Solver {
9393
9494 // protected:
9595 // using StateType = typename FunctionType::StateType;
96+ progress_t stopping_progress;
9697
9798 public:
98- Solver () = default ;
99- // explicit Solver(const Progress<FunctionType> &stopping_progress =
100- // DefaultStoppingSolverProgress<FunctionType>(),
101- // callback_t step_callback = NoOpCallback<FunctionType>())
102- // : stopping_progress(stopping_progress),
103- // step_callback_(std::move(step_callback)) {}
99+ explicit Solver (const progress_t & stopping_progress =
100+ DefaultStoppingSolverProgress<FunctionType, StateType>())
101+ : stopping_progress(stopping_progress) {}
104102
105103 virtual ~Solver () = default ;
106104
107- virtual void InitializeSolver (const FunctionType & /* function*/ ,
108- const StateType & /* initial_state*/ ) = 0;
105+ virtual void InitializeSolver (const FunctionType& /* function*/ ,
106+ const StateType& /* initial_state*/ ) = 0;
109107
110108 virtual std::tuple<StateType, Progress<FunctionType, StateType>> Minimize (
111- const FunctionType & function, const StateType & function_state) {
109+ const FunctionType& function, const StateType& function_state) {
112110 // Solver state during the optimization.
113111 progress_t solver_state;
114- progress_t stopping_progress =
115- DefaultStoppingSolverProgress<FunctionType, StateType>();
116112 // return {function_state, solver_state};
117113 // // Function state during the optimization.
118114 StateType current_function_state = function_state;
@@ -141,9 +137,9 @@ class Solver {
141137 return {current_function_state, solver_state};
142138 }
143139
144- virtual StateType OptimizationStep (const FunctionType & function,
145- const StateType & current,
146- const progress_t & state) = 0;
140+ virtual StateType OptimizationStep (const FunctionType& function,
141+ const StateType& current,
142+ const progress_t & state) = 0;
147143
148144 // progress_t stopping_progress; // Specifies when to stop.
149145 // protected:
0 commit comments