Skip to content

Commit

Permalink
Minor changes [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanaret committed Nov 11, 2024
1 parent 404b6e7 commit e32ed44
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions uno/linear_algebra/SymmetricMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ namespace uno {
~SymmetricMatrix() = default;

void reset() { this->sparse_storage->reset(); }
size_t dimension() const { return this->sparse_storage->dimension; }
[[nodiscard]] size_t dimension() const { return this->sparse_storage->dimension; }
void set_dimension(size_t new_dimension) { this->sparse_storage->set_dimension(new_dimension); }
size_t number_nonzeros() const { return this->sparse_storage->number_nonzeros; }
size_t capacity() const { return this->sparse_storage->capacity; }
[[nodiscard]] size_t number_nonzeros() const { return this->sparse_storage->number_nonzeros; }
[[nodiscard]] size_t capacity() const { return this->sparse_storage->capacity; }
template <typename Vector1, typename Vector2>
ElementType quadratic_product(const Vector1& x, const Vector2& y) const;

Expand Down
7 changes: 5 additions & 2 deletions uno/model/FixedBoundsConstraintsModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ namespace uno {

double FixedBoundsConstraintsModel::variable_upper_bound(size_t variable_index) const {
if (this->model->variable_lower_bound(variable_index) == this->model->variable_upper_bound(variable_index)) {
// remove bounds of fixed variables
// remove bounds of fixed variables
return INF<double>;
}
return this->model->variable_upper_bound(variable_index);
}

BoundType FixedBoundsConstraintsModel::get_variable_bound_type(size_t variable_index) const {
if (this->model->variable_lower_bound(variable_index) == this->model->variable_upper_bound(variable_index)) {
// fixed variable: remove the bounds
// fixed variable: remove the bounds
return BoundType::UNBOUNDED;
}
else {
Expand All @@ -111,12 +111,15 @@ namespace uno {
const SparseVector<size_t>& FixedBoundsConstraintsModel::get_slacks() const {
return this->model->get_slacks();
}

const Collection<size_t>& FixedBoundsConstraintsModel::get_single_lower_bounded_variables() const {
return this->model->get_single_lower_bounded_variables();
}

const Collection<size_t>& FixedBoundsConstraintsModel::get_single_upper_bounded_variables() const {
return this->model->get_single_upper_bounded_variables();
}

const Vector<size_t>& FixedBoundsConstraintsModel::get_fixed_variables() const {
return this->fixed_variables;
}
Expand Down
1 change: 0 additions & 1 deletion uno/preprocessing/Preprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "Preprocessing.hpp"
#include "optimization/Direction.hpp"
#include "linear_algebra/SymmetricMatrix.hpp"
#include "linear_algebra/CSCSparseStorage.hpp"
#include "linear_algebra/RectangularMatrix.hpp"
#include "model/Model.hpp"
#include "optimization/Iterate.hpp"
Expand Down
4 changes: 2 additions & 2 deletions uno/reformulation/l1RelaxedProblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ namespace uno {
// elastic variables
for (const auto [constraint_index, elastic_index]: this->elastic_variables.positive) {
lagrangian_gradient.constraints_contribution[elastic_index] += this->constraint_violation_coefficient +
multipliers.constraints[constraint_index] - multipliers.lower_bounds[elastic_index];
multipliers.constraints[constraint_index] - multipliers.lower_bounds[elastic_index];
}
for (const auto [constraint_index, elastic_index]: this->elastic_variables.negative) {
lagrangian_gradient.constraints_contribution[elastic_index] += this->constraint_violation_coefficient -
multipliers.constraints[constraint_index] - multipliers.lower_bounds[elastic_index];
multipliers.constraints[constraint_index] - multipliers.lower_bounds[elastic_index];
}

// proximal contribution
Expand Down

0 comments on commit e32ed44

Please sign in to comment.