26 #ifndef CASADI_NLPSOL_IMPL_HPP
27 #define CASADI_NLPSOL_IMPL_HPP
30 #include "oracle_function.hpp"
31 #include "plugin_interface.hpp"
97 bool calc_lam_x_, calc_lam_p_,
calc_f_, calc_g_;
111 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
113 mutable std::mutex kkt_mtx_;
153 Sparsity get_sparsity_in(casadi_int i)
override;
154 Sparsity get_sparsity_out(casadi_int i)
override;
176 void disp_more(std::ostream& stream)
const override;
179 void init(
const Dict& opts)
override;
189 int init_mem(
void* mem)
const override;
199 virtual void check_inputs(
void* mem)
const;
212 void set_work(
void* mem,
const double**& arg,
double**& res,
213 casadi_int*& iw,
double*& w)
const override;
216 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w,
void* mem)
const final;
219 virtual int solve(
void* mem)
const = 0;
242 Dict get_stats(
void* mem)
const override;
249 Function get_forward(casadi_int nfwd,
const std::string& name,
250 const std::vector<std::string>& inames,
251 const std::vector<std::string>& onames,
252 const Dict& opts)
const override;
260 Function get_reverse(casadi_int nadj,
const std::string& name,
261 const std::vector<std::string>& inames,
262 const std::vector<std::string>& onames,
263 const Dict& opts)
const override;
273 static void bound_consistency(casadi_int n,
double* z,
double* lam,
274 const double* lbz,
const double* ubz);
285 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
286 static std::mutex mutex_solvers_;
303 bool is_a(
const std::string& type,
bool recursive)
const override;
306 virtual DM getReducedHessian();
309 virtual void setOptionsFromFile(
const std::string & file);
313 std::vector<Type> v = t;
319 template<
typename XType>
320 static Function create_oracle(
const std::map<std::string, XType>& d,
329 void set_nlpsol_prob();
Helper class for C code generation.
Helper class for Serialization.
Generic data type, can hold different types such as bool, casadi_int, std::string etc.
NLP solver storage class.
bool iteration_callback_ignore_errors_
Options.
WeakRef kkt_
Cache for KKT function.
size_t get_n_in() override
Number of function inputs and outputs.
static std::string shortname()
Short name.
std::string get_name_out(casadi_int i) override
Names of function input and outputs.
static const Options options_
Options.
std::string serialize_base_function() const override
String used to identify the immediate FunctionInternal subclass.
casadi_int ng_
Number of constraints.
bool uses_output() const override
Do the derivative functions need nondifferentiated outputs?
void * alloc_mem() const override
Create memory block.
bool eval_errors_fatal_
Options.
Function detect_simple_bounds_parts_
bool calc_multipliers_
Options.
std::vector< bool > equality_
Options.
bool warn_initial_bounds_
Options.
static const std::string infix_
Infix.
Dict sens_linsol_options_
static void append_to_vec(GenericType &t, Type el)
WORKAROUND: Add an element to an std::vector stored in a GenericType:
casadi_nlpsol_prob< double > p_nlp_
bool has_reverse(casadi_int nadj) const override
Generate a function that calculates reverse mode derivatives.
static std::map< std::string, Plugin > solvers_
Collection of solvers.
const Options & get_options() const override
Options.
std::string class_name() const override
Get type name.
std::vector< char > detect_simple_bounds_is_simple_
casadi_int np_
Number of parameters.
std::vector< casadi_int > detect_simple_bounds_target_g_
bool has_forward(casadi_int nfwd) const override
Generate a function that calculates forward mode derivatives.
std::string get_name_in(casadi_int i) override
Names of function input and outputs.
void free_mem(void *mem) const override
Free memory block.
casadi_int callback_step_
Execute the callback function only after this amount of iterations.
std::vector< casadi_int > detect_simple_bounds_target_x_
size_t get_n_out() override
Number of function inputs and outputs.
std::vector< bool > discrete_
Options.
casadi_int nx_
Number of variables.
virtual bool integer_support() const
Can discrete variables be treated.
bool bound_consistency_
Options.
bool no_nlp_grad_
Options.
std::string sens_linsol_
Linear solver and options.
virtual int solve(void *mem) const =0
Function fcallback_
callback function, executed at each iteration
double get_default_in(casadi_int ind) const override
Get default input value.
Base class for functions that perform calculation with an oracle.
Interface for accessing input and output data structures.
Base class for FunctionInternal and LinsolInternal.
Helper class for Serialization.
std::vector< std::string > nlpsol_in()
Get input scheme of NLP solvers.
std::vector< std::string > nlpsol_out()
Get NLP solver output scheme of NLP solvers.
double nlpsol_default_in(casadi_int ind)
Default input for an NLP solver.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
Type
Variable type (FMI 3)
UnifiedReturnStatus unified_return_status
casadi_nlpsol_data< double > d_nlp
Options metadata for a class.