alpaqa_problem.hpp
1 #ifndef ALPAQA_PROBLEM_H
2 #define ALPAQA_PROBLEM_H
3 
4 #include <alpaqa/config/config.hpp>
5 #include <alpaqa/problem/box-constr-problem.hpp>
6 #include <alpaqa/util/copyable_unique_ptr.hpp>
7 
8 namespace casadi {
9 
10 // Forward declarations
11 class AlpaqaInterface;
12 struct AlpaqaMemory;
13 
14 class AlpaqaProblem : public alpaqa::BoxConstrProblem<alpaqa::DefaultConfig> {
15  public:
18 
19  //AlpaqaProblem(const AlpaqaProblem &);
20  //AlpaqaProblem &operator=(const AlpaqaProblem &);
21  //AlpaqaProblem(AlpaqaProblem &&) noexcept;
22  //AlpaqaProblem &operator=(AlpaqaProblem &&) noexcept;
23 
24  // clang-format off
25  [[nodiscard]] real_t eval_f(crvec x) const;
26  void eval_grad_f(crvec x, rvec grad_fx) const;
27  real_t eval_f_grad_f(crvec x, rvec grad_fx) const; // NOLINT(*nodiscard)
28  void eval_g(crvec x, rvec g) const;
29  void eval_grad_g_prod(crvec x, crvec y, rvec grad_gxy) const;
30  void eval_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const;
31  real_t eval_ψ_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const; // NOLINT(*nodiscard)
32  void eval_grad_L(crvec x, crvec y, rvec grad_L, rvec work_n) const;
33  [[nodiscard]] real_t eval_ψ(crvec x, crvec y, crvec Σ, rvec ŷ) const;
34  void eval_grad_gi(crvec x, index_t i, rvec grad_i) const;
35  [[nodiscard]] length_t get_jac_g_num_nonzeros() const;
36  void eval_jac_g(crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const;
37  void eval_hess_L_prod(crvec x, crvec y, real_t scale, crvec v, rvec Hv) const;
38  [[nodiscard]] length_t get_hess_L_num_nonzeros() const;
39  void eval_hess_L(crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const;
40  void eval_hess_ψ_prod(crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const;
41  [[nodiscard]] length_t get_hess_ψ_num_nonzeros() const;
42  void eval_hess_ψ(crvec x, crvec y, crvec Σ, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const;
43  // clang-format on
44 
46  [[nodiscard]] bool provides_eval_grad_gi() const { return false; }
48  [[nodiscard]] bool provides_eval_jac_g() const { return true; }
50  [[nodiscard]] bool provides_eval_hess_L_prod() const { return true; }
52  [[nodiscard]] bool provides_eval_hess_L() const { return true; }
54  [[nodiscard]] bool provides_eval_hess_ψ_prod() const { return true; }
56  [[nodiscard]] bool provides_eval_hess_ψ() const { return true; }
57 
58  private:
59  const AlpaqaInterface& solver_;
60  AlpaqaMemory* mem_;
61 };
62 
63 
64 
65 } // namespace casadi
66 
67 #endif /* ALPAQA_PROBLEM_H */
bool provides_eval_hess_ψ() const
void eval_hess_L_prod(crvec x, crvec y, real_t scale, crvec v, rvec Hv) const
void eval_hess_ψ_prod(crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const
real_t eval_f_grad_f(crvec x, rvec grad_fx) const
bool provides_eval_jac_g() const
length_t get_jac_g_num_nonzeros() const
real_t eval_ψ_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const
void eval_g(crvec x, rvec g) const
bool provides_eval_hess_ψ_prod() const
bool provides_eval_grad_gi() const
void eval_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const
void eval_jac_g(crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const
void eval_grad_g_prod(crvec x, crvec y, rvec grad_gxy) const
void eval_grad_gi(crvec x, index_t i, rvec grad_i) const
length_t get_hess_ψ_num_nonzeros() const
void eval_grad_L(crvec x, crvec y, rvec grad_L, rvec work_n) const
void eval_hess_L(crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const
bool provides_eval_hess_L() const
AlpaqaProblem(const AlpaqaInterface &solver, AlpaqaMemory *mem)
real_t eval_f(crvec x) const
void eval_grad_f(crvec x, rvec grad_fx) const
void eval_hess_ψ(crvec x, crvec y, crvec Σ, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const
length_t get_hess_L_num_nonzeros() const
bool provides_eval_hess_L_prod() const
real_t eval_ψ(crvec x, crvec y, crvec Σ, rvec ŷ) const
The casadi namespace.