25 #ifndef CASADI_HIGHS_INTERFACE_HPP
26 #define CASADI_HIGHS_INTERFACE_HPP
28 #include "casadi/core/conic_impl.hpp"
29 #include <casadi/interfaces/highs/casadi_conic_highs_export.h>
32 #include "interfaces/highs_c_api.h"
36 #include "highs_runtime.hpp"
55 struct HighsMemory :
public ConicMemory {
70 class HighsInterface :
public Conic {
73 static Conic* creator(
const std::string& name,
74 const std::map<std::string, Sparsity>& st) {
75 return new HighsInterface(name, st);
79 explicit HighsInterface(
const std::string& name,
80 const std::map<std::string, Sparsity>& st);
83 ~HighsInterface()
override;
86 const char* plugin_name()
const override {
return "highs";}
89 std::string class_name()
const override {
return "HighsInterface";}
93 static const Options options_;
94 const Options& get_options()
const override {
return options_;}
97 void set_highs_prob();
98 void set_highs_prob(CodeGenerator& g)
const;
101 void codegen_body(CodeGenerator& g)
const override;
104 void codegen_init_mem(CodeGenerator& g)
const override;
107 void codegen_free_mem(CodeGenerator& g)
const override;
110 std::string codegen_mem_type()
const override {
return "struct casadi_highs_data"; }
113 void init(
const Dict& opts)
override;
116 void init_dependent();
119 void* alloc_mem()
const override {
return new HighsMemory();}
122 int init_mem(
void* mem)
const override;
125 void free_mem(
void *mem)
const override;
128 void set_work(
void* mem,
const double**& arg,
double**& res,
129 casadi_int*& iw,
double*& w)
const override;
132 Dict get_stats(
void* mem)
const override;
135 int solve(
const double** arg,
double** res,
136 casadi_int* iw,
double* w,
void* mem)
const override;
139 static const std::string meta_doc;
144 void serialize_body(SerializingStream &s)
const override;
147 static ProtoFunction* deserialize(DeserializingStream& s) {
return new HighsInterface(s); }
150 bool integer_support()
const override {
return true; }
154 explicit HighsInterface(DeserializingStream& s);
161 std::vector<int> colinda_, rowa_;
162 std::vector<int> colindh_, rowh_;
163 std::vector<int> integrality_;
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.