Skip to content

Commit 62b3545

Browse files
author
“jklein94”
committed
Added missing javadocs
1 parent ea5defb commit 62b3545

8 files changed

Lines changed: 204 additions & 51 deletions

File tree

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bin/
3131
.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log
3232
.metadata/version.ini
3333
*.resources
34-
constructor.json
35-
skipped_files.txt
36-
warnings.json
34+
testBuild
3735

38-
*.txt
36+
37+
gurobi-9.1.0.jar
38+
isula-1.1.1.jar

org-tweetyproject-arg-dung/src/main/java/org/tweetyproject/arg/dung/examples/PrincipleExample.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@
3131
import java.util.HashSet;
3232

3333
/**
34-
* Example code for checking (non-)satisfaction of {@link Principle} for argumentation semantics
34+
* Example code for checking (non-)satisfaction of {@link Principle} for
35+
* argumentation semantics
3536
*
3637
* @author Lars Bengel
3738
*/
3839
public class PrincipleExample {
3940
/**
4041
* Execute the example
42+
*
4143
* @param args cmdline arguments
4244
*/
4345
public static void main(String[] args) {
@@ -67,9 +69,29 @@ public static void main(String[] args) {
6769
evaluateReasoner(new SimpleAdmissibleReasoner(), all_principles);
6870
}
6971

72+
/**
73+
* Evaluates a given abstract extension reasoner against a collection of
74+
* principles (postulates).
75+
* <p>
76+
* This method uses a {@link DungTheoryGenerator} to generate Dung argumentation
77+
* frameworks
78+
* and evaluates how well the provided {@link AbstractExtensionReasoner}
79+
* satisfies the given principles.
80+
* The evaluation is conducted using a {@link PostulateEvaluator}, which applies
81+
* the principles to
82+
* generated frameworks and assesses the reasoner's performance.
83+
* </p>
84+
*
85+
* @param reasoner The {@link AbstractExtensionReasoner} to be evaluated. This
86+
* reasoner
87+
* provides extensions for argumentation frameworks.
88+
* @param principles A collection of {@link Principle} objects representing the
89+
* postulates
90+
* against which the reasoner will be evaluated.
91+
*/
7092
public static void evaluateReasoner(AbstractExtensionReasoner reasoner, Collection<Principle> principles) {
7193
DungTheoryGenerator generator = new EnumeratingDungTheoryGenerator();
72-
PostulateEvaluator<Argument,DungTheory> evaluator = new PostulateEvaluator<>(generator, reasoner);
94+
PostulateEvaluator<Argument, DungTheory> evaluator = new PostulateEvaluator<>(generator, reasoner);
7395
evaluator.addAllPostulates(principles);
7496
System.out.println(evaluator.evaluate(4000, false).prettyPrint());
7597
}

org-tweetyproject-arg-dung/src/main/java/org/tweetyproject/arg/dung/examples/QualifiedSemanticsReasonerExample.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,60 @@
3333
public class QualifiedSemanticsReasonerExample {
3434
/**
3535
* Execute the example
36+
*
3637
* @param args cmdline arguments
3738
*/
3839
public static void main(String[] args) {
3940
Semantics semantics = Semantics.CO;
4041
DungTheory theory = example2();
4142

4243
System.out.println(theory.prettyPrint());
43-
Collection<Extension<DungTheory>> exts = AbstractExtensionReasoner.getSimpleReasonerForSemantics(semantics).getModels(theory);
44+
Collection<Extension<DungTheory>> exts = AbstractExtensionReasoner.getSimpleReasonerForSemantics(semantics)
45+
.getModels(theory);
4446
Collection<Extension<DungTheory>> exts_q = new QualifiedReasoner(semantics).getModels(theory);
4547
Collection<Extension<DungTheory>> exts_sq = new SemiQualifiedReasoner(semantics).getModels(theory);
4648
System.out.printf("%s: %s%n", semantics.description(), exts);
4749
System.out.printf("qualified %s: %s%n", semantics.description(), exts_q);
4850
System.out.printf("semi-qualified %s: %s%n", semantics.description(), exts_sq);
4951
}
5052

53+
/**
54+
* Creates and returns an example of a Dung argumentation framework (Dung
55+
* Theory).
56+
* <p>
57+
* This example consists of three arguments: {@code a}, {@code b}, and
58+
* {@code c}.
59+
*
60+
* @return A {@link DungTheory} object representing the defined argumentation
61+
* framework.
62+
*/
5163
public static DungTheory example1() {
5264
Argument a = new Argument("a");
5365
Argument b = new Argument("b");
5466
Argument c = new Argument("c");
5567
DungTheory theory = new DungTheory();
56-
theory.add(a,b,c);
68+
theory.add(a, b, c);
5769
theory.addAttack(a, a);
5870
theory.addAttack(a, b);
5971
theory.addAttack(b, c);
6072

6173
return theory;
6274
}
6375

76+
/**
77+
* Creates and returns an example of a Dung argumentation framework (Dung
78+
* Theory).
79+
*
80+
* @return A {@link DungTheory} object representing the defined argumentation
81+
* framework.
82+
*/
6483
public static DungTheory example2() {
6584
Argument d = new Argument("d");
6685
Argument e = new Argument("e");
6786
Argument f = new Argument("f");
6887
Argument g = new Argument("g");
6988
DungTheory theory = new DungTheory();
70-
theory.add(d,e,f,g);
89+
theory.add(d, e, f, g);
7190
theory.addAttack(d, e);
7291
theory.addAttack(e, d);
7392
theory.addAttack(d, f);
@@ -77,14 +96,22 @@ public static DungTheory example2() {
7796
return theory;
7897
}
7998

99+
/**
100+
* Creates and returns an example of a Dung argumentation framework (Dung
101+
* Theory).
102+
* <p>
103+
*
104+
* @return A {@link DungTheory} object representing the defined argumentation
105+
* framework.
106+
*/
80107
public static DungTheory example3() {
81108
Argument h = new Argument("h");
82109
Argument i = new Argument("i");
83110
Argument j = new Argument("j");
84111
Argument k = new Argument("k");
85112
Argument l = new Argument("l");
86113
DungTheory theory = new DungTheory();
87-
theory.add(h,i,j,k,l);
114+
theory.add(h, i, j, k, l);
88115
theory.addAttack(i, h);
89116
theory.addAttack(h, j);
90117
theory.addAttack(j, i);

org-tweetyproject-arg-dung/src/main/java/org/tweetyproject/arg/dung/reasoner/SerialisedExtensionReasoner.java

Lines changed: 75 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@
3939
* A semantics is serialisable iff it can be characterised by two functions
4040
* <br>
4141
* <ul>
42-
* <li>{@link SelectionFunction} a(UA, UC, C): Return a subset of the initial sets
43-
* <li>{@link TerminationFunction} b(AF, S): True, iff S is an extension
42+
* <li>{@link SelectionFunction} a(UA, UC, C): Return a subset of the initial
43+
* sets
44+
* <li>{@link TerminationFunction} b(AF, S): True, iff S is an extension
4445
* </ul>
45-
* which describe a transition system where {@code a(UA,UC,C)} provides the possible transitions to new states
46-
* and {@code b(AF,S)} determines whether the current state is an extension of the semantics.
46+
* which describe a transition system where {@code a(UA,UC,C)} provides the
47+
* possible transitions to new states
48+
* and {@code b(AF,S)} determines whether the current state is an extension of
49+
* the semantics.
4750
*
4851
* @see "Matthias Thimm. 'Revisiting initial sets in abstract argumentation' Argument & Computation (2022)"
4952
*
@@ -58,19 +61,23 @@ public class SerialisedExtensionReasoner extends AbstractExtensionReasoner {
5861
private final Semantics semantics;
5962

6063
/**
61-
* Initializes a serialisation reasoner with the given selection and termination functions
64+
* Initializes a serialisation reasoner with the given selection and termination
65+
* functions
66+
*
6267
* @param alpha some selection function
63-
* @param beta some termination function
68+
* @param beta some termination function
6469
*/
6570
public SerialisedExtensionReasoner(SelectionFunction alpha, TerminationFunction beta) {
6671
this(alpha, beta, Semantics.diverse);
6772
}
6873

6974
/**
70-
* Initializes a serialisation reasoner with the given selection and termination functions
75+
* Initializes a serialisation reasoner with the given selection and termination
76+
* functions
7177
* and sets the semantics
72-
* @param alpha some selection function
73-
* @param beta some termination function
78+
*
79+
* @param alpha some selection function
80+
* @param beta some termination function
7481
* @param semantics some semantics
7582
*/
7683
public SerialisedExtensionReasoner(SelectionFunction alpha, TerminationFunction beta, Semantics semantics) {
@@ -81,6 +88,7 @@ public SerialisedExtensionReasoner(SelectionFunction alpha, TerminationFunction
8188

8289
/**
8390
* Initializes a serialisation reasoner for the given semantics
91+
*
8492
* @param semantics some selection function
8593
*/
8694
public SerialisedExtensionReasoner(Semantics semantics) {
@@ -89,32 +97,39 @@ public SerialisedExtensionReasoner(Semantics semantics) {
8997
case ADM -> {
9098
selectionFunction = SelectionFunction.ADMISSIBLE;
9199
terminationFunction = TerminationFunction.ADMISSIBLE;
92-
} case CO -> {
100+
}
101+
case CO -> {
93102
selectionFunction = SelectionFunction.ADMISSIBLE;
94103
terminationFunction = TerminationFunction.COMPLETE;
95-
} case PR -> {
104+
}
105+
case PR -> {
96106
selectionFunction = SelectionFunction.ADMISSIBLE;
97107
terminationFunction = TerminationFunction.PREFERRED;
98-
} case SAD -> {
108+
}
109+
case SAD -> {
99110
selectionFunction = SelectionFunction.GROUNDED;
100111
terminationFunction = TerminationFunction.ADMISSIBLE;
101-
} case GR -> {
112+
}
113+
case GR -> {
102114
selectionFunction = SelectionFunction.GROUNDED;
103115
terminationFunction = TerminationFunction.COMPLETE;
104-
} case UC -> {
116+
}
117+
case UC -> {
105118
selectionFunction = SelectionFunction.UNCHALLENGED;
106119
terminationFunction = TerminationFunction.UNCHALLENGED;
107-
} case ST -> {
120+
}
121+
case ST -> {
108122
selectionFunction = SelectionFunction.ADMISSIBLE;
109123
terminationFunction = TerminationFunction.STABLE;
110-
} default -> throw new IllegalArgumentException("Semantics is not serialisable: " + semantics);
124+
}
125+
default -> throw new IllegalArgumentException("Semantics is not serialisable: " + semantics);
111126
}
112127
}
113128

114129
@Override
115130
public Collection<Extension<DungTheory>> getModels(DungTheory bbase) {
116131
Collection<Extension<DungTheory>> result = new HashSet<>();
117-
for (SerialisationSequence sequence: this.getSequences(bbase)) {
132+
for (SerialisationSequence sequence : this.getSequences(bbase)) {
118133
result.add(sequence.getExtension());
119134
}
120135
return result;
@@ -128,16 +143,18 @@ public Extension<DungTheory> getModel(DungTheory bbase) {
128143

129144
/**
130145
* Computes the set of serialisation sequences wrt. the semantics
146+
*
131147
* @param bbase some argumentation framework
132148
* @return the set of serialisation sequences
133149
*/
134-
public Collection<SerialisationSequence> getSequences(DungTheory bbase){
150+
public Collection<SerialisationSequence> getSequences(DungTheory bbase) {
135151
return this.getSequences(bbase, new SerialisationSequence());
136152
}
137153

138154
/**
139155
* Recursively computes all serialisation sequences wrt. the semantics
140-
* @param theory an argumentation framework
156+
*
157+
* @param theory an argumentation framework
141158
* @param parentSequence the current serialisation sequence
142159
* @return the set of serialisation sequences
143160
*/
@@ -148,10 +165,13 @@ private Collection<SerialisationSequence> getSequences(DungTheory theory, Serial
148165
if (this.isTerminal(theory, parentSequence.getExtension())) {
149166
result.add(parentSequence);
150167
}
151-
Map<SimpleInitialReasoner.Initial, Collection<Extension<DungTheory>>> initialSets = SimpleInitialReasoner.partitionInitialSets(theory);
152-
Collection<Extension<DungTheory>> candidateSets = this.getSelection(initialSets.get(UA), initialSets.get(UC), initialSets.get(C));
153-
// iterate depth-first through all initial sets (and hence their induced states) and add all found serialisation sequences
154-
for (Extension<DungTheory> set: candidateSets) {
168+
Map<SimpleInitialReasoner.Initial, Collection<Extension<DungTheory>>> initialSets = SimpleInitialReasoner
169+
.partitionInitialSets(theory);
170+
Collection<Extension<DungTheory>> candidateSets = this.getSelection(initialSets.get(UA), initialSets.get(UC),
171+
initialSets.get(C));
172+
// iterate depth-first through all initial sets (and hence their induced states)
173+
// and add all found serialisation sequences
174+
for (Extension<DungTheory> set : candidateSets) {
155175
DungTheory reduct = theory.getReduct(set);
156176

157177
SerialisationSequence newSequence = new SerialisationSequence(parentSequence);
@@ -163,10 +183,12 @@ private Collection<SerialisationSequence> getSequences(DungTheory theory, Serial
163183
}
164184

165185
/**
166-
* Creates a graph, visualizing the transition states of the serialisation process, which creates all serialisable extensions
186+
* Creates a graph, visualizing the transition states of the serialisation
187+
* process, which creates all serialisable extensions
167188
* according to the specified semantics of the specified framework.
168189
*
169-
* @param bbase argumentation framework, for which the extensions shall be computed
190+
* @param bbase argumentation framework, for which the extensions shall be
191+
* computed
170192
* @return Graph representing the serialisation sequences
171193
*/
172194
public SerialisationGraph getSerialisationGraph(DungTheory bbase) {
@@ -175,17 +197,43 @@ public SerialisationGraph getSerialisationGraph(DungTheory bbase) {
175197

176198
/**
177199
* Return the semantics of this reasoner
200+
*
178201
* @return the semantics
179202
*/
180203
public Semantics getSemantics() {
181204
return semantics;
182205
}
183206

184-
public Collection<Extension<DungTheory>> getSelection(Collection<Extension<DungTheory>> ua, Collection<Extension<DungTheory>> uc, Collection<Extension<DungTheory>> c) {
185-
return this.selectionFunction.execute((Set<Extension<DungTheory>>) ua, (Set<Extension<DungTheory>>) uc, (Set<Extension<DungTheory>>) c);
207+
/**
208+
* Applies a selection function to compute a collection of preferred extensions
209+
* from given sets of extensions.
210+
*
211+
* @param ua A collection of unattacked extensions of the Dung theory.
212+
* @param uc A collection of unattacked but conflicting extensions.
213+
* @param c A collection of conflicting extensions.
214+
* @return A collection of {@link Extension} objects selected based on the
215+
* applied selection function.
216+
*
217+
* @throws ClassCastException if any of the input collections cannot be cast to
218+
* {@link Set<Extension<DungTheory>>}.
219+
*/
220+
public Collection<Extension<DungTheory>> getSelection(Collection<Extension<DungTheory>> ua,
221+
Collection<Extension<DungTheory>> uc, Collection<Extension<DungTheory>> c) {
222+
return this.selectionFunction.execute((Set<Extension<DungTheory>>) ua, (Set<Extension<DungTheory>>) uc,
223+
(Set<Extension<DungTheory>>) c);
186224
}
187225

226+
/**
227+
* Checks whether a given extension is terminal in the specified Dung theory.
228+
*
229+
*
230+
* @param theory The {@link DungTheory} in which the extension is evaluated.
231+
* @param extension The {@link Extension} to be checked for terminal status.
232+
* @return {@code true} if the extension is terminal in the given theory;
233+
* {@code false} otherwise.
234+
*/
188235
public boolean isTerminal(DungTheory theory, Extension<DungTheory> extension) {
189236
return this.terminationFunction.execute(theory, extension);
190237
}
238+
191239
}

org-tweetyproject-arg-rankings/src/main/java/org/tweetyproject/arg/rankings/postulates/RaSigmaCompatibility.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,36 @@
1212
import java.util.HashSet;
1313
import java.util.Iterator;
1414

15+
16+
/**
17+
* Represents the Sigma-Compatibility postulate for ranking-based argumentation frameworks.
18+
*
19+
*
20+
* @see RankingPostulate
21+
* @see AbstractExtensionReasoner
22+
* @see Semantics
23+
*/
1524
public class RaSigmaCompatibility extends RankingPostulate {
1625

26+
/**
27+
* The extension-based reasoner used to derive extensions of the argumentation framework.
28+
*/
1729
AbstractExtensionReasoner reasoner;
1830

31+
/**
32+
* Constructs a {@code RaSigmaCompatibility} postulate with the specified extension reasoner.
33+
*
34+
* @param reasoner The {@link AbstractExtensionReasoner} used to compute extensions of the argumentation framework.
35+
*/
1936
public RaSigmaCompatibility(AbstractExtensionReasoner reasoner) {
2037
this.reasoner = reasoner;
2138
}
2239

40+
/**
41+
* Constructs a {@code RaSigmaCompatibility} postulate using a specified semantics.
42+
*
43+
* @param semantics The {@link Semantics} defining the reasoning approach for argument evaluation.
44+
*/
2345
public RaSigmaCompatibility(Semantics semantics) {
2446
this(AbstractExtensionReasoner.getSimpleReasonerForSemantics(semantics));
2547
}

0 commit comments

Comments
 (0)