alpaqa 1.1.0a1
Nonconvex constrained optimization
Loading...
Searching...
No Matches
CUTEstProblem Class Reference

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

Detailed Description

Wrapper for CUTEst problems loaded from an external shared library.

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  SparseStorage

Public Types

using Box

Public Member Functions

 CUTEstProblem (const char *so_fname, const char *outsdif_fname=nullptr, bool sparse=false, DynamicLoadFlags dl_flags={})
 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
std::ostream & format_report (std::ostream &os, const Report &r) const
std::ostream & format_report (std::ostream &os) const
real_t eval_objective (crvec x) const
void eval_objective_gradient (crvec x, rvec grad_fx) const
void eval_constraints (crvec x, rvec gx) const
void eval_constraints_gradient_product (crvec x, crvec y, rvec grad_gxy) const
void eval_constraints_jacobian (crvec x, rvec J_values) const
Sparsity get_constraints_jacobian_sparsity () const
void eval_grad_gi (crvec x, index_t i, rvec grad_gi) const
void eval_lagrangian_hessian_product (crvec x, crvec y, real_t scale, crvec v, rvec Hv) const
void eval_lagrangian_hessian (crvec x, crvec y, real_t scale, rvec H_values) const
Sparsity get_lagrangian_hessian_sparsity () const
void eval_augmented_lagrangian_hessian_product (crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const
real_t eval_objective_and_gradient (crvec x, rvec grad_fx) const
real_t eval_objective_and_constraints (crvec x, rvec g) const
void eval_lagrangian_gradient (crvec x, crvec y, rvec grad_L, rvec work_n) const
std::string get_name () const
void resize (length_t num_variables, length_t num_constraints)
 Change the dimensions of the problem (number of decision variables and number of constraints).
length_t get_num_variables () const
 Number of decision variables \( n \), num_variables.
length_t get_num_constraints () const
 Number of constraints \( m \), num_constraints.
real_t eval_proximal_gradient_step (real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
void eval_projecting_difference_constraints (crvec z, rvec p) const
void eval_projection_multipliers (rvec y, real_t M) const
const Boxget_variable_bounds () const
const Boxget_general_bounds () const
bool provides_get_variable_bounds () const
 Only supported if the ℓ₁-regularization term is zero.
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 num_variables
 Number of decision variables, dimension of x.
length_t num_constraints
 Number of constraints, dimension of g(x) and z.
Box variable_bounds
 Constraints of the decision variables, \( x \in C \).
Box general_bounds
 Other constraints, \( g(x) \in D \).
vec l1_reg
 \( \ell_1 \) (1-norm) regularization parameter.
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.

Private Attributes

guanaqo::copyable_unique_ptr< class CUTEstLoaderimpl
bool sparse = false
int nnz_H = -1
int nnz_J = -1
struct alpaqa::CUTEstProblem::SparseStorage storage_jac_g
struct alpaqa::CUTEstProblem::SparseStorage storage_hess_L

Class Documentation

◆ alpaqa::CUTEstProblem::Report

struct alpaqa::CUTEstProblem::Report
Collaboration diagram for CUTEstProblem::Report:
Class Members
Calls calls Function call counters.
double time_setup = 0 CPU time (in seconds) for CUTEST_csetup.
double time = 0 CPU time (in seconds) since the end of CUTEST_csetup.

◆ alpaqa::CUTEstProblem::SparseStorage

struct alpaqa::CUTEstProblem::SparseStorage
Collaboration diagram for CUTEstProblem::SparseStorage:
Class Members
VectorX< int > rows
VectorX< int > cols

Member Typedef Documentation

◆ Box

using Box
inherited

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

Constructor & Destructor Documentation

◆ CUTEstProblem() [1/3]

CUTEstProblem ( const char * so_fname,
const char * outsdif_fname = nullptr,
bool sparse = false,
DynamicLoadFlags dl_flags = {} )

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

If so_fname points to a directory, "PROBLEM.so" is appended automatically. If outsdif_fname is nullptr, the same directory as so_fname is used.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CUTEstProblem() [2/3]

CUTEstProblem ( const CUTEstProblem & )
default
Here is the call graph for this function:

◆ CUTEstProblem() [3/3]

CUTEstProblem ( CUTEstProblem && )
defaultnoexcept
Here is the call graph for this function:

◆ ~CUTEstProblem()

~CUTEstProblem ( )
default
Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

CUTEstProblem & operator= ( const CUTEstProblem & )
default
Here is the call graph for this function:

◆ operator=() [2/2]

CUTEstProblem & operator= ( CUTEstProblem && )
defaultnoexcept
Here is the call graph for this function:

◆ get_report()

auto get_report ( ) const
nodiscard

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format_report() [1/2]

std::ostream & format_report ( std::ostream & os,
const Report & r ) const

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

Here is the caller graph for this function:

◆ format_report() [2/2]

std::ostream & format_report ( std::ostream & os) const
inline

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

Here is the call graph for this function:

◆ eval_objective()

auto eval_objective ( crvec x) const
nodiscard

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

◆ eval_objective_gradient()

void eval_objective_gradient ( crvec x,
rvec grad_fx ) const

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

◆ eval_constraints()

void eval_constraints ( crvec x,
rvec gx ) const

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

Here is the caller graph for this function:

◆ eval_constraints_gradient_product()

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

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

◆ eval_constraints_jacobian()

void eval_constraints_jacobian ( crvec x,
rvec J_values ) const

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

◆ get_constraints_jacobian_sparsity()

auto get_constraints_jacobian_sparsity ( ) const
nodiscard

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

Here is the call graph for this function:

◆ eval_grad_gi()

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

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

◆ eval_lagrangian_hessian_product()

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

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

Here is the caller graph for this function:

◆ eval_lagrangian_hessian()

void eval_lagrangian_hessian ( crvec x,
crvec y,
real_t scale,
rvec H_values ) const

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

◆ get_lagrangian_hessian_sparsity()

auto get_lagrangian_hessian_sparsity ( ) const
nodiscard

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

Here is the call graph for this function:

◆ eval_augmented_lagrangian_hessian_product()

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

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

Here is the call graph for this function:

◆ eval_objective_and_gradient()

auto eval_objective_and_gradient ( crvec x,
rvec grad_fx ) const
nodiscard

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

◆ eval_objective_and_constraints()

auto eval_objective_and_constraints ( crvec x,
rvec g ) const
nodiscard

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

◆ eval_lagrangian_gradient()

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

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

◆ get_name()

std::string get_name ( ) const
inlinenodiscard

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

◆ resize()

void resize ( length_t num_variables,
length_t num_constraints )
inlineinherited

Change the dimensions of the problem (number of decision variables and number of constraints).

Destructive: resizes and/or resets the members variable_bounds, general_bounds, l1_reg and penalty_alm_split.

Parameters
num_variablesNumber of decision variables
num_constraintsNumber of constraints

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

◆ get_num_variables()

length_t get_num_variables ( ) const
inlineinherited

Number of decision variables \( n \), num_variables.

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

◆ get_num_constraints()

length_t get_num_constraints ( ) const
inlineinherited

Number of constraints \( m \), num_constraints.

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

◆ eval_proj_grad_step_box()

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 92 of file box-constr-problem.hpp.

◆ eval_prox_grad_step_box_l1_impl()

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 115 of file box-constr-problem.hpp.

◆ eval_prox_grad_step_box_l1()

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 124 of file box-constr-problem.hpp.

◆ eval_prox_grad_step_box_l1_scal()

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 132 of file box-constr-problem.hpp.

◆ eval_proximal_gradient_step()

real_t eval_proximal_gradient_step ( real_t γ,
crvec x,
crvec grad_ψ,
rvec ,
rvec p ) const
inlineinherited
See also
eval_proximal_gradient_step

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

◆ eval_projecting_difference_constraints()

void eval_projecting_difference_constraints ( crvec z,
rvec p ) const
inlineinherited
See also
eval_projecting_difference_constraints

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

Here is the caller graph for this function:

◆ eval_proj_multipliers_box()

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

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

◆ eval_projection_multipliers()

void eval_projection_multipliers ( rvec y,
real_t M ) const
inlineinherited
See also
eval_projection_multipliers

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

◆ get_variable_bounds()

const Box & get_variable_bounds ( ) const
inlineinherited
See also
get_variable_bounds

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

◆ get_general_bounds()

const Box & get_general_bounds ( ) const
inlineinherited
See also
get_general_bounds

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

◆ provides_get_variable_bounds()

bool provides_get_variable_bounds ( ) const
inlinenodiscardinherited

Only supported if the ℓ₁-regularization term is zero.

See also
provides_get_variable_bounds

Definition at line 184 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
See also
eval_inactive_indices_res_lna

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

◆ check()

void check ( ) const
inlineinherited
See also
check

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

Member Data Documentation

◆ name

std::string name = "<UNKNOWN>"

Problem name.

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

◆ x0

vec x0

Initial value of decision variables.

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

◆ y0

vec y0

Initial value of Lagrange multipliers.

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

◆ impl

guanaqo::copyable_unique_ptr<class CUTEstLoader> impl
private

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

◆ sparse

bool sparse = false
private

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

◆ nnz_H

int nnz_H = -1
mutableprivate

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

◆ nnz_J

int nnz_J = -1
mutableprivate

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

◆ storage_jac_g

struct alpaqa::CUTEstProblem::SparseStorage storage_jac_g
private

◆ storage_hess_L

struct alpaqa::CUTEstProblem::SparseStorage storage_hess_L
private

◆ num_variables

length_t num_variables
inherited

Number of decision variables, dimension of x.

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

◆ num_constraints

length_t num_constraints
inherited

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

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

◆ variable_bounds

Box variable_bounds
inherited

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

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

◆ general_bounds

Box general_bounds
inherited

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

Definition at line 69 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 74 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 80 of file box-constr-problem.hpp.


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