alpaqa 1.0.0a8
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
CUTEstProblem Class Reference

#include <interop/cutest/include/alpaqa/cutest/cutest-loader.hpp>

Detailed Description

Wrapper for CUTEst problems loaded from an external shared library.

Warning
The lifetime of the wrapper should be at least as long as the lifetime of the CUTEstProblem::problem member. Do not make a copy of the problem that could outlive the wrapper.

Definition at line 20 of file cutest-loader.hpp.

+ Inheritance diagram for CUTEstProblem:
+ Collaboration diagram for CUTEstProblem:

Classes

struct  Report
 The report generated by CUTEst. More...
 
struct  Report.calls
 Function call counters. More...
 

Public Types

using Box = alpaqa::Box< config_t >
 

Public Member Functions

 CUTEstProblem (const char *so_fname, const char *outsdif_fname, bool sparse=false)
 Load a CUTEst problem from the given shared library and OUTSDIF.d file.
 
 CUTEstProblem (const CUTEstProblem &)
 
CUTEstProblemoperator= (const CUTEstProblem &)
 
 CUTEstProblem (CUTEstProblem &&) noexcept
 
CUTEstProblemoperator= (CUTEstProblem &&) noexcept
 
 ~CUTEstProblem ()
 
Report get_report () const
 
real_t eval_f (crvec x) const
 
void eval_grad_f (crvec x, rvec grad_fx) const
 
void eval_g (crvec x, rvec gx) const
 
void eval_grad_g_prod (crvec x, crvec y, rvec grad_gxy) const
 
