26 #ifndef CASADI_QRSQP_HPP
27 #define CASADI_QRSQP_HPP
29 #include "casadi/core/nlpsol_impl.hpp"
30 #include <casadi/solvers/casadi_nlpsol_qrsqp_export.h>
44 struct QrsqpMemory :
public NlpsolMemory {
49 double *gLag, *gLag_old;
77 const char* return_status;
87 class Qrsqp :
public Nlpsol {
89 explicit Qrsqp(
const std::string& name,
const Function& nlp);
93 const char* plugin_name()
const override {
return "qrsqp";}
96 std::string class_name()
const override {
return "Qrsqp";}
99 static Nlpsol* creator(
const std::string& name,
const Function& nlp) {
100 return new Qrsqp(name, nlp);
105 static const Options options_;
106 const Options& get_options()
const override {
return options_;}
110 Dict get_stats(
void* mem)
const override;
113 void init(
const Dict& opts)
override;
116 void* alloc_mem()
const override {
return new QrsqpMemory();}
119 void free_mem(
void *mem)
const override {
delete static_cast<QrsqpMemory*
>(mem);}
122 void set_work(
void* mem,
const double**& arg,
double**& res,
123 casadi_int*& iw,
double*& w)
const override;
126 int solve(
void* mem)
const override;
135 casadi_int max_iter_, min_iter_;
138 casadi_int lbfgs_memory_;
141 double tol_pr_, tol_du_;
144 double min_step_size_;
150 casadi_int max_iter_ls_;
151 casadi_int merit_memsize_;
155 bool print_header_, print_iteration_;
167 const Function getConic()
const {
return qpsol_;}
170 void print_iteration()
const;
173 void print_iteration(casadi_int iter,
double obj,
double pr_inf,
double du_inf,
174 double dx_norm,
double rg, casadi_int ls_trials,
bool ls_success)
const;
177 virtual void solve_QP(QrsqpMemory* m,
const double* H,
const double* g,
178 const double* lbdz,
const double* ubdz,
179 const double* A,
double* x_opt,
double* dlam)
const;
182 static const std::string meta_doc;
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.