Skip to content

Commit

Permalink
[ant-1860] remove Criterion Tolerance (#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir authored Jul 8, 2024
1 parent bc5360c commit fcaffed
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 19 deletions.
3 changes: 1 addition & 2 deletions data_test/external_loop_test/lp/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@
"LAST_MASTER_MPS": "master_last_iteration",
"LAST_MASTER_BASIS": "master_last_basis.bss",
"DO_OUTER_LOOP": true,
"OUTER_LOOP_OPTION_FILE": "data_test/external_loop_test/lp/outer_loop_options.yml",
"OUTER_LOOP_NUMBER_OF_SCENARIOS": 2
"OUTER_LOOP_OPTION_FILE": "data_test/external_loop_test/lp/outer_loop_options.yml"
}
2 changes: 0 additions & 2 deletions data_test/external_loop_test/lp/outer_loop_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
stopping_threshold: 1e-4
# seuil
criterion_count_threshold: 1e-1
# tolerance entre seuil et valeur calculée
criterion_tolerance: 1e-5
patterns:
- area: "N0"
criterion: 1
Expand Down
3 changes: 1 addition & 2 deletions src/cpp/benders/benders_core/OuterLoopBiLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ bool OuterLoopBiLevel::IsCriterionSatisfied(
const auto& outer_loop_input_data = outer_loop_input_data_.OuterLoopData();
for (int index(0); index < outer_loop_criterions.size(); ++index) {
if (outer_loop_criterions[index] >
outer_loop_input_data[index].Criterion() +
outer_loop_input_data_.CriterionTolerance()) {
outer_loop_input_data[index].Criterion()) {
return false;
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/cpp/benders/benders_core/OuterLoopInputDataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ void OuterLoopInputData::SetStoppingThreshold(
double OuterLoopInputData::StoppingThreshold() const {
return outer_loop_stopping_threshold_;
}
void OuterLoopInputData::SetCriterionTolerance(double criterion_tolerance) {
criterion_tolerance_ = criterion_tolerance;
}
double OuterLoopInputData::CriterionTolerance() const { return criterion_tolerance_; }
void OuterLoopInputData::SetCriterionCountThreshold(
double criterion_count_threshold) {
criterion_count_threshold_ = criterion_count_threshold;
Expand Down Expand Up @@ -103,8 +99,6 @@ OuterLoopInputData OuterLoopInputFromYaml::Read(
stopping_threshold: 1e-4
# seuil
criterion_count_threshold: 1e-1
# tolerance entre seuil et valeur calculée
criterion_tolerance: 1e-5
patterns:
- area: "N0"
criterion: 1
Expand Down Expand Up @@ -176,7 +170,6 @@ struct convert<OuterLoopInputData> {
rhs.SetStoppingThreshold(node["stopping_threshold"].as<double>(1e-4));
rhs.SetCriterionCountThreshold(
node["criterion_count_threshold"].as<double>(1));
rhs.SetCriterionTolerance(node["criterion_tolerance"].as<double>(1e-1));

if (auto patterns = node["patterns"]) {
DecodePatterns(patterns, rhs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,13 @@ class OuterLoopInputData {

void SetStoppingThreshold(double outer_loop_stopping_threshold);
[[nodiscard]] double StoppingThreshold() const;
void SetCriterionTolerance(double criterion_tolerance);
[[nodiscard]] double CriterionTolerance() const;
void SetCriterionCountThreshold(double criterion_count_threshold);
[[nodiscard]] double CriterionCountThreshold() const;
void AddSingleData(const OuterLoopSingleInputData &data);

private:
double outer_loop_stopping_threshold_ = 1e-4;
std::vector<OuterLoopSingleInputData> outer_loop_data_;
double criterion_tolerance_ = 1e-1;
double criterion_count_threshold_ = 1;
};

Expand Down
3 changes: 0 additions & 3 deletions tests/cpp/outer_loop/outer_loop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ TEST_F(OuterLoopInputFromYamlTest, ReadValidFile) {
auto my_yaml = R"(stopping_threshold: 1e-4
# seuil
criterion_count_threshold: 1e-1
# tolerance entre seuil et valeur calculée
criterion_tolerance: 1e-5
patterns:
- area: "N0"
criterion: 185
Expand All @@ -264,7 +262,6 @@ criterion_tolerance: 1e-5
auto data = OuterLoopInputFromYaml().Read(valid_file);

ASSERT_EQ(data.StoppingThreshold(), 1e-4);
ASSERT_EQ(data.CriterionTolerance(), 1e-5);
ASSERT_EQ(data.CriterionCountThreshold(), 1e-1);

auto patterns = data.OuterLoopData();
Expand Down

0 comments on commit fcaffed

Please sign in to comment.