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#include <iostream>
15
16#include "crocoddyl/core/solver-base.hpp"
17
18namespace crocoddyl {
19
20enum VerboseLevel {
21 _0 = 0, //<! Zero print level that doesn't contain merit-function and
22 // constraints information
23 _1, //<! First print level that includes level-0, merit-function and
24 // dynamics-constraints information
25 _2, //<! Second print level that includes level-1 and dual-variable
26 // regularization
27 _3, //<! Third print level that includes level-2, and equality and inequality
28 // constraints information
29 _4, //<! Fourht print level that includes expected and current improvements
30 // in the merit function
31};
33 public:
34 explicit CallbackVerbose(VerboseLevel level = _4, int precision = 3);
35 ~CallbackVerbose() override;
36
37 void operator()(SolverAbstract& solver) override;
38
39 VerboseLevel get_level() const;
40 void set_level(VerboseLevel level);
41
42 int get_precision() const;
43 void set_precision(int precision);
44
45 private:
46 VerboseLevel level_;
47 int precision_;
48 std::string header_;
49 std::string separator_;
50 std::string separator_short_;
51
52 void update_header();
53};
54
55} // namespace crocoddyl
56
57#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.