rootfinder.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_ROOTFINDER_HPP
27 #define CASADI_ROOTFINDER_HPP
28 
29 #include "function.hpp"
30 #include "linsol.hpp"
31 
32 namespace casadi {
33 
72 
74  CASADI_EXPORT Function rootfinder(const std::string& name, const std::string& solver,
75  const SXDict& rfp, const Dict& opts=Dict());
76  CASADI_EXPORT Function rootfinder(const std::string& name, const std::string& solver,
77  const MXDict& rfp, const Dict& opts=Dict());
78  CASADI_EXPORT Function rootfinder(const std::string& name, const std::string& solver,
79  const Function& f, const Dict& opts=Dict());
81 
85  CASADI_EXPORT std::vector<std::string> rootfinder_in();
86 
90  CASADI_EXPORT std::vector<std::string> rootfinder_out();
91 
95  CASADI_EXPORT std::string rootfinder_in(casadi_int ind);
96 
100  CASADI_EXPORT std::string rootfinder_out(casadi_int ind);
101 
105  CASADI_EXPORT casadi_int rootfinder_n_in();
106 
110  CASADI_EXPORT casadi_int rootfinder_n_out();
111 
115  CASADI_EXPORT std::vector<std::string> rootfinder_options(const std::string& name);
116 
120  CASADI_EXPORT std::string rootfinder_option_type(const std::string& name, const std::string& op);
121 
125  CASADI_EXPORT std::string rootfinder_option_info(const std::string& name, const std::string& op);
126 
128  CASADI_EXPORT bool has_rootfinder(const std::string& name);
129 
131  CASADI_EXPORT void load_rootfinder(const std::string& name);
132 
134  CASADI_EXPORT std::string doc_rootfinder(const std::string& name);
137  #ifndef SWIG
139  enum RfpIn {
140  RFP_X,
141  RFP_P,
142  RFP_NUM_IN};
143 
145  const std::vector<std::string> RFP_INPUTS = {"x", "p"};
146 
148  enum RfpOut {
149  RFP_G,
150  RFP_NUM_OUT};
151 
153  const std::vector<std::string> RFP_OUTPUTS = {"g"};
154 
156  enum RootfinderInput {
158  ROOTFINDER_X0,
160  ROOTFINDER_P,
162  ROOTFINDER_NUM_IN
163  };
164 
166  enum RootfinderOutput {
168  ROOTFINDER_X,
170  ROOTFINDER_NUM_OUT
171  };
172  #endif // SWIG
173 
174 } // namespace casadi
175 
176 #endif // CASADI_ROOTFINDER_HPP
Function object.
Definition: function.hpp:60
CASADI_EXPORT Function rootfinder(const std::string &name, const std::string &solver, const SXDict &rfp, const Dict &opts=Dict())
CASADI_EXPORT std::string rootfinder_option_type(const std::string &name, const std::string &op)
Get type info for a particular option.
CASADI_EXPORT std::vector< std::string > rootfinder_options(const std::string &name)
Get all options for a plugin.
CASADI_EXPORT casadi_int rootfinder_n_out()
Number of rootfinder outputs.
CASADI_EXPORT std::vector< std::string > rootfinder_out()
Get rootfinder output scheme.
CASADI_EXPORT casadi_int rootfinder_n_in()
Number of rootfinder inputs.
CASADI_EXPORT void load_rootfinder(const std::string &name)
Explicitly load a plugin dynamically.
CASADI_EXPORT std::string rootfinder_option_info(const std::string &name, const std::string &op)
Get documentation for a particular option.
CASADI_EXPORT std::string doc_rootfinder(const std::string &name)
Get the documentation string for a plugin.
CASADI_EXPORT std::vector< std::string > rootfinder_in()
Get rootfinder input scheme.
CASADI_EXPORT bool has_rootfinder(const std::string &name)
Check if a particular plugin is available.
The casadi namespace.
std::map< std::string, MX > MXDict
Definition: mx.hpp:943
std::map< std::string, SX > SXDict
Definition: sx_fwd.hpp:40
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.