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, ExecutableDungTheory, IncompleteTheory, ProbabilisticArgumentationFramework, SocialAbstractArgumentationFramework, StructuredArgumentationFramework, WeightedDungTheory

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
Author:
Matthias Thimm, Tjitze Rienstra
  • Constructor Details

    • DungTheory

      public DungTheory()
      Default constructor; initializes empty sets of arguments and attacks
    • DungTheory

      public DungTheory(Graph<Argument> graph)
      Creates a new theory from the given graph.
      Parameters:
      graph - some graph
  • Method Details

    • clone

      public DungTheory clone()
    • getMinimalSignature

      public Signature getMinimalSignature()
      Description copied from interface: BeliefBase
      Returns the signature of the language of this knowledge base.
      Specified by:
      getMinimalSignature in interface BeliefBase
      Returns:
      the signature of the language of this knowledge base.
    • isAttackingAllOtherArguments

      public boolean isAttackingAllOtherArguments(Extension<? extends ArgumentationFramework<Argument>> ext)
      returns true if arguments attack all other arguments in the theory
      Parameters:
      ext - An extension contains a set of arguments.
      Returns:
      true if arguments attack 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

      public boolean isAcceptable(Argument argument, Extension<DungTheory> ext)
      returns true if every attacker on argument is attacked by some accepted argument wrt. the given theory.
      Parameters:
      argument - an argument
      ext - an extension (the knowledge base)
      Returns:
      true if every attacker on argument is attacked by some accepted argument wrt. the given theory.
    • isConflictFree

      public boolean isConflictFree(Extension<DungTheory> ext)
      Parameters:
      ext - parameter
      Returns:
      isConflictFree
    • isAdmissable

      public boolean isAdmissable(Extension<DungTheory> ext)
      Parameters:
      ext - parameter
      Returns:
      isAdmissable
    • 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

      public Set<Argument> getAttackers(Argument argument)
      Computes the set {A | (A,argument) in attacks}.
      Parameters:
      argument - an argument
      Returns:
      the set of all arguments that attack argument.
    • getAttackers

      public Collection<Argument> getAttackers(Collection<Argument> args)
      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

      public Set<Argument> getAttacked(Argument argument)
      Computes the set {A | (argument,A) in attacks}.
      Parameters:
      argument - an argument
      Returns:
      the set of all arguments that are attacked by argument.
    • getAttacked

      public Collection<Argument> getAttacked(Collection<Argument> args)
      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

      public boolean isAttacked(Argument argument, Extension<? extends ArgumentationFramework> ext)
      returns true if some argument of ext attacks argument.
      Specified by:
      isAttacked in interface ArgumentationFramework<Argument>
      Parameters:
      argument - an argument
      ext - an extension, ie. a set of arguments
      Returns:
      true if some argument of ext attacks argument.
    • isAttackedBy

      public boolean isAttackedBy(Argument argument, Collection<Argument> ext)
      returns true if some argument of ext is attacked by argument.
      Parameters:
      argument - an argument
      ext - an extension, ie. a set of arguments
      Returns:
      true if some argument of ext is attacked by argument.
    • isAttacked

      public boolean isAttacked(Extension<DungTheory> ext1, Extension<DungTheory> ext2)
      returns true if some argument of ext2 attacks some argument in ext1
      Parameters:
      ext1 - an extension, ie. a set of arguments
      ext2 - an extension, ie. a set of arguments
      Returns:
      true if some argument of ext2 attacks some argument in ext1
    • isStable

      public boolean isStable(Extension<DungTheory> e)
      Checks whether the given extension is stable wrt. this theory.
      Parameters:
      e - some extension
      Returns:
      "true" iff the extension is stable.
    • faf

      public Extension<DungTheory> faf(Extension<DungTheory> extension)
      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

      public boolean isAttackedBy(Argument arg1, Argument arg2)
      Checks whether arg1 is attacked by arg2.
      Parameters:
      arg1 - an argument.
      arg2 - an argument.
      Returns:
      "true" if arg1 is attacked by arg2
    • isIndirectAttack

      public boolean isIndirectAttack(Argument arg1, Argument arg2)
      Checks whether "arg1" indirectly attacks "arg2", i.e. whether there is an odd-length path from "arg1" to "arg2".
      Parameters:
      arg1 - an AbstractArgument.
      arg2 - an AbstractArgument.
      Returns:
      "true" iff "arg1" indirectly attacks "arg2".
    • isSupport

      public boolean isSupport(Argument arg1, Argument arg2)
      Checks whether "arg1" supports "arg2", i.e. whether there is an even-length path from "arg1" to "arg2".
      Parameters:
      arg1 - an AbstractArgument.
      arg2 - an AbstractArgument.
      Returns:
      "true" iff "arg1" supports "arg2".
    • isAttackBranch

      public boolean isAttackBranch(Argument a, Argument b)
      Checks whether the path from b to a is an attack branch, i.e. whether b is a non-attacked (indirect) attacker of a.
      Parameters:
      a - an Argument
      b - an Argument
      Returns:
      true iff the path from a to b is an attack branch, false otherwise
    • isDefenseBranch

      public boolean isDefenseBranch(Argument a, Argument b)
      Checks whether the path from b to a is a defense branch, i.e. whether b is a non-attacked (indirect) defender of a.
      Parameters:
      a - an Argument
      b - an Argument
      Returns:
      true iff the path from a to b is a defense branch, false otherwise
    • hasAttackBranch

      public boolean hasAttackBranch(Argument a)
      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

      public boolean hasDefenseBranch(Argument a)
      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
    • prettyPrint

      public String prettyPrint()
      Pretty print of the theory.
      Returns:
      the pretty print of the theory.
    • toString

      public String toString()
      Specified by:
      toString in interface BeliefBase
      Specified by:
      toString in interface Graph<Argument>
      Overrides:
      toString in class BeliefSet<Argument,DungSignature>
    • add

      public boolean add(Attack attack)
      Adds the given attack to this dung theory.
      Parameters:
      attack - an attack
      Returns:
      "true" if the set of attacks has been modified.
    • add

      public boolean add(Attack... attacks)
      Adds the given attacks to this dung theory.
      Parameters:
      attacks - some attacks
      Returns:
      "true" if the set of attacks has been modified.
    • addAttack

      public boolean addAttack(Argument attacker, Argument attacked)
      Adds an attack from the first argument to the second to thisDdung theory.
      Parameters:
      attacker - some argument
      attacked - some argument
      Returns:
      "true" if the set of attacks has been modified.
    • remove

      public boolean remove(Attack attack)
      Removes the given attack from this Dung theory.
      Parameters:
      attack - an attack
      Returns:
      "true" if the set of attacks has been modified.
    • remove

      public boolean remove(Argument a)
      Removes the argument and all its attacks
      Parameters:
      a - some argument
      Returns:
      true if this structure has been changed
    • removeAll

      public boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<Argument>
      Overrides:
      removeAll in class BeliefSet<Argument,DungSignature>
    • contains

      public boolean contains(Object o)
      Description copied from interface: Graph
      Returns "true" when this graph contains the given node or edge.
      Specified by:
      contains in interface Collection<Argument>
      Specified by:
      contains in interface Graph<Argument>
      Overrides:
      contains in class BeliefSet<Argument,DungSignature>
      Parameters:
      o - an object
      Returns:
      "true" if this graph contains the given node or edge.
    • containsAll

      public boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface ArgumentationFramework<Argument>
      Specified by:
      containsAll in interface Collection<Argument>
      Overrides:
      containsAll in class BeliefSet<Argument,DungSignature>
      Parameters:
      c - parameter
      Returns:
      containsAll
    • containsAttack

      public boolean containsAttack(Attack att)
      Checks whether this theory contains the given attack.
      Parameters:
      att - some attack
      Returns:
      "true" iff this theory contains the given attack.
    • addAllAttacks

      public boolean addAllAttacks(Collection<? extends Attack> c)
      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

      public boolean add(DungTheory theory)
      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

      public boolean add(Argument argument)
      Description copied from interface: Graph
      Adds the given node to this graph.
      Specified by:
      add in interface Collection<Argument>
      Specified by:
      add in interface Graph<Argument>
      Overrides:
      add in class BeliefSet<Argument,DungSignature>
      Parameters:
      argument - some node.
      Returns:
      "true" iff the edge has been added successfully.
    • getAttacks

      public Set<Attack> getAttacks()
      Returns all attacks of this theory.
      Returns:
      all attacks of this theory.
    • getBidirectionalAttacks

      public Set<Attack> getBidirectionalAttacks()
      Returns all bidirectional attacks of this theory.
      Returns:
      all bidirectional attacks of this theory.
    • getRestriction

      public Graph<Argument> getRestriction(Collection<Argument> arguments)
      Description copied from interface: GeneralGraph
      Returns copy of this graph consisting only of the given nodes and all corresponding edges.
      Specified by:
      getRestriction in interface GeneralGraph<Argument>
      Parameters:
      arguments - a set of nodes
      Returns:
      a graph.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<Argument>
      Overrides:
      hashCode in class BeliefSet<Argument,DungSignature>
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Collection<Argument>
      Overrides:
      equals in class BeliefSet<Argument,DungSignature>
    • add

      public boolean add(GeneralEdge<Argument> edge)
      Description copied from interface: Graph
      Adds 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.
      Specified by:
      add in interface Graph<Argument>
      Parameters:
      edge - some edge.
      Returns:
      "true" iff the edge has been added successfully.
    • getNodes

      public Collection<Argument> getNodes()
      Description copied from interface: Graph
      Returns the nodes of this graph.
      Specified by:
      getNodes in interface ArgumentationFramework<Argument>
      Specified by:
      getNodes in interface GeneralGraph<Argument>
      Specified by:
      getNodes in interface Graph<Argument>
      Returns:
      the nodes of this graph.
    • getNumberOfNodes

      public int getNumberOfNodes()
      Description copied from interface: Graph
      Returns the number of nodes in this graph.
      Specified by:
      getNumberOfNodes in interface Graph<Argument>
      Returns:
      the number of nodes in this graph.
    • areAdjacent

      public boolean areAdjacent(Argument a, Argument b)
      Description copied from interface: Graph
      Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
      Specified by:
      areAdjacent in interface Graph<Argument>
      Parameters:
      a - some node
      b - some node
      Returns:
      "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
    • getEdges

      public Collection<? extends Edge<? extends Argument>> getEdges()
      Description copied from interface: Graph
      Returns the edges of this graph.
      Specified by:
      getEdges in interface GeneralGraph<Argument>
      Specified by:
      getEdges in interface Graph<Argument>
      Returns:
      the edges of this graph.
    • getChildren

      public Collection<Argument> getChildren(Node node)
      Description copied from interface: Graph
      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.
      Specified by:
      getChildren in interface Graph<Argument>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of children of the given node.
    • getParents

      public Collection<Argument> getParents(Node node)
      Description copied from interface: Graph
      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.
      Specified by:
      getParents in interface Graph<Argument>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of parents of the given node.
    • existsDirectedPath

      public boolean existsDirectedPath(Argument node1, Argument node2)
      Description copied from interface: Graph
      Checks whether there is a (directed) path from node1 to node2.
      Specified by:
      existsDirectedPath in interface Graph<Argument>
      Parameters:
      node1 - some node.
      node2 - some node.
      Returns:
      "true" if there is a directed path from node1 to node2.
    • getNeighbors

      public Collection<Argument> getNeighbors(Argument node)
      Description copied from interface: Graph
      Returns the set of neighbors of the given node.
      Specified by:
      getNeighbors in interface Graph<Argument>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of neighbors of the given node.
    • getAdjacencyMatrix

      public Matrix getAdjacencyMatrix()
      Description copied from interface: Graph
      Returns the adjacency matrix of this graph (the order of the nodes is the same as returned by "iterator()").
      Specified by:
      getAdjacencyMatrix in interface Graph<Argument>
      Returns:
      the adjacency matrix of this graph
    • getComplementGraph

      public DungTheory getComplementGraph(int selfloops)
      Description copied from interface: Graph
      Returns 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:
      getComplementGraph in interface Graph<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: Graph
      Returns "true" iff the graph has a self loop (an edge from a node to itself).
      Specified by:
      hasSelfLoops in interface Graph<Argument>
      Returns:
      "true" iff the graph has a self loop (an edge from a node to itself).
    • getEdge

      public Edge<Argument> getEdge(Argument a, Argument b)
      Description copied from interface: Graph
      Returns the corresponding edge (a,b) if a and b are adjacent. Otherwise it returns null.
      Specified by:
      getEdge in interface Graph<Argument>
      Parameters:
      a - some node
      b - some node
      Returns:
      the edge (a,b) or null.
    • isWeightedGraph

      public boolean isWeightedGraph()
      Description copied from interface: Graph
      Checks whether this graph only contains weighted edges.
      Specified by:
      isWeightedGraph in interface Graph<Argument>
      Returns:
      "true" if all edges are weighted in this graph.
    • getStronglyConnectedComponents

      public Collection<Collection<Argument>> getStronglyConnectedComponents()
      Description copied from interface: Graph
      Returns 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:
      getStronglyConnectedComponents in interface Graph<Argument>
      Returns:
      the strongly connected components of this graph.
    • getSubgraphs

      public Collection<Graph<Argument>> getSubgraphs()
      Description copied from interface: Graph
      Returns the set of sub graphs of this graph.
      Specified by:
      getSubgraphs in interface Graph<Argument>
      Returns:
      the set of sub graphs of this graph.
    • compareTo

      public int compareTo(DungTheory o)
      Specified by:
      compareTo in interface Comparable<DungTheory>
    • containsCycle

      public <S extends Node> boolean 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

      public <S extends Node> boolean 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

      public Collection<Graph<Argument>> getComponents()
      Returns:
      DefaultGraph
    • getInducedSubgraphs

      public Collection<Graph<Argument>> getInducedSubgraphs()
      Returns:
      DefaultGraph