Crocoddyl
 
Loading...
Searching...
No Matches
callbacks.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2019-2023, LAAS-CNRS, University of Oxford,
5// Heriot-Watt University
6// Copyright note valid unless otherwise stated in individual files.
7// All rights reserved.
9
10#ifndef CROCODDYL_CORE_UTILS_CALLBACKS_HPP_
11#define CROCODDYL_CORE_UTILS_CALLBACKS_HPP_
12
13#include <iomanip>
14
15#include "crocoddyl/core/solver-base.hpp"
16
17namespace crocoddyl {
18
19enum VerboseLevel {
20 _0 = 0, //<! Zero print level that doesn't contain merit-function and
21 // constraints information
22 _1, //<! First print level that includes level-0, merit-function and
23 // dynamics-constraints information
24 _2, //<! Second print level that includes level-1 and dual-variable
25 // regularization
26 _3, //<! Third print level that includes level-2, and equality and inequality
27 // constraints information
28 _4, //<! Fourht print level that includes expected and current improvements
29 // in the merit function
30};
32 public:
33 explicit CallbackVerbose(VerboseLevel level = _4, int precision = 3);
34 ~CallbackVerbose() override;
35
36 void operator()(SolverAbstract& solver) override;
37
38 VerboseLevel get_level() const;
39 void set_level(VerboseLevel level);
40
41 int get_precision() const;
42 void set_precision(int precision);
43
44 private:
45 VerboseLevel level_;
46 int precision_;
47 std::string header_;
48 std::string separator_;
49 std::string separator_short_;
50
51 void update_header();
52};
53
54} // namespace crocoddyl
55
56#endif // CROCODDYL_CORE_UTILS_CALLBACKS_HPP_
Abstract class for solver callbacks.
void operator()(SolverAbstract &solver) override
Run the callback function given a solver.
Abstract class for optimal control solvers.