Skip to content

Commit

Permalink
add Model::reserver_vars and Model::reserve_ctrs
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Dec 13, 2023
1 parent e7cab62 commit 99d48d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/include/idol/modeling/models/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ class idol::Model : public Matrix {

[[nodiscard]] Model copy() const;

void reserve_vars(unsigned int t_size);

void reserve_ctrs(unsigned int t_size);

/**
* Returns the optimization environment of the model
*
Expand Down
8 changes: 8 additions & 0 deletions lib/src/modeling/models/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,11 @@ idol::Model idol::Model::fix(const idol::Solution::Primal &t_primals) const {

return result;
}

void idol::Model::reserve_vars(unsigned int t_size) {
m_variables.reserve(t_size);
}

void idol::Model::reserve_ctrs(unsigned int t_size) {
m_constraints.reserve(t_size);
}

0 comments on commit 99d48d0

Please sign in to comment.