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

Update Partial Reduction Verifier for more precise finding of combinations

parent 417b28a8
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ import de.unikoblenz.fgbks.core.dmn.verification.verifier.AbstractVerifier;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.DmnVerifier;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.classification.LogicModelingLevelVerification;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@DmnVerifier(
......@@ -68,75 +69,46 @@ public class PartialReductionVerifier extends AbstractVerifier {
} else {
List<VDmnInputValue> rules =
VDmnFunctions.getColumnValuesInRules(inColumns.get(i), clusterRules);
List<List<VDmnRule>> nClusters = new ArrayList<>();
List<Boolean> combinationCluster = new ArrayList<>();
for (int i1 = 0; i1 < rules.size(); i1++) {
VDmnInputValue currentRuleValue = rules.get(i1);
for (int i2 = i1 + 1; i2 < rules.size(); i2++) {
VDmnInputValue currentRuleValueInner = rules.get(i2);
if (currentRuleValue != currentRuleValueInner) {
boolean found = false;
// 1. Is subsumption?
if (currentRuleValue
.getBoundary()
.checkWith(SUBSUMES, currentRuleValueInner.getBoundary())) {
if (subsumptionRule == null || subsumptionRule == currentRuleValue.getVDmnRule()) {
subsumptionRule = currentRuleValue.getVDmnRule();
found = true;
List<VDmnRule> cluster = new ArrayList<>();
cluster.add(currentRuleValue.getVDmnRule());
cluster.add(currentRuleValueInner.getVDmnRule());
nClusters.add(cluster);
combinationCluster.add(true);
}
}
if (currentRuleValueInner
.getBoundary()
.checkWith(SUBSUMES, currentRuleValue.getBoundary())) {
if (subsumptionRule == null
|| subsumptionRule == currentRuleValueInner.getVDmnRule()) {
subsumptionRule = currentRuleValueInner.getVDmnRule();
found = true;
List<VDmnRule> cluster = new ArrayList<>();
cluster.add(currentRuleValue.getVDmnRule());
cluster.add(currentRuleValueInner.getVDmnRule());
nClusters.add(cluster);
combinationCluster.add(true);
}
}
// Find identical
if (!found
&& currentRuleValue
.getBoundary()
.checkWith(IS_EQUAL, currentRuleValueInner.getBoundary())) {
List<VDmnRule> cluster = new ArrayList<>();
cluster.add(currentRuleValue.getVDmnRule());
cluster.add(currentRuleValueInner.getVDmnRule());
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);
}
}
VDmnInputValue currentRuleValue = rules.get(0);
VDmnInputValue currentRuleValueNext = rules.get(1);
boolean found = false;
boolean comb = true;
// 1. Is subsumption?
if (currentRuleValue.getBoundary().checkWith(SUBSUMES, currentRuleValueNext.getBoundary())) {
if (subsumptionRule == null || subsumptionRule == currentRuleValue.getVDmnRule()) {
subsumptionRule = currentRuleValue.getVDmnRule();
found = true;
}
}
if (currentRuleValueNext.getBoundary().checkWith(SUBSUMES, currentRuleValue.getBoundary())) {
if (subsumptionRule == null || subsumptionRule == currentRuleValueNext.getVDmnRule()) {
subsumptionRule = currentRuleValueNext.getVDmnRule();
found = true;
}
}
// Find identical
if (!found
&& currentRuleValue
.getBoundary()
.checkWith(IS_EQUAL, currentRuleValueNext.getBoundary())) {
found = true;
comb = false;
} else // 2. Find other combinations (only of no real combination
if (!found
&& !hasCombination
&& currentRuleValue
.getBoundary()
.createBi(COMBINE, currentRuleValueNext.getBoundary())
.isPresent()) {
found = true;
}
// nex col
for (int x = 0; x < combinationCluster.size(); x++) {
if (found) {
findPartialReduction(
inColumns,
i + 1,
nClusters.get(x),
combinationCluster.get(x) || hasCombination,
Arrays.asList(currentRuleValue.getVDmnRule(), currentRuleValueNext.getVDmnRule()),
comb || hasCombination,
subsumptionRule);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment