From fcaffedf258288ab647e0f2b6cd73cbdb4976ed4 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zaher <32519851+a-zakir@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:31:15 +0200 Subject: [PATCH] [ant-1860] remove Criterion Tolerance (#867) --- data_test/external_loop_test/lp/options.json | 3 +-- data_test/external_loop_test/lp/outer_loop_options.yml | 2 -- src/cpp/benders/benders_core/OuterLoopBiLevel.cpp | 3 +-- src/cpp/benders/benders_core/OuterLoopInputDataReader.cpp | 7 ------- .../benders_core/include/OuterLoopInputDataReader.h | 3 --- tests/cpp/outer_loop/outer_loop_test.cpp | 3 --- 6 files changed, 2 insertions(+), 19 deletions(-) diff --git a/data_test/external_loop_test/lp/options.json b/data_test/external_loop_test/lp/options.json index 3d3c3828a..f69e8ac0f 100644 --- a/data_test/external_loop_test/lp/options.json +++ b/data_test/external_loop_test/lp/options.json @@ -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" } diff --git a/data_test/external_loop_test/lp/outer_loop_options.yml b/data_test/external_loop_test/lp/outer_loop_options.yml index 7fc3b58c1..9af7440cc 100644 --- a/data_test/external_loop_test/lp/outer_loop_options.yml +++ b/data_test/external_loop_test/lp/outer_loop_options.yml @@ -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 diff --git a/src/cpp/benders/benders_core/OuterLoopBiLevel.cpp b/src/cpp/benders/benders_core/OuterLoopBiLevel.cpp index a4f3175f8..4679339e5 100644 --- a/src/cpp/benders/benders_core/OuterLoopBiLevel.cpp +++ b/src/cpp/benders/benders_core/OuterLoopBiLevel.cpp @@ -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; } } diff --git a/src/cpp/benders/benders_core/OuterLoopInputDataReader.cpp b/src/cpp/benders/benders_core/OuterLoopInputDataReader.cpp index 574059dab..df9cdf889 100644 --- a/src/cpp/benders/benders_core/OuterLoopInputDataReader.cpp +++ b/src/cpp/benders/benders_core/OuterLoopInputDataReader.cpp @@ -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; @@ -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 @@ -176,7 +170,6 @@ struct convert { rhs.SetStoppingThreshold(node["stopping_threshold"].as(1e-4)); rhs.SetCriterionCountThreshold( node["criterion_count_threshold"].as(1)); - rhs.SetCriterionTolerance(node["criterion_tolerance"].as(1e-1)); if (auto patterns = node["patterns"]) { DecodePatterns(patterns, rhs); diff --git a/src/cpp/benders/benders_core/include/OuterLoopInputDataReader.h b/src/cpp/benders/benders_core/include/OuterLoopInputDataReader.h index 3a9d6df2f..e6c84c1bc 100644 --- a/src/cpp/benders/benders_core/include/OuterLoopInputDataReader.h +++ b/src/cpp/benders/benders_core/include/OuterLoopInputDataReader.h @@ -84,8 +84,6 @@ 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); @@ -93,7 +91,6 @@ class OuterLoopInputData { private: double outer_loop_stopping_threshold_ = 1e-4; std::vector outer_loop_data_; - double criterion_tolerance_ = 1e-1; double criterion_count_threshold_ = 1; }; diff --git a/tests/cpp/outer_loop/outer_loop_test.cpp b/tests/cpp/outer_loop/outer_loop_test.cpp index e75c4823f..e2aeee49a 100644 --- a/tests/cpp/outer_loop/outer_loop_test.cpp +++ b/tests/cpp/outer_loop/outer_loop_test.cpp @@ -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 @@ -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();