void eval_jac_g (crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const
 
length_t get_jac_g_num_nonzeros () const
 
void eval_grad_gi (crvec x, index_t i, rvec grad_gi) const
 
void eval_hess_L_prod (crvec x, crvec y, real_t scale, crvec v, rvec Hv) const
 
void eval_hess_L (crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const
 
length_t get_hess_L_num_nonzeros () const
 
real_t eval_f_grad_f (crvec x, rvec grad_fx) const
 
real_t eval_f_g (crvec x, rvec g) const
 
void eval_grad_L (crvec x, crvec y, rvec grad_L, rvec work_n) const
 
void resize (length_t n, length_t m)
 
length_t get_n () const
 Number of decision variables, n.
 
length_t get_m () const
 Number of constraints, m.
 
real_t eval_prox_grad_step (real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
 
void eval_proj_diff_g (crvec z, rvec p) const
 
void eval_proj_multipliers (rvec y, real_t M) const
 
const Boxget_box_C () const
 
const Boxget_box_D () const
 
index_t eval_inactive_indices_res_lna (real_t γ, crvec x, crvec grad_ψ, rindexvec J) const
 
void check () const
 

Static Public Member Functions

static real_t eval_proj_grad_step_box (const Box &C, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
 Projected gradient step for rectangular box C.
 
static void eval_prox_grad_step_box_l1_impl (const Box &C, const auto &λ, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
 Proximal gradient step for rectangular box C with ℓ₁-regularization.
 
static real_t eval_prox_grad_step_box_l1 (const Box &C, const auto &λ, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
 Proximal gradient step for rectangular box C with ℓ₁-regularization.
 
static real_t eval_prox_grad_step_box_l1_scal (const Box &C, real_t λ, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
 Proximal gradient step for rectangular box C with ℓ₁-regularization.
 
static void eval_proj_multipliers_box (const Box &D, rvec y, real_t M, index_t penalty_alm_split)
 

Public Attributes

std::string name = "<UNKNOWN>"
 Problem name.
 
vec x0
 Initial value of decision variables.
 
vec y0
 Initial value of Lagrange multipliers.
 
length_t n
 Number of decision variables, dimension of x.
 
length_t m
 Number of constraints, dimension of g(x) and z.
 
index_t penalty_alm_split
 Components of the constraint function with indices below this number are handled using a quadratic penalty method rather than using an augmented Lagrangian method.
 
Box C
 Constraints of the decision variables, \( x \in C \).
 
Box D
 Other constraints, \( g(x) \in D \).
 
vec l1_reg
 \( \ell_1 \) (1-norm) regularization parameter.
 

Private Attributes

util::copyable_unique_ptr< class CUTEstLoaderimpl
 
bool sparse = false
 
int nnz_H = -1
 
int nnz_J = -1
 
Eigen::VectorX< int > H_row
 
Eigen::VectorX< int > H_col
 
Eigen::VectorX< int > J_row
 
Eigen::VectorX< int > J_col
 
vec H_work
 
vec J_work
 
indexvec H_perm
 
indexvec J_perm
 

Class Documentation

◆ alpaqa::CUTEstProblem::Report.calls

struct alpaqa::CUTEstProblem::Report.calls
+ Collaboration diagram for CUTEstProblem::Report.calls:
Class Members
unsigned objective Number of calls to the objective function.
unsigned objective_grad Number of calls to the objective gradient.
unsigned objective_hess Number of calls to the objective Hessian.
unsigned hessian_times_vector Number of Hessian times vector products.
unsigned constraints Number of calls to the constraint functions.
unsigned constraints_grad Number of calls to the constraint gradients.
unsigned constraints_hess Number of calls to the constraint Hessians.

Member Typedef Documentation

◆ Box

using Box = alpaqa::Box<config_t>
inherited

Definition at line 16 of file box-constr-problem.hpp.

Constructor & Destructor Documentation

◆ CUTEstProblem() [1/3]

CUTEstProblem ( const char *  so_fname,
const char *  outsdif_fname,
bool  sparse = false 
)

Load a CUTEst problem from the given shared library and OUTSDIF.d file.

Definition at line 251 of file cutest-loader.cpp.

◆ CUTEstProblem() [2/3]

CUTEstProblem ( const CUTEstProblem )
default

◆ CUTEstProblem() [3/3]

CUTEstProblem ( CUTEstProblem &&  )
defaultnoexcept

◆ ~CUTEstProblem()

~CUTEstProblem ( )
default

Member Function Documentation

◆ operator=() [1/2]

CUTEstProblem & operator= ( const CUTEstProblem )
default

◆ operator=() [2/2]

CUTEstProblem & operator= ( CUTEstProblem &&  )
defaultnoexcept

◆ get_report()

CUTEstProblem::Report get_report ( ) const

Definition at line 269 of file cutest-loader.cpp.

◆ eval_f()

auto eval_f ( crvec  x) const

Definition at line 292 of file cutest-loader.cpp.

◆ eval_grad_f()

void eval_grad_f ( crvec  x,
rvec  grad_fx 
) const

Definition at line 301 of file cutest-loader.cpp.

◆ eval_g()

void eval_g ( crvec  x,
rvec  gx 
) const

Definition at line 310 of file cutest-loader.cpp.

◆ eval_grad_g_prod()

void eval_grad_g_prod ( crvec  x,
crvec  y,
rvec  grad_gxy 
) const

Definition at line 320 of file cutest-loader.cpp.

◆ eval_jac_g()

void eval_jac_g ( crvec  x,
rindexvec  inner_idx,
rindexvec  outer_ptr,
rvec  J_values 
) const

Definition at line 333 of file cutest-loader.cpp.

◆ get_jac_g_num_nonzeros()

auto get_jac_g_num_nonzeros ( ) const

Definition at line 387 of file cutest-loader.cpp.

◆ eval_grad_gi()

void eval_grad_gi ( crvec  x,
index_t  i,
rvec  grad_gi 
) const

Definition at line 403 of file cutest-loader.cpp.

◆ eval_hess_L_prod()

void eval_hess_L_prod ( crvec  x,
crvec  y,
real_t  scale,
crvec  v,
rvec  Hv 
) const

Definition at line 411 of file cutest-loader.cpp.

◆ eval_hess_L()

void eval_hess_L ( crvec  x,
crvec  y,
real_t  scale,
rindexvec  inner_idx,
rindexvec  outer_ptr,
rvec  H_values 
) const

Definition at line 430 of file cutest-loader.cpp.

◆ get_hess_L_num_nonzeros()

auto get_hess_L_num_nonzeros ( ) const

Definition at line 489 of file cutest-loader.cpp.

◆ eval_f_grad_f()

auto eval_f_grad_f ( crvec  x,
rvec  grad_fx 
) const

Definition at line 504 of file cutest-loader.cpp.

◆ eval_f_g()

auto eval_f_g ( crvec  x,
rvec  g 
) const

Definition at line 514 of file cutest-loader.cpp.

◆ eval_grad_L()

void eval_grad_L ( crvec  x,
crvec  y,
rvec  grad_L,
rvec  work_n 
) const

Definition at line 523 of file cutest-loader.cpp.

◆ resize()

void resize ( length_t  n,
length_t  m 
)
inlineinherited

Definition at line 37 of file box-constr-problem.hpp.

◆ get_n()

length_t get_n ( ) const
inlineinherited

Number of decision variables, n.

Definition at line 60 of file box-constr-problem.hpp.

◆ get_m()

length_t get_m ( ) const
inlineinherited

Number of constraints, m.

Definition at line 62 of file box-constr-problem.hpp.

◆ eval_proj_grad_step_box()

static real_t eval_proj_grad_step_box ( const Box C,
real_t  γ,
crvec  x,
crvec  grad_ψ,
rvec  ,
rvec  p 
)
inlinestaticinherited

Projected gradient step for rectangular box C.

\[ \begin{aligned} \hat x &= \Pi_C(x - \gamma\nabla\psi(x)) \\ p &= \hat x - x \\ &= \max(\underline x - x, \;\min(-\gamma\nabla\psi(x), \overline x - x) \end{aligned} \]

Definition at line 69 of file box-constr-problem.hpp.

◆ eval_prox_grad_step_box_l1_impl()

static void eval_prox_grad_step_box_l1_impl ( const Box C,
const auto &  λ,
real_t  γ,
crvec  x,
crvec  grad_ψ,
rvec  ,
rvec  p 
)
inlinestaticinherited

Proximal gradient step for rectangular box C with ℓ₁-regularization.

\[ \begin{aligned} h(x) &= \|x\|_1 + \delta_C(x) \\ \hat x &= \prox_{\gamma h}(x - \gamma\nabla\psi(x)) \\ &= -\max\big( x - \overline x, \;\min\big( x - \underline x, \;\min\big( \gamma(\nabla\psi(x) + \lambda), \;\max\big( \gamma(\nabla\psi(x) - \lambda), x \big) \big) \big) \big) \end{aligned} \]

Definition at line 92 of file box-constr-problem.hpp.

◆ eval_prox_grad_step_box_l1()

static real_t eval_prox_grad_step_box_l1 ( const Box C,
const auto &  λ,
real_t  γ,
crvec  x,
crvec  grad_ψ,
rvec  ,
rvec  p 
)
inlinestaticinherited

Proximal gradient step for rectangular box C with ℓ₁-regularization.

\[ \begin{aligned} h(x) &= \|x\|_1 + \delta_C(x) \\ \hat x &= \prox_{\gamma h}(x - \gamma\nabla\psi(x)) \\ &= -\max\big( x - \overline x, \;\min\big( x - \underline x, \;\min\big( \gamma(\nabla\psi(x) + \lambda), \;\max\big( \gamma(\nabla\psi(x) - \lambda), x \big) \big) \big) \big) \end{aligned} \]

Definition at line 101 of file box-constr-problem.hpp.

◆ eval_prox_grad_step_box_l1_scal()

static real_t eval_prox_grad_step_box_l1_scal ( const Box C,
real_t  λ,
real_t  γ,
crvec  x,
crvec  grad_ψ,
rvec  ,
rvec  p 
)
inlinestaticinherited

Proximal gradient step for rectangular box C with ℓ₁-regularization.

\[ \begin{aligned} h(x) &= \|x\|_1 + \delta_C(x) \\ \hat x &= \prox_{\gamma h}(x - \gamma\nabla\psi(x)) \\ &= -\max\big( x - \overline x, \;\min\big( x - \underline x, \;\min\big( \gamma(\nabla\psi(x) + \lambda), \;\max\big( \gamma(\nabla\psi(x) - \lambda), x \big) \big) \big) \big) \end{aligned} \]

Definition at line 108 of file box-constr-problem.hpp.

◆ eval_prox_grad_step()

real_t eval_prox_grad_step ( real_t  γ,
crvec  x,
crvec  grad_ψ,
rvec  ,
rvec  p 
) const
inlineinherited

◆ eval_proj_diff_g()

void eval_proj_diff_g ( crvec  z,
rvec  p 
) const
inlineinherited
See also
TypeErasedProblem::eval_proj_diff_g

Definition at line 127 of file box-constr-problem.hpp.

◆ eval_proj_multipliers_box()

static void eval_proj_multipliers_box ( const Box D,
rvec  y,
real_t  M,
index_t  penalty_alm_split 
)
inlinestaticinherited

Definition at line 129 of file box-constr-problem.hpp.

◆ eval_proj_multipliers()

void eval_proj_multipliers ( rvec  y,
real_t  M 
) const
inlineinherited

◆ get_box_C()

const Box & get_box_C ( ) const
inlineinherited
See also
TypeErasedProblem::get_box_C

Definition at line 156 of file box-constr-problem.hpp.

◆ get_box_D()

const Box & get_box_D ( ) const
inlineinherited
See also
TypeErasedProblem::get_box_D

Definition at line 158 of file box-constr-problem.hpp.

◆ eval_inactive_indices_res_lna()

index_t eval_inactive_indices_res_lna ( real_t  γ,
crvec  x,
crvec  grad_ψ,
rindexvec  J 
) const
inlineinherited

◆ check()

void check ( ) const
inlineinherited
See also
TypeErasedProblem::check

Definition at line 198 of file box-constr-problem.hpp.

Member Data Documentation

◆ name

std::string name = "<UNKNOWN>"

Problem name.

Definition at line 88 of file cutest-loader.hpp.

◆ x0

vec x0

Initial value of decision variables.

Definition at line 89 of file cutest-loader.hpp.

◆ y0

vec y0

Initial value of Lagrange multipliers.

Definition at line 90 of file cutest-loader.hpp.

◆ impl

Definition at line 93 of file cutest-loader.hpp.

◆ sparse

bool sparse = false
private

Definition at line 94 of file cutest-loader.hpp.

◆ nnz_H

int nnz_H = -1
mutableprivate

Definition at line 95 of file cutest-loader.hpp.

◆ nnz_J

int nnz_J = -1
mutableprivate

Definition at line 96 of file cutest-loader.hpp.

◆ H_row

Eigen::VectorX<int> H_row
mutableprivate

Definition at line 97 of file cutest-loader.hpp.

◆ H_col

Eigen::VectorX<int> H_col
private

Definition at line 97 of file cutest-loader.hpp.

◆ J_row

Eigen::VectorX<int> J_row
private

Definition at line 97 of file cutest-loader.hpp.

◆ J_col

Eigen::VectorX<int> J_col
private

Definition at line 97 of file cutest-loader.hpp.

◆ H_work

vec H_work
mutableprivate

Definition at line 98 of file cutest-loader.hpp.

◆ J_work

vec J_work
private

Definition at line 98 of file cutest-loader.hpp.

◆ H_perm

indexvec H_perm
mutableprivate

Definition at line 99 of file cutest-loader.hpp.

◆ J_perm

indexvec J_perm
private

Definition at line 99 of file cutest-loader.hpp.

◆ n

length_t n
inherited

Number of decision variables, dimension of x.

Definition at line 19 of file box-constr-problem.hpp.

◆ m

length_t m
inherited

Number of constraints, dimension of g(x) and z.

Definition at line 21 of file box-constr-problem.hpp.

◆ penalty_alm_split

index_t penalty_alm_split
inherited

Components of the constraint function with indices below this number are handled using a quadratic penalty method rather than using an augmented Lagrangian method.

Specifically, the Lagrange multipliers for these components (which determine the shifts in ALM) are kept at zero.

Definition at line 27 of file box-constr-problem.hpp.

◆ C

Box C
inherited

Constraints of the decision variables, \( x \in C \).

Definition at line 50 of file box-constr-problem.hpp.

◆ D

Box D
inherited

Other constraints, \( g(x) \in D \).

Definition at line 52 of file box-constr-problem.hpp.

◆ l1_reg

vec l1_reg
inherited

\( \ell_1 \) (1-norm) regularization parameter.

Possible dimensions are: \( 0 \) (no regularization), \( 1 \) (a single scalar factor), or \( n \) (a different factor for each variable).

Definition at line 57 of file box-constr-problem.hpp.


The documentation for this class was generated from the following files: