Skip to content

Commit

Permalink
Make infeasibility more changeable : simplifying constraint classes
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Jul 9, 2024
1 parent 10491bc commit d74212d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -23,7 +22,6 @@ class WatchedConstraint

protected:
std::string constraintName_;
std::string regexId_;
std::vector<std::string> splitName_;
};

Expand Down
4 changes: 2 additions & 2 deletions src/solver/infeasible-problem-analysis/report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ void InfeasibleProblemReport::filterConstraintsToOneByType()
std::vector<std::string> 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());
}
}
}
Expand Down
12 changes: 0 additions & 12 deletions src/solver/infeasible-problem-analysis/watched-constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>& WatchedConstraint::splitName() const
{
return splitName_;
Expand All @@ -82,7 +77,6 @@ const std::vector<std::string>& WatchedConstraint::splitName() const
HourlyBC::HourlyBC(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "::hourly::";
}

std::string HourlyBC::infeasibility()
Expand All @@ -101,7 +95,6 @@ std::string HourlyBC::infeasibilityCause()
DailyBC::DailyBC(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "::daily::";
}

std::string DailyBC::infeasibility()
Expand All @@ -120,7 +113,6 @@ std::string DailyBC::infeasibilityCause()
WeeklyBC::WeeklyBC(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "::weekly::";
}

std::string WeeklyBC::infeasibility()
Expand All @@ -139,7 +131,6 @@ std::string WeeklyBC::infeasibilityCause()
FictitiousLoad::FictitiousLoad(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "^FictiveLoads::";
}

std::string FictitiousLoad::infeasibility()
Expand All @@ -159,7 +150,6 @@ std::string FictitiousLoad::infeasibilityCause()
HydroLevel::HydroLevel(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "^AreaHydroLevel::";
}

std::string HydroLevel::infeasibility()
Expand All @@ -180,7 +170,6 @@ std::string HydroLevel::infeasibilityCause()
STS::STS(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "^Level::";
}

std::string STS::infeasibility()
Expand All @@ -201,7 +190,6 @@ std::string STS::infeasibilityCause()
HydroProduction::HydroProduction(std::string constraintName):
WatchedConstraint(constraintName)
{
regexId_ = "^HydroPower::";
}

std::string HydroProduction::infeasibility()
Expand Down

0 comments on commit d74212d

Please sign in to comment.