Skip to content

Commit de8fe36

Browse files
committed
updated documentation for explanation module
1 parent 31b644a commit de8fe36

17 files changed

Lines changed: 486 additions & 51 deletions

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/examples/SequenceExplanationExample.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
120
package org.tweetyproject.arg.explanations.examples;
221

322
import org.tweetyproject.arg.dung.syntax.Argument;
423
import org.tweetyproject.arg.dung.syntax.DungTheory;
524
import org.tweetyproject.arg.explanations.reasoner.acceptance.AbstractSequenceExplanationReasoner;
625
import org.tweetyproject.arg.explanations.reasoner.acceptance.DialecticalSequenceExplanationReasoner;
7-
import org.tweetyproject.arg.explanations.reasoner.acceptance.MinimalSequenceExplanationReasoner;
8-
import org.tweetyproject.arg.explanations.reasoner.acceptance.SequenceExplanationReasoner;
926
import org.tweetyproject.arg.explanations.semantics.Explanation;
1027

1128
import java.util.Collection;
1229

30+
/**
31+
* Example usage of sequence explanations
32+
*
33+
* @author Lars Bengel
34+
*/
1335
public class SequenceExplanationExample {
1436
public static void main(String[] args) {
1537
AbstractSequenceExplanationReasoner reasoner = new DialecticalSequenceExplanationReasoner();

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/examples/SufficientExplanationExample.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
120
package org.tweetyproject.arg.explanations.examples;
221

322
import org.tweetyproject.arg.dung.syntax.Argument;
423
import org.tweetyproject.arg.dung.syntax.DungTheory;
524
import org.tweetyproject.arg.explanations.reasoner.acceptance.SufficientExplanationReasoner;
625

26+
/**
27+
* Example usage of sufficient explanations
28+
*
29+
* @author Lars Bengel
30+
*/
731
public class SufficientExplanationExample {
832
public static void main(String[] args) {
933
DungTheory theory = new DungTheory();

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/principles/ExplanationPrinciple.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
120
package org.tweetyproject.arg.explanations.principles;
221

322
import org.tweetyproject.arg.dung.syntax.Argument;
@@ -8,6 +27,11 @@
827

928
import java.util.Collection;
1029

30+
/**
31+
* Abstract class for modeling principles/postulates for explanations in abstract argumentation
32+
*
33+
* @author Lars Bengel
34+
*/
1135
public abstract class ExplanationPrinciple implements Postulate<Argument> {
1236
@Override
1337
public boolean isApplicable(Collection<Argument> kb) {

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/reasoner/acceptance/AbstractAcceptanceExplanationReasoner.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
120
package org.tweetyproject.arg.explanations.reasoner.acceptance;
221

322
import org.tweetyproject.arg.dung.syntax.Argument;
@@ -6,10 +25,28 @@
625

726
import java.util.Collection;
827

28+
/**
29+
* Abstract class for all acceptance explanation reasoners
30+
* An acceptance explanation reasoner provides explanations for the acceptance of some argument within an argumentation framework
31+
*
32+
* @author Lars Bengel
33+
*/
934
public abstract class AbstractAcceptanceExplanationReasoner {
35+
/**
36+
* Computes some acceptance explanation for <code>argument</code>
37+
* @param theory some argumentation framework
38+
* @param argument some argument
39+
* @return some explanation for the acceptance of <code>argument</code> in <code>theory</code>
40+
*/
1041
public Explanation getExplanation(DungTheory theory, Argument argument) {
1142
return getExplanations(theory, argument).iterator().next();
1243
}
1344

45+
/**
46+
* Computes all acceptance explanations for <code>argument</code>
47+
* @param theory some argumentation framework
48+
* @param argument some argument
49+
* @return all explanations for the acceptance of <code>argument</code> in <code>theory</code>
50+
*/
1451
public abstract Collection<Explanation> getExplanations(DungTheory theory, Argument argument);
1552
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
package org.tweetyproject.arg.explanations.reasoner.acceptance;
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
219

3-
import org.tweetyproject.arg.explanations.semantics.Explanation;
20+
package org.tweetyproject.arg.explanations.reasoner.acceptance;
421

22+
/**
23+
* Abstract class for sequence-based explanation reasoners
24+
*
25+
* @author Lars Bengel
26+
*/
527
public abstract class AbstractSequenceExplanationReasoner extends AbstractAcceptanceExplanationReasoner {
628
}

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/reasoner/acceptance/DialecticalSequenceExplanationReasoner.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
120
package org.tweetyproject.arg.explanations.reasoner.acceptance;
221

322
import org.tweetyproject.arg.dung.serialisability.semantics.SerialisationSequence;
@@ -10,6 +29,15 @@
1029
import java.util.Collection;
1130
import java.util.HashSet;
1231

32+
/**
33+
* Reasoner for dialectical sequence explanations for the acceptance of arguments
34+
* A sequence (S_1, T_1, ... S_n, T_n) of sets is a dialectical sequence explanation for the acceptance of an argument 'a' iff
35+
* (S-1, ..., S_n) is a sequence explanation for 'a' and every T_i is the set of arguments defeated by S_i in the context of the explanation.
36+
*
37+
* @see "Lars Bengel, and Matthias Thimm. 'Sequence Explanations for Acceptance in Abstract Argumentation' Conference on Principles of Knowledge Representation and Reasoning (KR'25) (2025)."
38+
*
39+
* @author Lars Bengel
40+
*/
1341
public class DialecticalSequenceExplanationReasoner extends AbstractSequenceExplanationReasoner {
1442
@Override
1543
public Collection<Explanation> getExplanations(DungTheory theory, Argument argument) {
@@ -27,6 +55,15 @@ public Collection<Explanation> getExplanations(DungTheory theory, Argument argum
2755
return result;
2856
}
2957

58+
/**
59+
* Computes the set of arguments that are defeated within the sequence 'seq' for the argument 'a' by the set 's'
60+
* This set consists of all arguments that are relevant for 'a' and defeated by 's' but have not been defeated earlier in the sequence 'seq'
61+
* @param theory some argumentation framework
62+
* @param seq some serialisation sequence
63+
* @param a the argument to be explained
64+
* @param s the set of arguments
65+
* @return the set of arguments defeated by 's' given the sequence and argument
66+
*/
3067
private Collection<Argument> getDefeated(DungTheory theory, SerialisationSequence seq, Argument a, Collection<Argument> s) {
3168
Collection<Argument> relevantAttackers = new HashSet<>();
3269
relevantAttackers.addAll(theory.getAttackers(a));

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/reasoner/acceptance/MinimalSequenceExplanationReasoner.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
20+
121
package org.tweetyproject.arg.explanations.reasoner.acceptance;
222

323
import org.tweetyproject.arg.dung.syntax.Argument;
@@ -8,6 +28,15 @@
828
import java.util.Collection;
929
import java.util.HashSet;
1030

31+
/**
32+
* Reasoner for minimal sequence explanations for the acceptance of arguments
33+
* A sequence (S_1, ... S_n) of sets is a minimal sequence explanation for the acceptance of an argument 'a' iff
34+
* (S-1, ..., S_n) is a sequence explanation for 'a' and there exists no shorter sequence satisfying this.
35+
*
36+
* @see "Lars Bengel, and Matthias Thimm. 'Sequence Explanations for Acceptance in Abstract Argumentation' Conference on Principles of Knowledge Representation and Reasoning (KR'25) (2025)."
37+
*
38+
* @author Lars Bengel
39+
*/
1140
public class MinimalSequenceExplanationReasoner extends AbstractSequenceExplanationReasoner {
1241
@Override
1342
public Collection<Explanation> getExplanations(DungTheory theory, Argument argument) {

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/reasoner/acceptance/MinimalSufficientExplanationReasoner.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/reasoner/acceptance/NecessaryExplanationReasoner.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
20+
121
package org.tweetyproject.arg.explanations.reasoner.acceptance;
222

323
import org.tweetyproject.arg.dung.reasoner.SimpleAdmissibleReasoner;
@@ -9,6 +29,15 @@
929
import java.util.Collection;
1030
import java.util.HashSet;
1131

32+
/**
33+
* Reasoner for necessary explanations for the acceptance of an argument
34+
* a set S is a necessary explanation for the acceptance of an argument 'a'
35+
* iff every 'b' in S is contained in every admissible set containing 'a'
36+
*
37+
* @see "Borg, AnneMarie, and Floris Bex. 'Minimality, necessity and sufficiency for argumentation and explanation.' International Journal of Approximate Reasoning 168 (2024): 109143."
38+
*
39+
* @author Lars Bengel
40+
*/
1241
public class NecessaryExplanationReasoner extends AbstractAcceptanceExplanationReasoner {
1342
@Override
1443
public Collection<Explanation> getExplanations(DungTheory theory, Argument argument) {
@@ -18,7 +47,7 @@ public Collection<Explanation> getExplanations(DungTheory theory, Argument argum
1847
if (!arguments.contains(argument)) continue;
1948
intersection.retainAll(arguments);
2049
}
21-
result.add(new SetExplanation(intersection));
50+
result.add(new SetExplanation(argument, intersection));
2251
return result;
2352
}
2453
}

org-tweetyproject-arg-explanations/src/main/java/org/tweetyproject/arg/explanations/reasoner/acceptance/SequenceExplanationReasoner.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
/*
2+
* This file is part of "TweetyProject", a collection of Java libraries for
3+
* logical aspects of artificial intelligence and knowledge representation.
4+
*
5+
* TweetyProject is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License version 3 as
7+
* published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
18+
*/
19+
20+
121
package org.tweetyproject.arg.explanations.reasoner.acceptance;
222

3-
import org.tweetyproject.arg.dung.reasoner.SerialisedExtensionReasoner;
423
import org.tweetyproject.arg.dung.reasoner.SimpleInitialReasoner;
524
import org.tweetyproject.arg.dung.semantics.Extension;
6-
import org.tweetyproject.arg.dung.semantics.Semantics;
725
import org.tweetyproject.arg.dung.serialisability.semantics.SerialisationSequence;
826
import org.tweetyproject.arg.dung.serialisability.syntax.SelectionFunction;
927
import org.tweetyproject.arg.dung.syntax.Argument;
@@ -15,6 +33,15 @@
1533

1634
import static org.tweetyproject.arg.dung.reasoner.SimpleInitialReasoner.Initial.*;
1735

36+
/**
37+
* Reasoner for sequence explanations for the acceptance of arguments
38+
* A sequence (S_1, ... S_n) of sets is a sequence explanation for the acceptance of an argument 'a' iff
39+
* (S-1, ..., S_n) is a serialisation sequence and 'a' is contained in S_n.
40+
*
41+
* @see "Lars Bengel, and Matthias Thimm. 'Sequence Explanations for Acceptance in Abstract Argumentation' Conference on Principles of Knowledge Representation and Reasoning (KR'25) (2025)."
42+
*
43+
* @author Lars Bengel
44+
*/
1845
public class SequenceExplanationReasoner extends AbstractSequenceExplanationReasoner {
1946
@Override
2047
public Collection<Explanation> getExplanations(DungTheory theory, Argument argument) {

0 commit comments

Comments
 (0)