Class DungTheory
java.lang.Object
org.tweetyproject.commons.BeliefSet<Argument, DungSignature>
org.tweetyproject.arg.dung.syntax.DungTheory
- All Implemented Interfaces:
Comparable<DungTheory>,Iterable<Argument>,Collection<Argument>,ArgumentationFramework<Argument>,BeliefBase,GeneralGraph<Argument>,Graph<Argument>
- Direct Known Subclasses:
ClaimBasedTheory,ConstrainedArgumentationFramework,EpistemicArgumentationFramework,ExecutableDungTheory,IncompleteTheory,InducedTheory,ProbabilisticArgumentationFramework,SocialAbstractArgumentationFramework,StructuredArgumentationFramework,WeightedArgumentationFramework,WeightedDungTheory
public class DungTheory
extends BeliefSet<Argument, DungSignature>
implements Graph<Argument>, Comparable<DungTheory>, ArgumentationFramework<Argument>
This class implements an abstract argumentation theory in the sense of Dung.
See
Phan Minh Dung. On the Acceptability of Arguments and its Fundamental Role in Nonmonotonic Reasoning, Logic Programming and n-Person Games. In Artificial Intelligence, Volume 77(2):321-358. 1995
See
Phan Minh Dung. On the Acceptability of Arguments and its Fundamental Role in Nonmonotonic Reasoning, Logic Programming and n-Person Games. In Artificial Intelligence, Volume 77(2):321-358. 1995
- Author:
- Matthias Thimm, Tjitze Rienstra
-
Field Summary
Fields inherited from class org.tweetyproject.commons.BeliefSet
EQUALS_USES_SIGNATUREFields inherited from interface org.tweetyproject.graphs.Graph
IGNORE_SELFLOOPS, INVERT_SELFLOOPS, REMOVE_SELFLOOPS -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor; initializes empty sets of arguments and attacksDungTheory(Graph<Argument> graph) Creates a new theory from the given graph. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the given node to this graph.booleanAdds the given attack to this dung theory.booleanAdds the given attacks to this dung theory.booleanadd(DungTheory theory) Adds all arguments and attacks of the given theory to this theorybooleanadd(GeneralEdge<Argument> edge) Adds the given edge to this graph.booleanaddAllAttacks(Collection<? extends Attack> c) Adds the set of attacks to this Dung theory.booleanAdds an attack from the first argument to the second to thisDdung theory.booleanareAdjacent(Argument a, Argument b) Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.clone()intbooleanReturns "true" when this graph contains the given node or edge.booleancontainsAll(Collection<?> c) Checks if the argumentation framework contains all the elements in the given collection.booleancontainsAttack(Attack att) Checks whether this theory contains the given attack.<S extends Node>
booleanChecks whether there is at least one cycle in this DungTheory.<S extends Node>
booleanChecks whether there is at least on eodd cycle in this DungTheory.booleanbooleanequalsIn(HashSet<DungTheory> setOfEquals) Method to check if an equal object to this object is contained in the specified setbooleanexistsDirectedPath(Argument node1, Argument node2) Checks whether there is a (directed) path from node1 to node2.faf(Extension<DungTheory> extension) The characteristic function of an abstract argumentation framework: F_AF(S) = {A|A is acceptable wrt.Returns the adjacency matrix of this graph (the order of the nodes is the same as returned by "iterator()").getAttacked(Collection<Argument> args) Computes the set {A | (arg,A) in attacks for some arg in args}.getAttacked(Argument argument) Computes the set {A | (argument,A) in attacks}.getAttackers(Collection<Argument> args) Computes the set {A | (A,arg) in attacks for some arg in args}.getAttackers(Argument argument) Computes the set {A | (A,argument) in attacks}.Returns all attacks of this theory.Returns all bidirectional attacks of this theory.getChildren(Node node) Returns the set of children (node connected via an undirected edge or a directed edge where the given node is the parent) of the given node.getComplementGraph(int selfloops) Returns the complement graph of this graph, i.e.Returns the set of (simple) connected components of this graph.Returns the corresponding edge (a,b) if a and b are adjacent.Collection<? extends Edge<? extends Argument>> getEdges()Returns the edges of this graph.Returns the signature of the language of this knowledge base.getNeighbors(Argument node) Returns the set of neighbors of the given node.getNodes()Returns the nodes of this graph.intReturns the number of edges in this graph.intReturns the number of nodes in this graph.getParents(Node node) Returns the set of parents (node connected via an undirected edge or a directed edge where the given node is the child) of the given node.getReduct(Collection<Argument> arguments) computes the reduct of bbase wrt.computes the reduct of this wrt.getRestriction(Collection<Argument> arguments) Returns a copy of this graph that contains only the specified nodes and all corresponding edges between them.Returns the strongly connected components of this graph.Returns the set of sub graphs of this graph.Returns the set of arguments b such that a is in ext and there is no c in ext such that (c,b) is an attack.Returns the set of attacks (b,a) such that a is in ext and there is no c in ext such that (c,b) is an attack.booleanIf this graph is acyclic, this method checks if the given argument has an attack branch, i.e.booleanIf this graph is acyclic, this method checks if the given argument has a defense branch, i.e.inthashCode()booleanReturns "true" iff the graph has a self loop (an edge from a node to itself).booleanisAcceptable(Argument argument, Extension<DungTheory> ext) returns true if every attacker onargumentis attacked by some accepted argument wrt.booleanisAdmissible(Extension<DungTheory> ext) returns true if every accepted argument of this is defended by some accepted argument wrt.booleanisAttackBranch(Argument a, Argument b) Checks whether the path from b to a is an attack branch, i.e.booleanisAttacked(Extension<DungTheory> ext1, Extension<DungTheory> ext2) returns true if some argument ofext2attacks some argument inext1booleanisAttacked(Argument argument, Extension<? extends ArgumentationFramework<?>> ext) returns true if some argument ofextattacks argument.booleanisAttackedBy(Argument argument, Collection<Argument> ext) returns true if some argument ofextis attacked by argument.booleanisAttackedBy(Argument arg1, Argument arg2) Checks whether arg1 is attacked by arg2.booleanisAttackingAllOtherArguments(Extension<? extends ArgumentationFramework<Argument>> ext) returns true ifargumentsattack all other arguments in the theorybooleanDetermines if the theory is coherent, i.e., if each preferred extension is stablebooleanChecks whether the given extension is complete wrt.booleanisConflictFree(Collection<Argument> ext) returns true if no accepted argument attacks another one in the setbooleanreturns true if no accepted argument attacks another accepted one in this interpretation wrt.booleanisDefenseBranch(Argument a, Argument b) Checks whether the path from b to a is a defense branch, i.e.booleanisIndirectAttack(Argument arg1, Argument arg2) Checks whether "arg1" indirectly attacks "arg2", i.e.booleanChecks whether the given extension is preferred wrt.booleanDetermines if the theory is relatively coherent, i.e., if the grounded extension coincides with the intersection of all preferred extensionsbooleanChecks whether the given extension is stable wrt.booleanisStronglyDefendedBy(Argument arg, Collection<Argument> ext) Checks whether a specified argument is strongly defended by the given set of arguments.booleanChecks whether "arg1" supports "arg2", i.e.booleanChecks whether this graph only contains weighted edges.booleanreturns true iff the theory is well-founded, i.e., there is no infinite sequence A1,A2,...Pretty print of the theory.booleanRemoves the argument and all its attacksbooleanRemoves the given attack from this Dung theory.booleanremoveAll(Collection<?> c) toString()Methods inherited from class org.tweetyproject.commons.BeliefSet
add, addAll, clear, getSignature, isEmpty, iterator, remove, retainAll, setSignature, size, toArray, toArray, toStringMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
DungTheory
public DungTheory()Default constructor; initializes empty sets of arguments and attacks -
DungTheory
-
-
Method Details
-
clone
-
getMinimalSignature
Description copied from interface:BeliefBaseReturns the signature of the language of this knowledge base.- Specified by:
getMinimalSignaturein interfaceBeliefBase- Returns:
- the signature of the language of this knowledge base.
-
isAttackingAllOtherArguments
public boolean isAttackingAllOtherArguments(Extension<? extends ArgumentationFramework<Argument>> ext) returns true ifargumentsattack all other arguments in the theory- Parameters:
ext- An extension contains a set of arguments.- Returns:
- true if
argumentsattack all other arguments in the theory
-
isWellFounded
public boolean isWellFounded()returns true iff the theory is well-founded, i.e., there is no infinite sequence A1,A2,... of arguments with Ai attacking Ai+1- Returns:
- true iff the theory is well-founded
-
isAcceptable
returns true if every attacker onargumentis attacked by some accepted argument wrt. the given theory.- Parameters:
argument- an argumentext- an extension (the knowledge base)- Returns:
- true if every attacker on
argumentis attacked by some accepted argument wrt. the given theory.
-
isConflictFree
returns true if no accepted argument attacks another accepted one in this interpretation wrt. the given theory.- Parameters:
ext- an extension- Returns:
- true if no accepted argument attacks another accepted one in this interpretation wrt. the given theory.
-
isConflictFree
returns true if no accepted argument attacks another one in the set- Parameters:
ext- a set of arguments- Returns:
- true if no accepted argument attacks another one in the set
-
isAdmissible
returns true if every accepted argument of this is defended by some accepted argument wrt. the given Dung theory.- Parameters:
ext- an extension- Returns:
- true, if every accepted argument of this is defended by some accepted argument wrt. the given Dung theory.
-
isStronglyDefendedBy
Checks whether a specified argument is strongly defended by the given set of arguments.- Parameters:
arg- some argumentext- a set of arguments- Returns:
- true, iff the specified argument is strongly defended by the set
-
isCoherent
public boolean isCoherent()Determines if the theory is coherent, i.e., if each preferred extension is stable- Returns:
- true if the theory is coherent
-
isRelativelyCoherent
public boolean isRelativelyCoherent()Determines if the theory is relatively coherent, i.e., if the grounded extension coincides with the intersection of all preferred extensions- Returns:
- true if the theory is relatively coherent
-
getAttackers
-
getAttackers
Computes the set {A | (A,arg) in attacks for some arg in args}.- Parameters:
args- a set of arguments- Returns:
- the set of all arguments that attack some argument
in
args.
-
getAttacked
-
getAttacked
Computes the set {A | (arg,A) in attacks for some arg in args}.- Parameters:
args- a set of arguments- Returns:
- the set of all arguments that are attacked by some argument
in
args.
-
isAttacked
returns true if some argument ofextattacks argument.- Specified by:
isAttackedin interfaceArgumentationFramework<Argument>- Parameters:
argument- an argumentext- an extension, ie. a set of arguments- Returns:
- true if some argument of
extattacks argument.
-
isAttackedBy
returns true if some argument ofextis attacked by argument.- Parameters:
argument- an argumentext- an extension, ie. a set of arguments- Returns:
- true if some argument of
extis attacked by argument.
-
isAttacked
returns true if some argument ofext2attacks some argument inext1- Parameters:
ext1- an extension, ie. a set of argumentsext2- an extension, ie. a set of arguments- Returns:
- true if some argument of
ext2attacks some argument inext1
-
isStable
Checks whether the given extension is stable wrt. this theory.- Parameters:
e- some extension- Returns:
- "true" iff the extension is stable.
-
isPreferred
Checks whether the given extension is preferred wrt. this theory.- Parameters:
e- some extension- Returns:
- "true" iff the extension is preferred.
-
isComplete
Checks whether the given extension is complete wrt. this theory.- Parameters:
e- some extension- Returns:
- "true" iff the extension is complete.
-
faf
The characteristic function of an abstract argumentation framework: F_AF(S) = {A|A is acceptable wrt. S}.- Parameters:
extension- an extension (a set of arguments).- Returns:
- an extension (a set of arguments).
-
isAttackedBy
-
isIndirectAttack
-
isSupport
-
isAttackBranch
-
isDefenseBranch
-
hasAttackBranch
If this graph is acyclic, this method checks if the given argument has an attack branch, i.e. if it is (indirectly) attacked by a non-attacked argument.- Parameters:
a- an Argument- Returns:
- true iff this graph is acyclic and a has an attack branch, false otherwise
-
hasDefenseBranch
If this graph is acyclic, this method checks if the given argument has a defense branch, i.e. if it is supported by a non-attacked argument.- Parameters:
a- an Argument- Returns:
- true iff this graph is acyclic and a has a defense branch, false otherwise
-
getUndefendedAttacks
Returns the set of attacks (b,a) such that a is in ext and there is no c in ext such that (c,b) is an attack.- Parameters:
ext- some set of arguments.- Returns:
- the set of attacks (b,a) such that a is in ext and there is no c in ext such that (c,b) is an attack.
-
getUnattackedAttackers
Returns the set of arguments b such that a is in ext and there is no c in ext such that (c,b) is an attack.- Parameters:
ext- some set of arguments.- Returns:
- the set of arguments b such that a is in ext and there is no c in ext such that (c,b) is an attack.
-
prettyPrint
-
toString
- Specified by:
toStringin interfaceBeliefBase- Specified by:
toStringin interfaceGraph<Argument>- Overrides:
toStringin classBeliefSet<Argument, DungSignature>
-
add
Adds the given attack to this dung theory.- Parameters:
attack- an attack- Returns:
- "true" if the set of attacks has been modified.
-
add
Adds the given attacks to this dung theory.- Parameters:
attacks- some attacks- Returns:
- "true" if the set of attacks has been modified.
-
addAttack
-
remove
Removes the given attack from this Dung theory.- Parameters:
attack- an attack- Returns:
- "true" if the set of attacks has been modified.
-
remove
Removes the argument and all its attacks- Parameters:
a- some argument- Returns:
- true if this structure has been changed
-
removeAll
- Specified by:
removeAllin interfaceCollection<Argument>- Overrides:
removeAllin classBeliefSet<Argument, DungSignature>
-
contains
Description copied from interface:GraphReturns "true" when this graph contains the given node or edge.- Specified by:
containsin interfaceCollection<Argument>- Specified by:
containsin interfaceGraph<Argument>- Overrides:
containsin classBeliefSet<Argument, DungSignature>- Parameters:
o- an object- Returns:
- "true" if this graph contains the given node or edge.
-
containsAll
Description copied from interface:ArgumentationFrameworkChecks if the argumentation framework contains all the elements in the given collection.- Specified by:
containsAllin interfaceArgumentationFramework<Argument>- Specified by:
containsAllin interfaceCollection<Argument>- Overrides:
containsAllin classBeliefSet<Argument, DungSignature>- Parameters:
c- the collection of elements to be checked for containment.- Returns:
- true if this framework contains all elements in the specified collection, false otherwise.
-
containsAttack
Checks whether this theory contains the given attack.- Parameters:
att- some attack- Returns:
- "true" iff this theory contains the given attack.
-
addAllAttacks
Adds the set of attacks to this Dung theory.- Parameters:
c- a collection of attacks- Returns:
- "true" if this Dung theory has been modified.
-
add
Adds all arguments and attacks of the given theory to this theory- Parameters:
theory- some Dung theory- Returns:
- "true" if this Dung Theory has been modified
-
add
Description copied from interface:GraphAdds the given node to this graph.- Specified by:
addin interfaceCollection<Argument>- Specified by:
addin interfaceGraph<Argument>- Overrides:
addin classBeliefSet<Argument, DungSignature>- Parameters:
argument- some node.- Returns:
- "true" iff the edge has been added successfully.
-
getAttacks
-
getBidirectionalAttacks
-
getRestriction
Description copied from interface:GeneralGraphReturns a copy of this graph that contains only the specified nodes and all corresponding edges between them.This method generates a subgraph (or restricted graph) from the current graph by including only the given nodes and the edges that connect them. The returned graph is a new instance and does not modify the original graph.
- Specified by:
getRestrictionin interfaceGeneralGraph<Argument>- Parameters:
arguments- a collection of nodes to be included in the restricted graph.- Returns:
- a `GeneralGraph` object representing the restricted graph.
-
getReduct
computes the reduct of bbase wrt. ext ie. removes all arguments from bbase which are either in ext or are attacked by any element of ext- Parameters:
arguments- the arguments- Returns:
- the reduct
-
getReduct
computes the reduct of this wrt. arg ie. removes arg and all arguments attacked by arg- Parameters:
arg- some argument- Returns:
- the reduct
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<Argument>- Overrides:
hashCodein classBeliefSet<Argument, DungSignature>
-
equals
- Specified by:
equalsin interfaceCollection<Argument>- Overrides:
equalsin classBeliefSet<Argument, DungSignature>
-
add
Description copied from interface:GraphAdds the given edge to this graph. If at least one of the nodes the given edge connects is not in the graph, an illegal argument exception is thrown. -
getNodes
Description copied from interface:GraphReturns the nodes of this graph.- Specified by:
getNodesin interfaceArgumentationFramework<Argument>- Specified by:
getNodesin interfaceGeneralGraph<Argument>- Specified by:
getNodesin interfaceGraph<Argument>- Returns:
- the nodes of this graph.
-
getNumberOfNodes
public int getNumberOfNodes()Description copied from interface:GraphReturns the number of nodes in this graph.- Specified by:
getNumberOfNodesin interfaceGraph<Argument>- Returns:
- the number of nodes in this graph.
-
areAdjacent
Description copied from interface:GraphReturns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.- Specified by:
areAdjacentin interfaceGraph<Argument>- Parameters:
a- some nodeb- some node- Returns:
- "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
-
getEdges
Description copied from interface:GraphReturns the edges of this graph. -
getChildren
Description copied from interface:GraphReturns the set of children (node connected via an undirected edge or a directed edge where the given node is the parent) of the given node.- Specified by:
getChildrenin interfaceGraph<Argument>- Parameters:
node- some node (must be in the graph).- Returns:
- the set of children of the given node.
-
getParents
Description copied from interface:GraphReturns the set of parents (node connected via an undirected edge or a directed edge where the given node is the child) of the given node.- Specified by:
getParentsin interfaceGraph<Argument>- Parameters:
node- some node (must be in the graph).- Returns:
- the set of parents of the given node.
-
existsDirectedPath
Description copied from interface:GraphChecks whether there is a (directed) path from node1 to node2.- Specified by:
existsDirectedPathin interfaceGraph<Argument>- Parameters:
node1- some node.node2- some node.- Returns:
- "true" if there is a directed path from node1 to node2.
-
getNeighbors
Description copied from interface:GraphReturns the set of neighbors of the given node.- Specified by:
getNeighborsin interfaceGraph<Argument>- Parameters:
node- some node (must be in the graph).- Returns:
- the set of neighbors of the given node.
-
getAdjacencyMatrix
Description copied from interface:GraphReturns the adjacency matrix of this graph (the order of the nodes is the same as returned by "iterator()").- Specified by:
getAdjacencyMatrixin interfaceGraph<Argument>- Returns:
- the adjacency matrix of this graph
-
getComplementGraph
Description copied from interface:GraphReturns the complement graph of this graph, i.e. the graph on the same set of vertices as this graph that connects two vertices v and w with an edge if and only if v and w are not connected in this graph.- Specified by:
getComplementGraphin interfaceGraph<Argument>- Parameters:
selfloops- Indicates how to deal with selfloops:
IGNORE_SELFLOOPS - ignore self loops (don't add and don't remove)
INVERT_SELFLOOPS - deal with self loops like ordinary edges (add if not present and remove if present)
REMOVE_SELFLOOPS - simple remove self loops, but don't add new ones.- Returns:
- the complement graph of this graph.
-
hasSelfLoops
public boolean hasSelfLoops()Description copied from interface:GraphReturns "true" iff the graph has a self loop (an edge from a node to itself).- Specified by:
hasSelfLoopsin interfaceGraph<Argument>- Returns:
- "true" iff the graph has a self loop (an edge from a node to itself).
-
getEdge
Description copied from interface:GraphReturns the corresponding edge (a,b) if a and b are adjacent. Otherwise it returns null. -
isWeightedGraph
public boolean isWeightedGraph()Description copied from interface:GraphChecks whether this graph only contains weighted edges.- Specified by:
isWeightedGraphin interfaceGraph<Argument>- Returns:
- "true" if all edges are weighted in this graph.
-
getConnectedComponents
Description copied from interface:GraphReturns the set of (simple) connected components of this graph. A set of nodes is connected, if there is some path (ignoring edge directions) from each node to each other. It is a connected component if it is connected and maximal wrt. set inclusion.- Specified by:
getConnectedComponentsin interfaceGraph<Argument>- Returns:
- the connected components of this graph.
-
getStronglyConnectedComponents
Description copied from interface:GraphReturns the strongly connected components of this graph. A set of nodes is strongly connected, if there is a path from each node to each other. A set of nodes is called strongly connected component if it is strongly connected and maximal with respect to set inclusion.- Specified by:
getStronglyConnectedComponentsin interfaceGraph<Argument>- Returns:
- the strongly connected components of this graph.
-
getSubgraphs
Description copied from interface:GraphReturns the set of sub graphs of this graph.- Specified by:
getSubgraphsin interfaceGraph<Argument>- Returns:
- the set of sub graphs of this graph.
-
compareTo
- Specified by:
compareToin interfaceComparable<DungTheory>
-
containsCycle
Checks whether there is at least one cycle in this DungTheory.- Type Parameters:
S- the type of nodes- Returns:
- "true" if there is a cycle in this DungTheory, "false" otherwise
-
containsOddCycle
Checks whether there is at least on eodd cycle in this DungTheory. A directed graph has an odd-length cycle if and only if at least one of its SCCs is non-bipartite- Type Parameters:
S- the type of nodes- Returns:
- "true" if there is a cycle with odd length in this theory
-
getComponents
- Returns:
- DefaultGraph
-
getInducedSubgraphs
- Returns:
- DefaultGraph
-
equalsIn
Method to check if an equal object to this object is contained in the specified set- Parameters:
setOfEquals- Set of object of the same class- Returns:
- TRUE iff an equal object is contained in the specified set
-
getNumberOfEdges
public int getNumberOfEdges()Description copied from interface:GraphReturns the number of edges in this graph.- Specified by:
getNumberOfEdgesin interfaceGraph<Argument>- Returns:
- the number of edges in this graph.
-