40 LevelAbilities(
bool inequality,
const std::vector<requirements::ViolationEvaluationType> & types);
47 template<
class RequirementsPtr>
48 void check(
const ConstraintPtr & c,
const RequirementsPtr & req,
bool emitWarnings =
true)
const;
52 std::vector<requirements::ViolationEvaluationType> evaluationTypes_;
74 SchemeAbilities(
int numberOfLevels,
const std::map<int, LevelAbilities> & abilities,
bool scalarization =
false);
81 template<
class RequirementsPtr>
82 void check(
const ConstraintPtr & c,
const RequirementsPtr & req,
bool emitWarnings =
true)
const;
87 std::map<int, LevelAbilities> abilities_;
90 template<
class RequirementsPtr>
95 throw std::runtime_error(
"This level does not handle inequality constraints.");
98 auto it = std::find(evaluationTypes_.begin(), evaluationTypes_.end(), req->violationEvaluation().value());
99 if(it == evaluationTypes_.end())
100 throw std::runtime_error(
"This level does not handle the required violation evaluation value.");
103 template<
class RequirementsPtr>
107 int p = req->priorityLevel().value();
108 if(numberOfLevels_ > 0 && p >= numberOfLevels_)
114 std::cout <<
"Warning: required priority level (" << p
115 <<
") cannot be handled as a strict hierarchy level by the resolution scheme. "
116 <<
"Using scalarization to revert to weighted approach.";
122 s <<
"This resolution scheme can handle priorities level up to" << numberOfLevels_ - 1
123 <<
". It cannot process required level (" << p <<
")." << std::endl;
124 throw std::runtime_error(s.str());
129 auto it = abilities_.find(p);
130 if(it != abilities_.end())
131 it->second.check(c, req, emitWarnings);
133 abilities_.at(
GeneralLevel).check(c, req, emitWarnings);
#define TVM_DLLAPI
Definition: api.h:35
Definition: SchemeAbilities.h:33
LevelAbilities(bool inequality, const std::vector< requirements::ViolationEvaluationType > &types)
void check(const ConstraintPtr &c, const RequirementsPtr &req, bool emitWarnings=true) const
Definition: SchemeAbilities.h:91
Definition: SchemeAbilities.h:59
SchemeAbilities(int numberOfLevels, const std::map< int, LevelAbilities > &abilities, bool scalarization=false)
void check(const ConstraintPtr &c, const RequirementsPtr &req, bool emitWarnings=true) const
Definition: SchemeAbilities.h:104
constexpr int NoLimit
Definition: SchemeAbilities.h:27
constexpr int GeneralLevel
Definition: SchemeAbilities.h:25
std::shared_ptr< constraint::abstract::Constraint > ConstraintPtr
Definition: defs.h:56