Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1f0c941
Merge duplicate maven-javadoc-plugin declarations in root pom
larsbengel Oct 16, 2026
f4ddf20
ADF rework phase 1: new syntax, semantics foundations, link types and…
larsbengel Oct 16, 2026
d0c3f1d
ADF rework phase 2: reasoner API and brute-force Simple* reasoners
larsbengel Oct 16, 2026
228a5d6
ADF rework: old-vs-new evaluation harness (first slice of plan sectio…
larsbengel Oct 16, 2026
ffcfe16
ADF bench: frozen instance set co-scaling (af, bipolar, general; n = …
larsbengel Oct 16, 2026
a3f983e
ADF rework phase 2: consumer prototype for course helpers and web ada…
larsbengel Oct 16, 2026
d8a939c
ADF bench: CO enumeration, old baseline vs new Simple reasoners, n = …
larsbengel Oct 16, 2026
2dbf6d0
ADF rework: rename leqInfo to isAtLeastAsInformativeAs, add isMoreInf…
larsbengel Oct 16, 2026
da2385c
ADF rework: make AbstractAdfReasoner.isModel abstract
larsbengel Oct 16, 2026
c341612
ADF rework: eager reasoner API like the Dung module, remove ModelIter…
larsbengel Oct 16, 2026
cffbd92
ADF rework: Javadoc cleanup
larsbengel Oct 16, 2026
b7d8e8e
ADF rework: javadoc cleanup
larsbengel Oct 16, 2026
b29dea5
Add ModelVerifier interface for the verification problem
larsbengel Oct 16, 2026
47cd642
ADF rework: reasoners as ModelVerifiers, drop CompiledAdf
larsbengel Oct 16, 2026
d92e704
ADF rework: array-based ThreeValuedInterpretation with shared domain
larsbengel Oct 16, 2026
87cb0b1
ADF rework: remove the unused revision counter
larsbengel Oct 16, 2026
7adf563
ADF bench: select the hot-fixed baseline as implementation old-fixed
larsbengel Oct 16, 2026
1b12a98
ADF bench: independent brute-force oracle in the driver
larsbengel Oct 16, 2026
946a374
ADF bench: tasks CE, SE, DC, DS and VE
larsbengel Oct 16, 2026
b3750c4
ADF bench: frozen instance sets dev (n = 4..12) and dev-large (af/bip…
larsbengel Oct 16, 2026
9cf0536
SAT module: incremental Sat4j backend and fixes for the native backends
larsbengel Oct 16, 2026
9e7e5a5
ADF rework phase 3: Tseitin encoding, SAT-based Γ and the MOD reasoner
larsbengel Oct 16, 2026
6d4d799
ADF bench: implementation new-sat for the SAT reasoners
larsbengel Oct 16, 2026
943adc6
ADF rework phase 4: SAT-based grounded reasoner
larsbengel Oct 16, 2026
597a678
SAT module: bundle the native libraries under org/tweetyproject/sat/n…
larsbengel Oct 16, 2026
5d8f5d4
ADF rework: skip SAT calls when the Kleene value of a condition is de…
larsbengel Oct 16, 2026
51449c0
ADF bench: implementation new-sat-native (SAT reasoners with native M…
larsbengel Oct 16, 2026
82d5b83
ADF rework phase 4: SAT-based conflict-free and naive reasoners
larsbengel Oct 17, 2026
8d7d52b
ADF bench: SAT reasoners for CF and NA in new-sat / new-sat-native
larsbengel Oct 17, 2026
eeeb9aa
ADF rework phase 4: CF and NA acceptance as in k++ADF
larsbengel Oct 17, 2026
4433f6d
ADF rework phase 4: SAT-based admissible reasoner
larsbengel Oct 17, 2026
e6873d0
ADF bench: SAT reasoner for ADM in new-sat / new-sat-native
larsbengel Oct 17, 2026
bb4adaa
ADF rework phase 4: SAT-based preferred reasoner
larsbengel Oct 17, 2026
ee4c476
ADF bench: SAT reasoner for PR in new-sat / new-sat-native
larsbengel Oct 17, 2026
019d1da
ADF rework phase 4: SAT-based stable reasoner
larsbengel Oct 17, 2026
f322c43
ADF bench: SAT reasoner for ST in new-sat / new-sat-native
larsbengel Oct 17, 2026
88d3ef5
ADF rework phase 4: SAT-based complete reasoner
larsbengel Oct 17, 2026
acd8b0f
ADF bench: SAT reasoner for CO in new-sat / new-sat-native
larsbengel Oct 17, 2026
44b8317
ADF rework phase 4: AbstractSatAdfReasoner and getSatReasonerForSeman…
larsbengel Oct 17, 2026
b927d7b
Web: ADF services on the reworked ADF module
larsbengel Oct 17, 2026
4048d25
Translators: ADF translations on the reworked ADF module
larsbengel Oct 17, 2026
941e7bb
ADF rework phase 7: remove the old implementation
larsbengel Oct 17, 2026
630562e
ADF rework: comment cleanup and package layout
larsbengel Oct 17, 2026
b95bd29
ADF rework: shared helpers and Tweety parser
larsbengel Oct 17, 2026
37452a1
ADF rework: TwoValuedEncoding, default getModel, no defensive copies
larsbengel Oct 17, 2026
0a7a416
ADF rework: leaner tests
larsbengel Oct 17, 2026
fb73136
ADF rework: initial models
larsbengel Oct 17, 2026
240fe7a
Refactor getLinks method to use LinkedHashSet for maintaining inserti…
larsbengel Oct 17, 2026
f4df58e
update .gitignore
larsbengel Oct 17, 2026
ffc7f8b
minor doc updates
larsbengel Oct 17, 2026
6839e43
Merge branch 'main' into adf-rework
larsbengel Oct 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions org-tweetyproject-arg-adf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.tweetyproject.arg</groupId>
<artifactId>dung</artifactId>
<version>1.31-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.tweetyproject.logics</groupId>
<artifactId>pl</artifactId>
<version>1.31-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.tweetyproject</groupId>
<artifactId>sat</artifactId>
<version>1.31-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
/*
* This file is part of "TweetyProject", a collection of Java libraries for
* logical aspects of artificial intelligence and knowledge representation.
*
* TweetyProject is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2026 The TweetyProject Team <http://tweetyproject.org/contact/>
*/
package org.tweetyproject.arg.adf.analysis;

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.IntSupplier;
import java.util.function.Supplier;

import org.tweetyproject.arg.adf.util.TseitinEncoder;
import org.tweetyproject.arg.adf.syntax.AbstractDialecticalFramework;
import org.tweetyproject.arg.adf.syntax.AcceptanceConditions;
import org.tweetyproject.arg.adf.syntax.Link;
import org.tweetyproject.arg.adf.syntax.LinkType;
import org.tweetyproject.arg.dung.syntax.Argument;
import org.tweetyproject.logics.pl.syntax.Equivalence;
import org.tweetyproject.logics.pl.syntax.ExclusiveDisjunction;
import org.tweetyproject.logics.pl.syntax.Implication;
import org.tweetyproject.logics.pl.syntax.Negation;
import org.tweetyproject.logics.pl.syntax.PlFormula;
import org.tweetyproject.logics.pl.syntax.Proposition;
import org.tweetyproject.sat.SatSolver;
import org.tweetyproject.sat.sat4j.Sat4jIncrementalSolver;

/**
* Computes the {@link LinkType}s of the links of an ADF.
* <p>
* A link (b, a) is supporting if phi_a is monotone in b (making b true never makes
* phi_a false), attacking if phi_a is antitone in b, redundant if both, and
* dependent if neither.
*
* @see "Thomas Linsbichler, Marco Maratea, Andreas Niskanen, Johannes P. Wallner, Stefan Woltran. 'Novel Algorithms for Abstract Dialectical Frameworks based on Complexity Analysis of Subclasses and SAT Solving.' IJCAI 2018."
*
* @author Lars Bengel
*/
public final class LinkTypeClassifier {

private LinkTypeClassifier() {}

/**
* @param adf an ADF
* @return the exact type of every link of the ADF
*/
public static Map<Link, LinkType> classify(AbstractDialecticalFramework adf) {
return classify(adf, Sat4jIncrementalSolver::new);
}

/**
* @param adf an ADF
* @param solvers creates the solver used for the classification
* @return the exact type of every link of the ADF
*/
public static Map<Link, LinkType> classify(AbstractDialecticalFramework adf, Supplier<SatSolver> solvers) {
try (Context ctx = new Context(adf, solvers.get())) {
Map<Link, LinkType> result = new LinkedHashMap<>();
for (Link link : adf.getLinks()) {
result.put(link, ctx.classify(link.getParent(), link.getChild(), true));
}
return Collections.unmodifiableMap(result);
}
}

/**
* @param adf an ADF
* @param parent an argument occurring in the condition of the child
* @param child an argument of the ADF
* @return the exact type of the link (parent, child)
* @throws IllegalArgumentException if (parent, child) is not a link of the ADF
*/
public static LinkType classify(AbstractDialecticalFramework adf, Argument parent, Argument child) {
if (!adf.areAdjacent(parent, child)) {
throw new IllegalArgumentException("(" + parent + ", " + child + ") is not a link of the ADF.");
}
try (Context ctx = new Context(adf, new Sat4jIncrementalSolver())) {
return ctx.classify(parent, child, true);
}
}

/**
* @param adf an ADF
* @return true if every link is supporting, attacking or redundant
*/
public static boolean isBipolar(AbstractDialecticalFramework adf) {
try (Context ctx = new Context(adf, new Sat4jIncrementalSolver())) {
for (Link link : adf.getLinks()) {
if (!ctx.classify(link.getParent(), link.getChild(), false).isBipolar()) {
return false;
}
}
return true;
}
}

/**
* @param adf an ADF
* @param argument an argument of the ADF
* @return the number k_a of dependent parents of the argument
*/
public static int dependentParents(AbstractDialecticalFramework adf, Argument argument) {
try (Context ctx = new Context(adf, new Sat4jIncrementalSolver())) {
int k = 0;
for (Argument parent : adf.getParents(argument)) {
if (!ctx.classify(parent, argument, false).isBipolar()) {
k++;
}
}
return k;
}
}

/** classification state for one snapshot of a framework */
private static final class Context implements AutoCloseable {
private final AbstractDialecticalFramework adf;

private final SatSolver solver;

private final Map<Argument, Integer> variables = new HashMap<>();

/** supplies a literal fixed to true */
private final IntSupplier top;

Context(AbstractDialecticalFramework adf, SatSolver solver) {
this.adf = adf;
this.solver = solver;
this.top = TseitinEncoder.trueLiteral(solver);
}

/**
* @param exact if false, a syntactic certificate for one direction suffices
* and a bipolar (non-dependent) result may be SUPPORTING or
* ATTACKING although the link is in fact REDUNDANT
*/
LinkType classify(Argument parent, Argument child, boolean exact) {
PlFormula condition = adf.getAcceptanceCondition(child);
int polarity = polarity(condition, parent.getName(), true);
boolean monotone = (polarity & NEGATIVE) == 0;
boolean antitone = (polarity & POSITIVE) == 0;
if (!exact && (monotone || antitone)) {
return LinkType.of(monotone, antitone);
}
boolean[] checked = check(condition, parent, child, monotone, antitone);
return LinkType.of(checked[0], checked[1]);
}

/** @return {monotone, antitone}, both decided exactly; known properties are not checked again */
private boolean[] check(PlFormula condition, Argument parent, Argument child, boolean monotone, boolean antitone) {
int t = top.getAsInt();
int withFalse = new TseitinEncoder(solver, p -> atom(p, parent, -t), top).encode(condition);
int withTrue = new TseitinEncoder(solver, p -> atom(p, parent, t), top).encode(condition);
monotone = monotone || !solver.satisfiable(new int[] { withFalse, -withTrue });
antitone = antitone || !solver.satisfiable(new int[] { withTrue, -withFalse });
return new boolean[] { monotone, antitone };
}

/** @return the literal of p, where the parent is replaced by the given constant */
private int atom(Proposition p, Argument parent, int constant) {
Argument argument = adf.toArgument(p);
if (argument.equals(parent)) {
return constant;
}
Integer variable = variables.get(argument);
if (variable == null) {
variable = solver.newVar();
variables.put(argument, variable);
}
return variable;
}

@Override
public void close() {
solver.close();
}
}

private static final int POSITIVE = 1, NEGATIVE = 2;

/** @return the polarities (bit set of POSITIVE, NEGATIVE) in which the atom occurs */
private static int polarity(PlFormula formula, String atom, boolean positive) {
if (formula instanceof Proposition) {
return ((Proposition) formula).getName().equals(atom) ? (positive ? POSITIVE : NEGATIVE) : 0;
} else if (formula instanceof Negation) {
return polarity(((Negation) formula).getFormula(), atom, !positive);
} else if (formula instanceof Implication) {
Implication i = (Implication) formula;
return polarity(i.getFirstFormula(), atom, !positive) | polarity(i.getSecondFormula(), atom, positive);
} else if (formula instanceof Equivalence || formula instanceof ExclusiveDisjunction) {
// operands of ↔ and ⊕ occur in both polarities
int result = 0;
for (PlFormula child : AcceptanceConditions.children(formula)) {
result |= polarity(child, atom, true) | polarity(child, atom, false);
}
return result;
}
// constants, conjunction and disjunction keep the polarity
int result = 0;
for (PlFormula child : AcceptanceConditions.children(formula)) {
result |= polarity(child, atom, positive);
}
return result;
}

}

This file was deleted.

Loading
Loading