25 #ifndef CASADI_CBC_INTERFACE_HPP
26 #define CASADI_CBC_INTERFACE_HPP
28 #include "casadi/core/conic_impl.hpp"
29 #include <casadi/interfaces/cbc/casadi_conic_cbc_export.h>
31 #include "OsiClpSolverInterface.hpp"
32 #include "CbcModel.hpp"
33 #include "CbcEventHandler.hpp"
49 struct CbcMemory :
public ConicMemory {
56 std::vector<int> colind, row;
59 int secondary_return_status;
61 casadi_int iter_count;
62 casadi_int node_count;
75 class CbcInterface :
public Conic {
78 static Conic* creator(
const std::string& name,
79 const std::map<std::string, Sparsity>& st) {
80 return new CbcInterface(name, st);
84 explicit CbcInterface(
const std::string& name,
85 const std::map<std::string, Sparsity>& st);
88 ~CbcInterface()
override;
91 const char* plugin_name()
const override {
return "cbc";}
94 std::string class_name()
const override {
return "CbcInterface";}
98 static const Options options_;
99 const Options& get_options()
const override {
return options_;}
103 void init(
const Dict& opts)
override;
106 void* alloc_mem()
const override {
return new CbcMemory();}
109 int init_mem(
void* mem)
const override;
112 void free_mem(
void *mem)
const override {
delete static_cast<CbcMemory*
>(mem);}
115 Dict get_stats(
void* mem)
const override;
118 int solve(
const double** arg,
double** res,
119 casadi_int* iw,
double* w,
void* mem)
const override;
122 static const std::string meta_doc;
127 void serialize_body(SerializingStream &s)
const override;
130 static ProtoFunction* deserialize(DeserializingStream& s) {
return new CbcInterface(s); }
133 bool integer_support()
const override {
return true;}
137 explicit CbcInterface(DeserializingStream& s);
141 static std::map<std::string, CbcModel::CbcIntParam> param_map_int;
142 static std::map<std::string, CbcModel::CbcDblParam> param_map_double;
143 static std::map<std::string, OsiIntParam> osi_param_map_int;
144 static std::map<std::string, OsiDblParam> osi_param_map_double;
146 void copy_cbc_results(
const CbcModel& model,
double** res)
const;
149 std::vector< std::vector<int> > sos_groups_;
150 std::vector< std::vector<double> > sos_weights_;
151 std::vector<casadi_int> sos_types_;
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.