Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 committed Dec 17, 2024
1 parent 018a795 commit 1de598b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cpp/benders/benders_core/CriterionInputDataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using namespace Benders::Criterion;
CriterionPattern::CriterionPattern(std::string prefix, std::string body)
: prefix_(std::move(prefix)), body_(std::move(body)) {}

std::string CriterionPattern::Pattern() const {
std::string CriterionPattern::Value() const {
return prefix_ + "area<" + body_ + ">";
}

Expand Down
8 changes: 4 additions & 4 deletions src/cpp/benders/benders_core/VariablesGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ void VariablesGroup::Search() {
indices_.assign(criterion_single_input_data_.size(), {});
int pattern_index(0);
for (const auto& single_input_data : criterion_single_input_data_) {
auto pattern = single_input_data.Pattern().GetPrefix() + "area<" + single_input_data.Pattern().GetBody() + ">";
auto pattern = single_input_data.Pattern().Value();
int var_index(0);
for (const auto& variable : all_variables_) {
if (variable.find(single_input_data.Pattern().GetPrefix()) != std::string::npos) {
if (variable.find(pattern) != std::string::npos) {
indices_[pattern_index].push_back(var_index);
}
var_index++;
++var_index;
}
++pattern_index;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CriterionPattern {
public:
explicit CriterionPattern(std::string prefix, std::string body);
CriterionPattern() = default;
[[nodiscard]] std::string Pattern() const;
[[nodiscard]] std::string Value() const;
[[nodiscard]] const std::string &GetPrefix() const;
void SetPrefix(const std::string &prefix);
[[nodiscard]] const std::string &GetBody() const;
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/outer_loop/outer_loop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TEST_F(OuterLoopPatternTest, RegexGivenPrefixAndBody) {
const std::string body = "body";
CriterionPattern o(prefix, body);

auto ret_regex = o.Pattern();
auto ret_regex = o.Value();

ASSERT_EQ((prefix + body).find(ret_regex) != std::string::npos, false);
ASSERT_EQ((prefix + "::" + body + "::suffix").find(ret_regex) != std::string::npos,
Expand Down

0 comments on commit 1de598b

Please sign in to comment.