Class DungTheory

  • All Implemented Interfaces:
    Comparable<DungTheory>, Iterable<Argument>, Collection<Argument>, net.sf.tweety.commons.BeliefBase, net.sf.tweety.graphs.Graph<Argument>

    public class DungTheory
    extends net.sf.tweety.commons.BeliefSet<Argument,​DungSignature>
    implements net.sf.tweety.graphs.Graph<Argument>, Comparable<DungTheory>
    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 Detail

      • DungTheory

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

        public DungTheory​(net.sf.tweety.graphs.Graph<Argument> graph)
        Creates a new theory from the given graph.
        Parameters:
        graph - some graph
    • Method Detail

      • getMinimalSignature

        public net.sf.tweety.commons.Signature getMinimalSignature()
        Specified by:
        getMinimalSignature in interface net.sf.tweety.commons.BeliefBase
      • isAttackingAllOtherArguments

        public boolean isAttackingAllOtherArguments​(Extension 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
      • 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.
      • 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.
      • isAttacked

        public boolean isAttacked​(Argument argument,
                                  Extension ext)
        returns true if some argument of ext attacks 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 ext1,
                                  Extension 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 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 faf​(Extension 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 net.sf.tweety.commons.BeliefBase
        Specified by:
        toString in interface net.sf.tweety.graphs.Graph<Argument>
        Overrides:
        toString in class net.sf.tweety.commons.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.
      • 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
      • 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
      • getAttacks

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

        public net.sf.tweety.graphs.Graph<Argument> getRestriction​(Collection<Argument> arguments)
        Specified by:
        getRestriction in interface net.sf.tweety.graphs.Graph<Argument>
      • add

        public boolean add​(net.sf.tweety.graphs.Edge<Argument> edge)
        Specified by:
        add in interface net.sf.tweety.graphs.Graph<Argument>
      • getNumberOfNodes

        public int getNumberOfNodes()
        Specified by:
        getNumberOfNodes in interface net.sf.tweety.graphs.Graph<Argument>
      • areAdjacent

        public boolean areAdjacent​(Argument a,
                                   Argument b)
        Specified by:
        areAdjacent in interface net.sf.tweety.graphs.Graph<Argument>
      • getEdges

        public Collection<? extends net.sf.tweety.graphs.Edge<? extends Argument>> getEdges()
        Specified by:
        getEdges in interface net.sf.tweety.graphs.Graph<Argument>
      • getChildren

        public Collection<Argument> getChildren​(net.sf.tweety.graphs.Node node)
        Specified by:
        getChildren in interface net.sf.tweety.graphs.Graph<Argument>
      • getParents

        public Collection<Argument> getParents​(net.sf.tweety.graphs.Node node)
        Specified by:
        getParents in interface net.sf.tweety.graphs.Graph<Argument>
      • existsDirectedPath

        public boolean existsDirectedPath​(Argument node1,
                                          Argument node2)
        Specified by:
        existsDirectedPath in interface net.sf.tweety.graphs.Graph<Argument>
      • getAdjacencyMatrix

        public net.sf.tweety.math.matrix.Matrix getAdjacencyMatrix()
        Specified by:
        getAdjacencyMatrix in interface net.sf.tweety.graphs.Graph<Argument>
      • getComplementGraph

        public DungTheory getComplementGraph​(int selfloops)
        Specified by:
        getComplementGraph in interface net.sf.tweety.graphs.Graph<Argument>
      • hasSelfLoops

        public boolean hasSelfLoops()
        Specified by:
        hasSelfLoops in interface net.sf.tweety.graphs.Graph<Argument>
      • getEdge

        public net.sf.tweety.graphs.Edge<Argument> getEdge​(Argument a,
                                                           Argument b)
        Specified by:
        getEdge in interface net.sf.tweety.graphs.Graph<Argument>
      • isWeightedGraph

        public boolean isWeightedGraph()
        Specified by:
        isWeightedGraph in interface net.sf.tweety.graphs.Graph<Argument>
      • getStronglyConnectedComponents

        public Collection<Collection<Argument>> getStronglyConnectedComponents()
        Specified by:
        getStronglyConnectedComponents in interface net.sf.tweety.graphs.Graph<Argument>
      • getSubgraphs

        public Collection<net.sf.tweety.graphs.Graph<Argument>> getSubgraphs()
        Specified by:
        getSubgraphs in interface net.sf.tweety.graphs.Graph<Argument>
      • instantiateSignature

        protected DungSignature instantiateSignature()
        Specified by:
        instantiateSignature in class net.sf.tweety.commons.BeliefSet<Argument,​DungSignature>
      • containsCycle

        public <S extends net.sf.tweety.graphs.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
      • getComponents

        public Collection<net.sf.tweety.graphs.Graph<Argument>> getComponents()
        Returns the (connected) components of the theory
        Returns:
        the (connected) components of the theory