GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: unittest/factory/solver.hpp Lines: 6 6 100.0 %
Date: 2024-02-13 11:12:33 Branches: 4 6 66.7 %

Line Branch Exec Source
1
///////////////////////////////////////////////////////////////////////////////
2
// BSD 3-Clause License
3
//
4
// Copyright (C) 2019-2021, University of Edinburgh, LAAS-CNRS,
5
//                          New York University, Max Planck Gesellschaft
6
// Copyright note valid unless otherwise stated in individual files.
7
// All rights reserved.
8
///////////////////////////////////////////////////////////////////////////////
9
10
#ifndef CROCODDYL_SOLVER_FACTORY_HPP_
11
#define CROCODDYL_SOLVER_FACTORY_HPP_
12
13
#include "action.hpp"
14
#include "crocoddyl/core/solver-base.hpp"
15
#include "crocoddyl/core/solvers/kkt.hpp"
16
17
namespace crocoddyl {
18
namespace unittest {
19
20
struct SolverTypes {
21
  enum Type {
22
    SolverKKT,
23
    SolverDDP,
24
    SolverFDDP,
25
    SolverBoxDDP,
26
    SolverBoxFDDP,
27
    SolverIpopt,
28
    NbSolverTypes
29
  };
30
23
  static std::vector<Type> init_all() {
31
23
    std::vector<Type> v;
32
23
    v.reserve(NbSolverTypes);
33
161
    for (int i = 0; i < NbSolverTypes; ++i) {
34
#ifndef CROCODDYL_WITH_IPOPT
35
      if ((Type)i == SolverIpopt) {
36
        continue;
37
      }
38
#endif
39
138
      v.push_back((Type)i);
40
    }
41
23
    return v;
42
  }
43
  static const std::vector<Type> all;
44
};
45
46
std::ostream& operator<<(std::ostream& os, SolverTypes::Type type);
47
48
class SolverFactory {
49
 public:
50
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
51
52
  explicit SolverFactory();
53
  ~SolverFactory();
54
55
  boost::shared_ptr<crocoddyl::SolverAbstract> create(
56
      SolverTypes::Type solver_type, ActionModelTypes::Type action_type,
57
      size_t T) const;
58
};
59
60
}  // namespace unittest
61
}  // namespace crocoddyl
62
63
#endif  // CROCODDYL_SOLVER_FACTORY_HPP_