26 #ifndef CASADI_GUROBI_INTERFACE_HPP
27 #define CASADI_GUROBI_INTERFACE_HPP
29 #include "casadi/core/conic_impl.hpp"
30 #include <casadi/interfaces/gurobi/casadi_conic_gurobi_export.h>
49 struct GurobiMemory :
public ConicMemory {
56 std::vector<double> pool_obj_vals;
57 std::vector<std::vector<double>> pool_solutions;
60 std::vector<double> sos_weights;
61 std::vector<int> sos_beg;
62 std::vector<int> sos_ind;
63 std::vector<int> sos_types;
78 class GurobiInterface :
public Conic {
81 explicit GurobiInterface(
const std::string& name,
82 const std::map<std::string, Sparsity>& st);
85 static Conic* creator(
const std::string& name,
86 const std::map<std::string, Sparsity>& st) {
87 return new GurobiInterface(name, st);
91 ~GurobiInterface()
override;
94 const char* plugin_name()
const override {
return "gurobi";}
97 std::string class_name()
const override {
return "GurobiInterface";}
101 static const Options options_;
102 const Options& get_options()
const override {
return options_;}
106 void init(
const Dict& opts)
override;
109 void* alloc_mem()
const override {
return new GurobiMemory();}
112 int init_mem(
void* mem)
const override;
115 void free_mem(
void *mem)
const override {
delete static_cast<GurobiMemory*
>(mem);}
118 int solve(
const double** arg,
double** res,
119 casadi_int* iw,
double* w,
void* mem)
const override;
122 bool integer_support()
const override {
return true;}
125 bool psd_support()
const override {
return true;}
128 static const std::string meta_doc;
131 Dict get_stats(
void* mem)
const override;
134 std::vector<char> vtype_;
137 std::vector<double> sos_weights_;
138 std::vector<int> sos_beg_;
139 std::vector<int> sos_ind_;
140 std::vector<int> sos_types_;
146 SDPToSOCPMem sdp_to_socp_mem_;
148 void serialize_body(SerializingStream &s)
const override;
151 static ProtoFunction* deserialize(DeserializingStream& s) {
return new GurobiInterface(s); }
155 explicit GurobiInterface(DeserializingStream& s);
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.