26 #ifndef CASADI_OSQP_INTERFACE_HPP
27 #define CASADI_OSQP_INTERFACE_HPP
29 #include "casadi/core/conic_impl.hpp"
30 #include <casadi/interfaces/osqp/casadi_conic_osqp_export.h>
49 struct OsqpMemory :
public ConicMemory {
66 class OsqpInterface :
public Conic {
69 explicit OsqpInterface(
const std::string& name,
70 const std::map<std::string, Sparsity>& st);
73 static Conic* creator(
const std::string& name,
74 const std::map<std::string, Sparsity>& st) {
75 return new OsqpInterface(name, st);
79 ~OsqpInterface()
override;
82 const char* plugin_name()
const override {
return "osqp";}
85 std::string class_name()
const override {
return "OsqpInterface";}
89 static const Options options_;
90 const Options& get_options()
const override {
return options_;}
94 void init(
const Dict& opts)
override;
97 void* alloc_mem()
const override {
return new OsqpMemory();}
100 int init_mem(
void* mem)
const override;
103 void free_mem(
void *mem)
const override {
delete static_cast<OsqpMemory*
>(mem);}
106 int solve(
const double** arg,
double** res,
107 casadi_int* iw,
double* w,
void* mem)
const override;
110 bool integer_support()
const override {
return true;}
113 bool psd_support()
const override {
return true;}
116 static const std::string meta_doc;
119 Dict get_stats(
void* mem)
const override;
122 casadi_int nnzHupp_, nnzA_;
124 OSQPSettings settings_;
126 bool warm_start_primal_, warm_start_dual_;
129 void codegen_body(CodeGenerator& g)
const override;
132 void codegen_init_mem(CodeGenerator& g)
const override;
135 void codegen_free_mem(CodeGenerator& g)
const override;
138 std::string codegen_mem_type()
const override {
return "OSQPWorkspace*"; }
140 void serialize_body(SerializingStream &s)
const override;
143 static ProtoFunction* deserialize(DeserializingStream& s) {
return new OsqpInterface(s); }
147 explicit OsqpInterface(DeserializingStream& e);
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.