qp_to_nlp.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_QP_TO_NLP_HPP
27 #define CASADI_QP_TO_NLP_HPP
28 
29 #include "casadi/core/conic_impl.hpp"
30 #include <casadi/solvers/casadi_conic_nlpsol_export.h>
31 
32 
44 namespace casadi {
45 
46  struct CASADI_CONIC_NLPSOL_EXPORT QpToNlpMemory : public ConicMemory {
47  casadi_int nlp_mem;
48 
51 
54  };
55 
64  class CASADI_CONIC_NLPSOL_EXPORT QpToNlp : public Conic {
65  public:
67  explicit QpToNlp(const std::string& name,
68  const std::map<std::string, Sparsity> &st);
69 
71  static Conic* creator(const std::string& name,
72  const std::map<std::string, Sparsity>& st) {
73  return new QpToNlp(name, st);
74  }
75 
77  ~QpToNlp() override;
78 
79  // Get name of the plugin
80  const char* plugin_name() const override { return "nlpsol";}
81 
82  // Get name of the class
83  std::string class_name() const override { return "QpToNlp";}
84 
86  void* alloc_mem() const override;
87 
89  void free_mem(void *mem) const override;
90 
92 
93  static const Options options_;
94  const Options& get_options() const override { return options_;}
96 
98  Dict get_stats(void* mem) const override;
99 
101  void init(const Dict& opts) override;
102 
103  int solve(const double** arg, double** res,
104  casadi_int* iw, double* w, void* mem) const override;
105 
107  static const std::string meta_doc;
108 
111 
112  void serialize_body(SerializingStream &s) const override;
113 
115  static ProtoFunction* deserialize(DeserializingStream& s) { return new QpToNlp(s); }
116 
117  protected:
119  explicit QpToNlp(DeserializingStream& s);
120  };
121 
122 } // namespace casadi
124 #endif // CASADI_QP_TO_NLP_HPP
Internal class.
Definition: conic_impl.hpp:44
Helper class for Serialization.
Function object.
Definition: function.hpp:60
Base class for FunctionInternal and LinsolInternal.
'nlpsol' plugin for Conic
Definition: qp_to_nlp.hpp:64
static Conic * creator(const std::string &name, const std::map< std::string, Sparsity > &st)
Create a new QP Solver.
Definition: qp_to_nlp.hpp:71
Function solver_
Solve with.
Definition: qp_to_nlp.hpp:110
static ProtoFunction * deserialize(DeserializingStream &s)
Deserialize with type disambiguation.
Definition: qp_to_nlp.hpp:115
static const Options options_
Options.
Definition: qp_to_nlp.hpp:93
const char * plugin_name() const override
Definition: qp_to_nlp.hpp:80
const Options & get_options() const override
Options.
Definition: qp_to_nlp.hpp:94
std::string class_name() const override
Readable name of the internal class.
Definition: qp_to_nlp.hpp:83
static const std::string meta_doc
A documentation string.
Definition: qp_to_nlp.hpp:107
Helper class for Serialization.
The casadi namespace.
Definition: archiver.cpp:28
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
Options metadata for a class.
Definition: options.hpp:40
QpToNlpMemory()
Constructor.
Definition: qp_to_nlp.hpp:50
~QpToNlpMemory()
Destructor.
Definition: qp_to_nlp.hpp:53