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 
252 
254  CASADI_EXPORT Function rootfinder(const std::string& name, const std::string& solver,
255  const SXDict& rfp, const Dict& opts=Dict());
256  CASADI_EXPORT Function rootfinder(const std::string& name, const std::string& solver,
257  const MXDict& rfp, const Dict& opts=Dict());
258  CASADI_EXPORT Function rootfinder(const std::string& name, const std::string& solver,
259  const Function& f, const Dict& opts=Dict());
261 
295  CASADI_EXPORT std::vector<std::string> rootfinder_in();
296 
327  CASADI_EXPORT std::vector<std::string> rootfinder_out();
328 
357  CASADI_EXPORT std::string rootfinder_in(casadi_int ind);
358 
386  CASADI_EXPORT std::string rootfinder_out(casadi_int ind);
387 
412  CASADI_EXPORT casadi_int rootfinder_n_in();
413 
438  CASADI_EXPORT casadi_int rootfinder_n_out();
439 
473  CASADI_EXPORT std::vector<std::string> rootfinder_options(const std::string& name);
474 
509  CASADI_EXPORT std::string rootfinder_option_type(const std::string& name, const std::string& op);
510 
538  CASADI_EXPORT std::string rootfinder_option_info(const std::string& name, const std::string& op);
539 
567  CASADI_EXPORT bool has_rootfinder(const std::string& name);
568 
604  CASADI_EXPORT void load_rootfinder(const std::string& name);
605 
632  CASADI_EXPORT std::string doc_rootfinder(const std::string& name);
635  #ifndef SWIG
637  enum RfpIn {
638  RFP_X,
639  RFP_P,
640  RFP_NUM_IN};
641 
643  const std::vector<std::string> RFP_INPUTS = {"x", "p"};
644 
646  enum RfpOut {
647  RFP_G,
648  RFP_NUM_OUT};
649 
651  const std::vector<std::string> RFP_OUTPUTS = {"g"};
652 
654  enum RootfinderInput {
656  ROOTFINDER_X0,
658  ROOTFINDER_P,
660  ROOTFINDER_NUM_IN
661  };
662 
664  enum RootfinderOutput {
666  ROOTFINDER_X,
668  ROOTFINDER_NUM_OUT
669  };
670  #endif // SWIG
671 
672 } // namespace casadi
673 
674 #endif // CASADI_ROOTFINDER_HPP
Function object.
Definition: function.hpp:126
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 the type of an option of a rootfinder plugin.
CASADI_EXPORT std::vector< std::string > rootfinder_options(const std::string &name)
Get all options of a rootfinder plugin.
CASADI_EXPORT casadi_int rootfinder_n_out()
Number of rootfinder outputs.
CASADI_EXPORT std::vector< std::string > rootfinder_out()
Get the 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 rootfinder plugin.
CASADI_EXPORT std::string rootfinder_option_info(const std::string &name, const std::string &op)
Get the documentation string of an option of a rootfinder plugin.
CASADI_EXPORT std::string doc_rootfinder(const std::string &name)
Get the documentation string of a rootfinder plugin.
CASADI_EXPORT std::vector< std::string > rootfinder_in()
Get the rootfinder input scheme.
CASADI_EXPORT bool has_rootfinder(const std::string &name)
Check if a rootfinder plugin is available.
The casadi namespace.
Definition: archiver.hpp:32
std::map< std::string, MX > MXDict
Definition: mx.hpp:5151
std::map< std::string, SX > SXDict
Definition: sx_fwd.hpp:40
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.