Skip to content

Commit

Permalink
Add do_collect_violations option
Browse files Browse the repository at this point in the history
Now it is possible to pass an option that tells the
algorithm whether to collect violations or not.
  • Loading branch information
xJoskiy committed Jan 20, 2025
1 parent 224b370 commit e41a1af
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/core/algorithms/dc/verifier/dc_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ void DCVerifier::RegisterOptions() {

RegisterOption(Option<std::string>(&dc_string_, kDenialConstraint, kDDenialConstraint, ""));
RegisterOption(config::kTableOpt(&input_table_));
RegisterOption(Option<bool>(&do_collect_violations_, kDoCollectViolations,
kDDoCollectViolations, false));
}

void DCVerifier::MakeExecuteOptsAvailable() {
MakeOptionsAvailable({config::names::kDenialConstraint});
MakeOptionsAvailable({config::names::kDoCollectViolations});
}

void DCVerifier::LoadDataInternal() {
Expand Down
1 change: 1 addition & 0 deletions src/core/algorithms/dc/verifier/dc_verifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DCVerifier final : public Algorithm {
std::unique_ptr<ColumnLayoutRelationData> relation_;
std::vector<model::TypedColumnData> data_;
config::InputTable input_table_;
bool do_collect_violations_;
std::string dc_string_;
size_t index_offset_;
bool result_;
Expand Down
1 change: 1 addition & 0 deletions src/core/config/descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,5 @@ constexpr auto kDColumnMatches = "column matches to examine";
constexpr auto kDMaxCardinality = "maximum number of MD matching classifiers";
auto const kDLevelDefinition = details::kDLevelDefinitionString.c_str();
constexpr auto kDDenialConstraint = "String representation of a Denial Constraint";
constexpr auto kDDoCollectViolations = "Flag which tells whether to collect violations or not";
} // namespace config::descriptions
1 change: 1 addition & 0 deletions src/core/config/names.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ constexpr auto kColumnMatches = "column_matches";
constexpr auto kMaxCardinality = "max_cardinality";
constexpr auto kLevelDefinition = "level_definition";
constexpr auto kDenialConstraint = "denial_constraint";
constexpr auto kDoCollectViolations = "do_collect_violations";
} // namespace config::names
2 changes: 1 addition & 1 deletion src/tests/test_dc_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace mo = model;

static algos::StdParamsMap GetParamMap(CSVConfig const& csv_config, std::string dc) {
using namespace config::names;
return {{kCsvConfig, csv_config}, {kDenialConstraint, dc}};
return {{kCsvConfig, csv_config}, {kDenialConstraint, dc}, {kDoCollectViolations, true}};
}

struct DCTestParams {
Expand Down

0 comments on commit e41a1af

Please sign in to comment.