Skip to content
Snippets Groups Projects
Commit 417b28a8 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Update Partial Reduction Verifier for more precise finding of combinations

parent 9974b658
No related branches found
No related tags found
No related merge requests found
......@@ -57,16 +57,14 @@ public class PartialReductionVerifier extends AbstractVerifier {
boolean hasCombination,
VDmnRule subsumptionRule) {
if (i == inColumns.size()) {
if (hasCombination) {
createCombinedRule(inColumns, clusterRules);
clusterRules.forEach(
rule -> vreFactory.addElement(VerificationResultEntryElement.create(rule)));
vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(
VerificationClassification.INFO,
templateDecision(inColumns.get(0).getVDmnDecision()) + "Rules %s can be combined.",
getRulesRowsStrings(clusterRules));
}
createCombinedRule(inColumns, clusterRules);
clusterRules.forEach(
rule -> vreFactory.addElement(VerificationResultEntryElement.create(rule)));
vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(
VerificationClassification.INFO,
templateDecision(inColumns.get(0).getVDmnDecision()) + "Rules %s can be combined.",
getRulesRowsStrings(clusterRules));
} else {
List<VDmnInputValue> rules =
VDmnFunctions.getColumnValuesInRules(inColumns.get(i), clusterRules);
......@@ -106,21 +104,7 @@ public class PartialReductionVerifier extends AbstractVerifier {
combinationCluster.add(true);
}
}
// 2. Find other combinations (only of no real combination
if (!found && !hasCombination) {
if (currentRuleValue
.getBoundary()
.createBi(COMBINE, currentRuleValueInner.getBoundary())
.isPresent()) {
found = true;
List<VDmnRule> cluster = new ArrayList<>();
cluster.add(currentRuleValue.getVDmnRule());
cluster.add(currentRuleValueInner.getVDmnRule());
nClusters.add(cluster);
combinationCluster.add(true);
}
}
// 2. Find equal
// Find identical
if (!found
&& currentRuleValue
.getBoundary()
......@@ -128,22 +112,32 @@ public class PartialReductionVerifier extends AbstractVerifier {
List<VDmnRule> cluster = new ArrayList<>();
cluster.add(currentRuleValue.getVDmnRule());
cluster.add(currentRuleValueInner.getVDmnRule());
nClusters.add(cluster);
combinationCluster.add(false);
}
nClusters.add(cluster);
} else // 2. Find other combinations (only of no real combination
if (!found
&& !hasCombination
&& currentRuleValue
.getBoundary()
.createBi(COMBINE, currentRuleValueInner.getBoundary())
.isPresent()) {
List<VDmnRule> cluster = new ArrayList<>();
cluster.add(currentRuleValue.getVDmnRule());
cluster.add(currentRuleValueInner.getVDmnRule());
combinationCluster.add(true);
nClusters.add(cluster);
}
}
}
}
// nex col
for (int x = 0; x < combinationCluster.size(); x++) {
if (nClusters.get(x).size() > 1) {
findPartialReduction(
inColumns,
i + 1,
nClusters.get(x),
combinationCluster.get(x) || hasCombination,
subsumptionRule);
}
findPartialReduction(
inColumns,
i + 1,
nClusters.get(x),
combinationCluster.get(x) || hasCombination,
subsumptionRule);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment