From d74212d0ff7dcc9363a67d00a5bebbd41b85df9f Mon Sep 17 00:00:00 2001 From: Guillaume PIERRE Date: Tue, 9 Jul 2024 11:59:00 +0200 Subject: [PATCH] Make infeasibility more changeable : simplifying constraint classes --- .../watched-constraints.h | 2 -- src/solver/infeasible-problem-analysis/report.cpp | 4 ++-- .../watched-constraints.cpp | 12 ------------ 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/solver/infeasible-problem-analysis/include/antares/solver/infeasible-problem-analysis/watched-constraints.h b/src/solver/infeasible-problem-analysis/include/antares/solver/infeasible-problem-analysis/watched-constraints.h index 858b811467..671299acec 100644 --- a/src/solver/infeasible-problem-analysis/include/antares/solver/infeasible-problem-analysis/watched-constraints.h +++ b/src/solver/infeasible-problem-analysis/include/antares/solver/infeasible-problem-analysis/watched-constraints.h @@ -14,7 +14,6 @@ class WatchedConstraint { public: WatchedConstraint(std::string constraintName); - std::string regexId() const; virtual std::string infeasibility() = 0; virtual std::string infeasibilityCause() = 0; @@ -23,7 +22,6 @@ class WatchedConstraint protected: std::string constraintName_; - std::string regexId_; std::vector splitName_; }; diff --git a/src/solver/infeasible-problem-analysis/report.cpp b/src/solver/infeasible-problem-analysis/report.cpp index 1a593ba41e..fe1a196f04 100644 --- a/src/solver/infeasible-problem-analysis/report.cpp +++ b/src/solver/infeasible-problem-analysis/report.cpp @@ -48,10 +48,10 @@ void InfeasibleProblemReport::filterConstraintsToOneByType() std::vector pickedTypes; for (const auto& c: constraints_) { - if (std::find(pickedTypes.begin(), pickedTypes.end(), c->regexId()) == pickedTypes.end()) + if (std::find(pickedTypes.begin(), pickedTypes.end(), typeid(c).name()) == pickedTypes.end()) { uniqueConstraintByType_.push_back(c); - pickedTypes.push_back(c->regexId()); + pickedTypes.push_back(typeid(c).name()); } } } diff --git a/src/solver/infeasible-problem-analysis/watched-constraints.cpp b/src/solver/infeasible-problem-analysis/watched-constraints.cpp index aca7c4eba8..eecd8bf8eb 100644 --- a/src/solver/infeasible-problem-analysis/watched-constraints.cpp +++ b/src/solver/infeasible-problem-analysis/watched-constraints.cpp @@ -66,11 +66,6 @@ WatchedConstraint::WatchedConstraint(std::string name): boost::algorithm::split_regex(splitName_, constraintName_, boost::regex("::")); } -std::string WatchedConstraint::regexId() const -{ - return regexId_; -} - const std::vector& WatchedConstraint::splitName() const { return splitName_; @@ -82,7 +77,6 @@ const std::vector& WatchedConstraint::splitName() const HourlyBC::HourlyBC(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "::hourly::"; } std::string HourlyBC::infeasibility() @@ -101,7 +95,6 @@ std::string HourlyBC::infeasibilityCause() DailyBC::DailyBC(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "::daily::"; } std::string DailyBC::infeasibility() @@ -120,7 +113,6 @@ std::string DailyBC::infeasibilityCause() WeeklyBC::WeeklyBC(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "::weekly::"; } std::string WeeklyBC::infeasibility() @@ -139,7 +131,6 @@ std::string WeeklyBC::infeasibilityCause() FictitiousLoad::FictitiousLoad(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "^FictiveLoads::"; } std::string FictitiousLoad::infeasibility() @@ -159,7 +150,6 @@ std::string FictitiousLoad::infeasibilityCause() HydroLevel::HydroLevel(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "^AreaHydroLevel::"; } std::string HydroLevel::infeasibility() @@ -180,7 +170,6 @@ std::string HydroLevel::infeasibilityCause() STS::STS(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "^Level::"; } std::string STS::infeasibility() @@ -201,7 +190,6 @@ std::string STS::infeasibilityCause() HydroProduction::HydroProduction(std::string constraintName): WatchedConstraint(constraintName) { - regexId_ = "^HydroPower::"; } std::string HydroProduction::infeasibility()