|
19 | 19 | package org.tweetyproject.arg.dung.equivalence; |
20 | 20 |
|
21 | 21 | import org.tweetyproject.arg.dung.equivalence.kernel.EquivalenceKernel; |
| 22 | +import org.tweetyproject.arg.dung.reasoner.SimpleStableReasoner; |
22 | 23 | import org.tweetyproject.arg.dung.semantics.Extension; |
23 | 24 | import org.tweetyproject.arg.dung.semantics.Semantics; |
24 | 25 | import org.tweetyproject.arg.dung.syntax.Argument; |
@@ -109,10 +110,37 @@ public boolean isEquivalent(DungTheory theory1, DungTheory theory2) { |
109 | 110 | //} |
110 | 111 | if (!EquivalenceKernel.ADMISSIBLE.getKernel(theory1).equals(EquivalenceKernel.ADMISSIBLE.getKernel(theory2))) return false; |
111 | 112 | if (!theory1.faf(new Extension<>()).equals(theory2.faf(new Extension<>()))) return false; |
112 | | - Argument b = getBSaturated(theory1); |
113 | | - if (b == null) return false; |
114 | | - if (!b.equals(getBSaturated(theory2))) return false; |
| 113 | + //Argument b = getBSaturated(theory1); |
| 114 | + //if (b == null) return false; |
| 115 | + //if (!b.equals(getBSaturated(theory2))) return false; |
115 | 116 | return true; |
| 117 | + } case ST -> { |
| 118 | + if (EquivalenceKernel.STABLE.getKernel(theory1).equals(EquivalenceKernel.STABLE.getKernel(theory2))) { |
| 119 | + return true; |
| 120 | + } |
| 121 | + if (new SimpleStableReasoner().getModels(theory1).isEmpty() && new SimpleStableReasoner().getModels(theory2).isEmpty()) { |
| 122 | + Collection<Argument> arguments = new HashSet<>(theory1); |
| 123 | + arguments.addAll(theory2); |
| 124 | + for (Argument a : arguments) { |
| 125 | + if (theory1.contains(a) && theory2.contains(a)) continue; |
| 126 | + if (!theory1.isAttackedBy(a, a) || !theory2.isAttackedBy(a, a)) { |
| 127 | + boolean notB = false; |
| 128 | + for (Argument b : arguments) { |
| 129 | + if (b.equals(a)) continue; |
| 130 | + if (!theory1.isAttackedBy(b, a) || !theory2.isAttackedBy(b, a)) { |
| 131 | + if (theory1.isAttackedBy(b, b) && theory2.isAttackedBy(b, b)) { |
| 132 | + notB = true; |
| 133 | + break; |
| 134 | + } |
| 135 | + } |
| 136 | + } |
| 137 | + if (notB) { |
| 138 | + return true; |
| 139 | + } |
| 140 | + } |
| 141 | + } |
| 142 | + } |
| 143 | + return false; |
116 | 144 | } |
117 | 145 | default -> throw new IllegalArgumentException("Unsupported Semantics"); |
118 | 146 | } |
|
0 commit comments