alpaqa pi-pico
Nonconvex constrained optimization
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
Classes | Public Types | Static Public Member Functions | List of all members
LinConstrConverter< Conf, IndexT, StorageIndexT > Struct Template Reference

#include <alpaqa/util/lin-constr-converter.hpp>

Detailed Description

template<Config Conf, class IndexT, class StorageIndexT>
struct alpaqa::LinConstrConverter< Conf, IndexT, StorageIndexT >

Definition at line 14 of file lin-constr-converter.hpp.

+ Collaboration diagram for LinConstrConverter< Conf, IndexT, StorageIndexT >:

Classes

struct  SparseView
 

Public Types

using config_t = Conf
 
using real_t = typename config_t::real_t
 
using index_t = IndexT
 
using storage_index_t = StorageIndexT
 

Static Public Member Functions

template<class V >
static constexpr auto to_span (V &&v)
 
static bool is_bound (std::span< const real_t > lbx, std::span< const real_t > ubx, size_t i)
 Check if the variable with the given index has bound constraints, i.e.
 
static bool is_bound (const sets::Box< config_t > &C, typename config_t::index_t i)
 
static index_t count_bounds (std::span< const real_t > lbx, std::span< const real_t > ubx)
 
static index_t count_bounds (const sets::Box< config_t > &C)
 
static void add_box_constr_to_constr_matrix (mat< config_t > &A, std::span< const real_t > lbx, std::span< const real_t > ubx)
 
static void add_box_constr_to_constr_matrix (mat< config_t > &A, const sets::Box< config_t > &C)
 
static void add_box_constr_to_constr_matrix_inplace (index_t n_row, rmat< config_t > A, std::span< const real_t > lbx, std::span< const real_t > ubx)
 
static void add_box_constr_to_constr_matrix_inplace (index_t n_row, rmat< config_t > A, const sets::Box< config_t > &C)
 
static void add_box_constr_to_constr_matrix_inplace_vec (index_t n_row, index_t n_col, rvec< config_t > A, std::span< const real_t > lbx, std::span< const real_t > ubx)
 
static void add_box_constr_to_constr_matrix_inplace_vec (index_t n_row, index_t n_col, rvec< config_t > A, const sets::Box< config_t > &C)
 
static void add_box_constr_to_constr_matrix (SparseView &A, std::span< const real_t > lbx, std::span< const real_t > ubx)
 Update the constraint matrix A, such that for each constraint C(i) with finite bounds, a row is inserted into A with a one in the i-th column.
 
static void add_box_constr_to_constr_matrix (SparseView &A, const sets::Box< config_t > &C)
 
static void combine_bound_constr (std::span< const real_t > lbx, std::span< const real_t > ubx, std::span< const real_t > lbg, std::span< const real_t > ubg, std::span< real_t > new_lbg, std::span< real_t > new_ubg, std::span< const real_t > g0)
 For each constraint lbx(i)/ubx(i) with finite bounds, insert these bounds into new_lbg(i)/new_ubg(i), followed by all bounds lbg(i)/ubg(i), shifted by the constant vector -g₀.
 
static void combine_bound_constr (const sets::Box< config_t > &C, const sets::Box< config_t > &D, sets::Box< config_t > &new_D, typename config_t::crvec g0)
 
static void combine_bound_constr (const sets::Box< config_t > &C, const sets::Box< config_t > &D, std::span< real_t > new_lbg, std::span< real_t > new_ubg, typename config_t::crvec g0)
 

Class Documentation

◆ alpaqa::LinConstrConverter::SparseView

struct alpaqa::LinConstrConverter::SparseView
+ Collaboration diagram for LinConstrConverter< Conf, IndexT, StorageIndexT >::SparseView:
Class Members
index_t nrow
index_t ncol
span< index_t > inner_idx
span< storage_index_t > outer_ptr
span< real_t > values

Member Typedef Documentation

◆ config_t

template<Config Conf, class IndexT , class StorageIndexT >
using config_t = Conf

Definition at line 15 of file lin-constr-converter.hpp.

◆ real_t

template<Config Conf, class IndexT , class StorageIndexT >
using real_t = typename config_t::real_t

Definition at line 16 of file lin-constr-converter.hpp.

◆ index_t

template<Config Conf, class IndexT , class StorageIndexT >
using index_t = IndexT

Definition at line 17 of file lin-constr-converter.hpp.

◆ storage_index_t

Definition at line 18 of file lin-constr-converter.hpp.

Member Function Documentation

◆ to_span()

template<Config Conf, class IndexT , class StorageIndexT >
template<class V >
static constexpr auto to_span ( V &&  v)
inlinestaticconstexpr

Definition at line 28 of file lin-constr-converter.hpp.

+ Here is the caller graph for this function:

◆ is_bound() [1/2]

template<Config Conf, class IndexT , class StorageIndexT >
static bool is_bound ( std::span< const real_t lbx,
std::span< const real_t ubx,
size_t  i 
)
inlinestatic

