25 #ifndef CASADI_CONOPT_INTERFACE_HPP
26 #define CASADI_CONOPT_INTERFACE_HPP
28 #include "casadi/core/nlpsol_impl.hpp"
29 #include <casadi/interfaces/conopt/casadi_nlpsol_conopt_export.h>
37 class ConoptInterface;
100 std::atomic<bool> cache_valid{
false};
101 std::atomic<bool> cache_valid_jac{
false};
145 std::string
class_name()
const override {
return "ConoptInterface"; }
161 void set_work(
void* mem,
const double**& arg,
double**& res,
162 casadi_int*& iw,
double*& w)
const override;
163 int solve(
void* mem)
const override;
203 static int COI_CALLCONV
cb_read_matrix(
double LOWER[],
double CURR[],
double UPPER[],
204 int VSTA[],
int TYPEX[],
double RHS[],
205 int ESTA[],
int COLSTA[],
int ROWNO[],
206 double VALUE[],
int NLFLAG[],
int NUMVAR,
207 int NUMCON,
int NUMNZ,
void* USRMEM);
208 static int COI_CALLCONV
cb_fdevalini(
const double X[],
const int ROWLIST[],
int MODE,
209 int LISTSIZE,
int NUMTHREAD,
int IGNERR,
210 int* ERRCNT,
int NUMVAR,
void* USRMEM);
211 static int COI_CALLCONV
cb_fd_eval(
const double X[],
double* G,
double JAC[],
212 int ROWNO,
const int JACNUM[],
int MODE,
int IGNERR,
213 int* ERRCNT,
int NUMVAR,
int NUMJAC,
int THREAD,
215 static int COI_CALLCONV
cb_fdevalend(
int IGNERR,
int* ERRCNT,
void* USRMEM);
216 static int COI_CALLCONV
cb_status(
int MODSTA,
int SOLSTA,
int ITER,
double OBJVAL,
218 static int COI_CALLCONV
cb_solution(
const double XVAL[],
const double XMAR[],
219 const int XBAS[],
const int XSTA[],
220 const double YVAL[],
const double YMAR[],
221 const int YBAS[],
const int YSTA[],
222 int NUMVAR,
int NUMCON,
void* USRMEM);
225 static int COI_CALLCONV
cb_message(
int SMSG,
int DMSG,
int NMSG,
char* MSGV[],
227 static int COI_CALLCONV
cb_errmsg(
int ROWNO,
int COLNO,
int POSNO,
const char* MSG,
231 static int COI_CALLCONV
cb_option(
int NCALL,
double* RVAL,
int* IVAL,
int* LVAL,
232 char* NAME,
void* USRMEM);
233 static int COI_CALLCONV
cb_progress(
int LEN_INT,
const int INTX[],
int LEN_RL,
234 const double RL[],
const double X[],
void* USRMEM);
237 static int COI_CALLCONV
cb_2dlagrstr(
int HSRW[],
int HSCL[],
int* NODRV,
int NUMVAR,
238 int NUMCON,
int NHESS,
void* USRMEM);
239 static int COI_CALLCONV
cb_2dlagrval(
const double X[],
const double U[],
240 const int HSRW[],
const int HSCL[],
double HSVL[],
241 int* NODRV,
int NUMVAR,
int NUMCON,
int NHESS,
static int COI_CALLCONV cb_fd_eval(const double X[], double *G, double JAC[], int ROWNO, const int JACNUM[], int MODE, int IGNERR, int *ERRCNT, int NUMVAR, int NUMJAC, int THREAD, void *USRMEM)
std::vector< int > jacg_nlflag_
int init_mem(void *mem) const override
void * alloc_mem() const override
static int COI_CALLCONV cb_read_matrix(double LOWER[], double CURR[], double UPPER[], int VSTA[], int TYPEX[], double RHS[], int ESTA[], int COLSTA[], int ROWNO[], double VALUE[], int NLFLAG[], int NUMVAR, int NUMCON, int NUMNZ, void *USRMEM)
void ensure_row_capacity(ConoptMemory *m, casadi_int remaining_rows) const
const Options & get_options() const override
void serialize_body(SerializingStream &s) const override
static int COI_CALLCONV cb_progress(int LEN_INT, const int INTX[], int LEN_RL, const double RL[], const double X[], void *USRMEM)
static int COI_CALLCONV cb_2dlagrstr(int HSRW[], int HSCL[], int *NODRV, int NUMVAR, int NUMCON, int NHESS, void *USRMEM)
std::vector< bool > gradf_col_flag_
static int COI_CALLCONV cb_fdevalend(int IGNERR, int *ERRCNT, void *USRMEM)
std::vector< int > jacg_rowstart_
Dict get_stats(void *mem) const override
std::string class_name() const override
std::vector< casadi_int > gradf_col_to_nz_
static int COI_CALLCONV cb_option(int NCALL, double *RVAL, int *IVAL, int *LVAL, char *NAME, void *USRMEM)
static int COI_CALLCONV cb_fdevalini(const double X[], const int ROWLIST[], int MODE, int LISTSIZE, int NUMTHREAD, int IGNERR, int *ERRCNT, int NUMVAR, void *USRMEM)
ConoptInterface(const std::string &name, const Function &nlp)
std::vector< int > gradf_nlflag_
ConoptInterface(DeserializingStream &s)
static int COI_CALLCONV cb_status(int MODSTA, int SOLSTA, int ITER, double OBJVAL, void *USRMEM)
~ConoptInterface() override
static const Options options_
std::vector< int > jacg_nzidx_
int solve(void *mem) const override
void set_work(void *mem, const double **&arg, double **&res, casadi_int *&iw, double *&w) const override
static Nlpsol * creator(const std::string &name, const Function &nlp)
void free_mem(void *mem) const override
static const std::string meta_doc
A documentation string.
static ProtoFunction * deserialize(DeserializingStream &s)
void init(const Dict &opts) override
const char * plugin_name() const override
std::vector< int > jacg_col_
static int COI_CALLCONV cb_2dlagrval(const double X[], const double U[], const int HSRW[], const int HSCL[], double HSVL[], int *NODRV, int NUMVAR, int NUMCON, int NHESS, void *USRMEM)
static int COI_CALLCONV cb_solution(const double XVAL[], const double XMAR[], const int XBAS[], const int XSTA[], const double YVAL[], const double YMAR[], const int YBAS[], const int YSTA[], int NUMVAR, int NUMCON, void *USRMEM)
static int COI_CALLCONV cb_errmsg(int ROWNO, int COLNO, int POSNO, const char *MSG, void *USRMEM)
static int COI_CALLCONV cb_message(int SMSG, int DMSG, int NMSG, char *MSGV[], void *USRMEM)
Helper class for Serialization.
Helper class for Serialization.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
std::vector< int > casadi_to_conopt_lb_row
std::vector< double > cached_grad_f
std::string return_status
std::vector< int > casadi_to_conopt_ub_row
std::vector< std::pair< std::string, GenericType > > custom_options
std::vector< double > cached_g
std::vector< double > row_const_
std::vector< int > row_nnz
std::vector< double > hess_lam_g_
std::vector< double > const_jac_vals
std::vector< double > conopt_rhs
std::vector< double > gradf_const_vals
std::vector< ConoptRowType > conopt_type
std::vector< int > conopt_to_casadi
std::vector< double > cached_x
ConoptMemory(const ConoptInterface &interface)
ConoptSolverStatus solsta
std::vector< double > linear_at_x0
std::vector< double > cached_jac_g