13template <Config Conf,
class IndexT,
class StorageIndexT>
16 using real_t =
typename config_t::real_t;
29 return std::span{
v.data(),
static_cast<size_t>(
v.size())};
35 std::span<const real_t>
ubx,
size_t i) {
40 typename config_t::index_t i) {
42 static_cast<size_t>(i));
46 std::span<const real_t>
ubx) {
60 std::span<const real_t>
lbx,
61 std::span<const real_t>
ubx) {
62 auto n = A.cols(), m = A.rows();
81 std::span<const real_t>
lbx,
82 std::span<const real_t>
ubx) {
86 std::ranges::reverse_copy(
88 std::reverse_iterator{A.data() + (col + 1) * A.rows()});
90 A.topRows(
shift).setZero();
106 std::span<const real_t>
lbx, std::span<const real_t>
ubx) {
114 std::ranges::reverse_copy(
116 std::reverse_iterator{A.data() + (col + 1) * A_new.rows()});
142 std::span<const real_t>
lbx,
143 std::span<const real_t>
ubx);
154 std::span<const real_t>
ubx,
155 std::span<const real_t>
lbg,
156 std::span<const real_t>
ubg,
159 std::span<const real_t>
g0);
163 typename config_t::crvec
g0) {
173 typename config_t::crvec
g0) {
180template <Config Conf,
class IndexT,
class StorageIndexT>
183 std::span<const real_t>
ubx) {
184 auto n =
static_cast<size_t>(A.
ncol);
219 for (
size_t col = n;
col-- > 0;) {
247template <Config Conf,
class IndexT,
class StorageIndexT>
249 std::span<const real_t>
lbx, std::span<const real_t>
ubx,
250 std::span<const real_t>
lbg, std::span<const real_t>
ubg,
252 std::span<const real_t>
g0) {
258 for (
size_t i = 0; i < n; ++i) {
259 if (is_bound(
lbx,
ubx, i)) {
266 std::ranges::transform(
lbg,
g0, &
new_lbg[c], std::minus{});
267 std::ranges::transform(
ubg,
g0, &
new_ubg[c], std::minus{});
std::span< storage_index_t > outer_ptr
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)
static void add_box_constr_to_constr_matrix(mat< config_t > &A, const sets::Box< config_t > &C)
typename config_t::real_t real_t
static index_t count_bounds(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_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, const sets::Box< config_t > &C)
static index_t count_bounds(std::span< const real_t > lbx, std::span< const real_t > ubx)
std::span< real_t > values
std::span< index_t > inner_idx
StorageIndexT storage_index_t
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 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(index_t n_row, rmat< config_t > 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),...
static bool is_bound(const sets::Box< config_t > &C, typename config_t::index_t i)
static constexpr auto to_span(V &&v)
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 add_box_constr_to_constr_matrix(mat< config_t > &A, std::span< const real_t > lbx, std::span< const real_t > ubx)