Check if the variable with the given index has bound constraints, i.e.

if not lowerbound == -inf and upperbound == +inf.

Definition at line 34 of file lin-constr-converter.hpp.

+ Here is the caller graph for this function:

◆ is_bound() [2/2]

template<Config Conf, class IndexT , class StorageIndexT >
static bool is_bound ( const sets::Box< config_t > &  C,
typename config_t::index_t  i 
)
inlinestatic

Definition at line 39 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ count_bounds() [1/2]

template<Config Conf, class IndexT , class StorageIndexT >
static index_t count_bounds ( std::span< const real_t lbx,
std::span< const real_t ubx 
)
inlinestatic

Definition at line 45 of file lin-constr-converter.hpp.

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

◆ count_bounds() [2/2]

template<Config Conf, class IndexT , class StorageIndexT >
static index_t count_bounds ( const sets::Box< config_t > &  C)
inlinestatic

Definition at line 55 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ add_box_constr_to_constr_matrix() [1/4]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix ( mat< config_t > &  A,
std::span< const real_t lbx,
std::span< const real_t ubx 
)
inlinestatic

Definition at line 59 of file lin-constr-converter.hpp.

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

◆ add_box_constr_to_constr_matrix() [2/4]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix ( mat< config_t > &  A,
const sets::Box< config_t > &  C 
)
inlinestatic

Definition at line 73 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ add_box_constr_to_constr_matrix_inplace() [1/2]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix_inplace ( index_t  n_row,
rmat< config_t A,
std::span< const real_t lbx,
std::span< const real_t ubx 
)
inlinestatic

Definition at line 80 of file lin-constr-converter.hpp.

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

◆ add_box_constr_to_constr_matrix_inplace() [2/2]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix_inplace ( index_t  n_row,
rmat< config_t A,
const sets::Box< config_t > &  C 
)
inlinestatic

Definition at line 98 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ add_box_constr_to_constr_matrix_inplace_vec() [1/2]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix_inplace_vec ( index_t  n_row,
index_t  n_col,
rvec< config_t A,
std::span< const real_t lbx,
std::span< const real_t ubx 
)
inlinestatic

Definition at line 104 of file lin-constr-converter.hpp.

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

◆ add_box_constr_to_constr_matrix_inplace_vec() [2/2]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix_inplace_vec ( index_t  n_row,
index_t  n_col,
rvec< config_t A,
const sets::Box< config_t > &  C 
)
inlinestatic

Definition at line 126 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ add_box_constr_to_constr_matrix() [3/4]

template<Config Conf, class IndexT , class StorageIndexT >
void add_box_constr_to_constr_matrix ( SparseView A,
std::span< const real_t lbx,
std::span< const real_t ubx 
)
static

Update the constraint matrix A, such that for each constraint C(i) with finite bounds, a row is inserted into A with a one in the i-th column.

The newly added rows are added above the original rows of A. For example, if all constraints have finite bounds, the resulting matrix is (IA).

Precondition
Assumes that the user preallocated enough space for inserting these nonzero elements into A, and that A is compressed.

Definition at line 181 of file lin-constr-converter.hpp.

◆ add_box_constr_to_constr_matrix() [4/4]

template<Config Conf, class IndexT , class StorageIndexT >
static void add_box_constr_to_constr_matrix ( SparseView A,
const sets::Box< config_t > &  C 
)
inlinestatic

Definition at line 144 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ combine_bound_constr() [1/3]

template<Config Conf, class IndexT , class StorageIndexT >
void combine_bound_constr ( std::span< const real_t lbx,
std::span< const real_t ubx,
std::span< const real_t lbg,
std::span< const real_t ubg,
std::span< real_t new_lbg,
std::span< real_t new_ubg,
std::span< const real_t g0 
)
static

For each constraint lbx(i)/ubx(i) with finite bounds, insert these bounds into new_lbg(i)/new_ubg(i), followed by all bounds lbg(i)/ubg(i), shifted by the constant vector -g₀.

Definition at line 248 of file lin-constr-converter.hpp.

+ Here is the caller graph for this function:

◆ combine_bound_constr() [2/3]

template<Config Conf, class IndexT , class StorageIndexT >
static void combine_bound_constr ( const sets::Box< config_t > &  C,
const sets::Box< config_t > &  D,
sets::Box< config_t > &  new_D,
typename config_t::crvec  g0 
)
inlinestatic

Definition at line 160 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

◆ combine_bound_constr() [3/3]

template<Config Conf, class IndexT , class StorageIndexT >
static void combine_bound_constr ( const sets::Box< config_t > &  C,
const sets::Box< config_t > &  D,
std::span< real_t new_lbg,
std::span< real_t new_ubg,
typename config_t::crvec  g0 
)
inlinestatic

Definition at line 169 of file lin-constr-converter.hpp.

+ Here is the call graph for this function:

The documentation for this struct was generated from the following file: