dple_impl.hpp
1 /*
2  * This file is part of CasADi.
3  *
4  * CasADi -- A symbolic framework for dynamic optimization.
5  * Copyright (C) 2010-2023 Joel Andersson, Joris Gillis, Moritz Diehl,
6  * KU Leuven. All rights reserved.
7  * Copyright (C) 2011-2014 Greg Horn
8  *
9  * CasADi is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 3 of the License, or (at your option) any later version.
13  *
14  * CasADi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with CasADi; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 
26 #ifndef CASADI_DPLE_IMPL_HPP
27 #define CASADI_DPLE_IMPL_HPP
28 
29 #include "dple.hpp"
30 #include "function_internal.hpp"
31 #include "plugin_interface.hpp"
32 
34 namespace casadi {
36  class CASADI_EXPORT Dple : public FunctionInternal, public PluginInterface<Dple> {
37  public:
38 
39  // Constructor
40  Dple(const std::string& name, const SpDict &st);
41 
42  // Destructor
43  ~Dple() override = 0;
44 
46 
49  size_t get_n_in() override { return DPLE_NUM_IN;}
50  size_t get_n_out() override { return DPLE_NUM_OUT;}
52 
54 
57  Sparsity get_sparsity_in(casadi_int i) override;
58  Sparsity get_sparsity_out(casadi_int i) override;
60 
62 
65  std::string get_name_in(casadi_int i) override { return dple_in(i);}
66  std::string get_name_out(casadi_int i) override { return dple_out(i);}
68 
70 
73  static const Options options_;
74  const Options& get_options() const override { return options_;}
76 
77  // Initialize
78  void init(const Dict& opts) override;
79 
81 
84  bool has_forward(casadi_int nfwd) const override { return true;}
85  Function get_forward(casadi_int nfwd, const std::string& name,
86  const std::vector<std::string>& inames,
87  const std::vector<std::string>& onames,
88  const Dict& opts) const override;
90 
92 
95  bool has_reverse(casadi_int nadj) const override { return true;}
96  Function get_reverse(casadi_int nadj, const std::string& name,
97  const std::vector<std::string>& inames,
98  const std::vector<std::string>& onames,
99  const Dict& opts) const override;
101 
102  // Creator function for internal class
103  typedef Dple* (*Creator)(const std::string& name,
104  const std::map<std::string, Sparsity>& st);
105 
106  // No static functions exposed
107  struct Exposed{ };
108 
110  static std::map<std::string, Plugin> solvers_;
111 
113  static const std::string infix_;
114 
116  static std::string shortname() { return "dple";}
117 
118  protected:
119 
121  Sparsity A_;
122 
124  Sparsity V_;
125 
127  casadi_int K_;
128 
130  bool const_dim_;
131 
133  bool pos_def_;
134 
136  bool error_unstable_;
137 
139  double eps_unstable_;
140 
142  casadi_int nrhs_;
143 
144  };
145 
146 
147 } // namespace casadi
149 #endif // CASADI_DPLE_IMPL_HPP
CASADI_EXPORT std::vector< std::string > dple_in()
Get input scheme of DPLE solvers.
CASADI_EXPORT std::vector< std::string > dple_out()
Get output scheme of DPLE solvers.
The casadi namespace.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
std::map< std::string, Sparsity > SpDict
Definition: sparsity.hpp:1490