Nonconvex constrained optimization
Loading...
Searching...
No Matches
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 15 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

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 16 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 17 of file lin-constr-converter.hpp.

◆ index_t

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

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

◆ storage_index_t

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

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

Member Function Documentation

◆ is_bound() [1/2]

template<Config Conf, class IndexT, class StorageIndexT>
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 lower == -inf and upper == +inf.

Definition at line 30 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>
bool is_bound ( const sets::Box< config_t > & C,
typename config_t::index_t i )
inlinestatic

Definition at line 35 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>
index_t count_bounds ( std::span< const real_t > lbx,
std::span< const real_t > ubx )
inlinestatic

Definition at line 41 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>
index_t count_bounds ( const sets::Box< config_t > & C)
inlinestatic

Definition at line 51 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>
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 55 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>
void add_box_constr_to_constr_matrix ( mat< config_t > & A,
const sets::Box< config_t > & C )
inlinestatic

Definition at line 69 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>
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 76 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>
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 94 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>
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 100 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>
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 122 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 \( \begin{pmatrix} I \\\hline A \end{pmatrix} \).

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

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

Here is the call graph for this function:

◆ add_box_constr_to_constr_matrix() [4/4]

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

Definition at line 140 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 244 of file lin-constr-converter.hpp.

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

◆ combine_bound_constr() [2/3]

template<Config Conf, class IndexT, class StorageIndexT>
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 156 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>
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 165 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: