Class WeightedArgumentationFramework<T>

java.lang.Object
org.tweetyproject.commons.BeliefSet<Argument,DungSignature>
org.tweetyproject.arg.dung.syntax.DungTheory
org.tweetyproject.arg.weighted.syntax.WeightedArgumentationFramework<T>
Type Parameters:
T - Type
All Implemented Interfaces:
Comparable<DungTheory>, Iterable<Argument>, Collection<Argument>, ArgumentationFramework<Argument>, BeliefBase, GeneralGraph<Argument>, Graph<Argument>

public class WeightedArgumentationFramework<T> extends DungTheory
This class implements a weighted abstract argumentation theory (WAF) using a C-Semiring.

See

Bistarelli et al. "A novel weighted defence and its relaxation in abstract argumentation." International Journal of Approximate Reasoning 92 (2018): 66-86.
Author:
Sandra Hoffmann
  • Constructor Details

    • WeightedArgumentationFramework

      public WeightedArgumentationFramework()
      default constructor returns classic Dung style AF using a Boolean Semiring
    • WeightedArgumentationFramework

      public WeightedArgumentationFramework(Semiring<T> semiring)
      Constructor for WAF with specific Semiring
      Parameters:
      semiring - The semiring used to model the weights
    • WeightedArgumentationFramework

      public WeightedArgumentationFramework(Semiring<T> semiring, Graph<Argument> graph)
      Constructor for WAF from a graph with a specific Semiring. The weights will be initialized to the zeroElement of the Semiring.
      Parameters:
      semiring - The semiring used to model the weights
      graph - The graph representing the argumentation framework.
    • WeightedArgumentationFramework

      public WeightedArgumentationFramework(Semiring<T> semiring, Graph<Argument> graph, Map<String,T> weightMap)
      Constructs a Weighted Argumentation Framework using the specified semiring, graph, and weight map.
      Parameters:
      semiring - The semiring used to model the weights
      graph - The graph representing the argumentation framework.
      weightMap - A map associating argument identifiers (as strings) with their corresponding weights.
  • Method Details

    • clone

      Overrides:
      clone in class DungTheory
    • add

      public boolean add(Attack attack)
      Adds the given attack to this weighted Dung theory. The weight will be set to the strongest Attack (zeroElement) of the Semiring.
      Overrides:
      add in class DungTheory
      Parameters:
      attack - an attack
      Returns:
      true if the set of attacks has been modified.
    • add

      public boolean add(Attack attack, T weight)
      Adds the given attack to this weighted Dung theory.
      Parameters:
      attack - an attack
      weight - the weight for this 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. The weights will be set to the strongest Attack (zeroElement) of the Semiring.
      Overrides:
      add in class DungTheory
      Parameters:
      attacks - some attacks
      Returns:
      true if the set of attacks has been modified.
    • add

      public boolean add(Map<String,T> weights)
      Adds the given attacks to this dung theory.
      Parameters:
      weights - a map containing the attacks as key and the weights as values.
      Returns:
      true if the set of attacks has been modified.
    • add

      public boolean add(DungTheory theory)
      Adds all arguments and attacks of the given theory to this theory. The weights will be set to the strongest Attack (zeroElement) of the Semiring.
      Overrides:
      add in class DungTheory
      Parameters:
      theory - some Dung theory
      Returns:
      true if this Weighted Dung Theory has been modified
    • addAttack

      public boolean addAttack(Attack attack)
      Adds the given attack to this weighted Dung theory. The weight will be set to the strongest Attack (zeroElement) of the Semiring.
      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 this weighted Dung theory. The weight will be set to the strongest Attack (zeroElement) of the Semiring.
      Overrides:
      addAttack in class DungTheory
      Parameters:
      attacker - some argument
      attacked - some argument
      Returns:
      true if the set of attacks has been modified.
    • addAttack

      public boolean addAttack(Argument attacker, Argument attacked, T weight)
      Adds an attack from the first argument to the second to this weighted Dung theory.
      Parameters:
      attacker - some argument
      attacked - some argument
      weight - the weight
      Returns:
      true if the set of attacks has been modified.
    • addAllAttacks

      public boolean addAllAttacks(Collection<? extends Attack> c)
      Adds the set of attacks to this Weighted Dung theory. The weights will be set to the strongest Attack (zeroElement) of the Semiring.
      Overrides:
      addAllAttacks in class DungTheory
      Parameters:
      c - a collection of attacks
      Returns:
      true if this Dung theory has been modified.
    • addAllAttacks

      public boolean addAllAttacks(Map<String,T> weights)
      Adds the set of attacks to this Weighted Dung theory.
      Parameters:
      weights - a map containing the attacks as key and the weights as values.
      Returns:
      true if this Dung theory has been modified.
    • remove

      public boolean remove(Attack attack)
      Removes the given attack from this weighted Dung theory.
      Overrides:
      remove in class DungTheory
      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 and the corresponding weights
      Overrides:
      remove in class DungTheory
      Parameters:
      a - some argument
      Returns:
      true if this structure has been changed
    • strongerAttack

      public Attack strongerAttack(Attack attackA, Attack attackB)
      Determines the stronger attack between two given attacks based on their weights.
      Parameters:
      attackA - The first attack for comparison.
      attackB - The second attack for comparison.
      Returns:
      The stronger attack, considering their weights according to the specified semiring.
    • compareWeights

      public T compareWeights(Attack attackA, Attack attackB)
      Compares the weights of two attacks and returns the weight of the stronger attack.
      Parameters:
      attackA - The first attack for comparison.
      attackB - The second attack for comparison.
      Returns:
      The weight of the stronger attack.
    • isAcceptable

      public boolean isAcceptable(Argument argument, Extension<DungTheory> ext)
      returns true if every attacker on argument is successfully attacked by some accepted argument wrt. the given theory. This corresponds to the wDefence of argument.
      Overrides:
      isAcceptable in class DungTheory
      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.
    • wDefence

      public boolean wDefence(Extension<DungTheory> e)
      Determines if the given extension can defend itself from all attacks.
      Parameters:
      e - The extension to be checked for weighted defensibility.
      Returns:
      true if the extension can defend itself from all attacks.
    • wDefence

      public boolean wDefence(Argument a, Extension<DungTheory> e)
      Determines if the given extension can defend a specific argument from all attacks.
      Parameters:
      a - The argument to be defended.
      e - The extension to w-defend a.
      Returns:
      true if the extension can defend the argument from all attacks.
    • wDefence

      public boolean wDefence(Extension<DungTheory> e, Set<Argument> attackers)
      Determines if the given extension can defend itself from a set of attackers.
      Parameters:
      e - The extension to w-defend itself.
      attackers - The set of arguments representing attackers.
      Returns:
      true if the extension can defend itself from the specified attackers.
    • wDefence

      public boolean wDefence(Extension<DungTheory> e, Set<Argument> attackers, Set<Argument> attacked)
      Determines if the given extension can defend itself and specific arguments from a set of attackers.
      Parameters:
      e - The extension to w-defend itself and attacked.
      attackers - The set of arguments representing attackers.
      attacked - The set of arguments that need to be defended by e.
      Returns:
      true if the extension can defend itself and the specified arguments from the attackers.
    • gDefence

      public boolean gDefence(T gamma, Extension<DungTheory> e)
      Determines if the given extension can defend itself from all attacks up to a specified threshold gamma.
      Parameters:
      gamma - The threshold for defense, representing the maximum allowable difference between the attack and defense weights.
      e - The extension to g-defend itself.
      Returns:
      true if the extension can defend itself from all attacks within the specified threshold.
    • gDefence

      public boolean gDefence(T gamma, Argument a, Extension<DungTheory> e)
      Determines if the given extension can defend itself and argument a from all attacks up to a specified threshold gamma.
      Parameters:
      gamma - The threshold for defense, representing the maximum allowable difference between the attack and defense weights.
      a - The argument to be defended by e.
      e - The extension to g-defend itself.
      Returns:
      true if the extension can defend itself from all attacks within the specified threshold; false otherwise.
    • gDefence

      public boolean gDefence(T gamma, Extension<DungTheory> e, Set<Argument> attackers)
      Determines if the given extension can defend itself from a set of attackers up to a specified threshold gamma.
      Parameters:
      gamma - The threshold for defense, representing the maximum allowable difference between the attack and defense weights.
      e - The extension to g-defend itself.
      attackers - The set of arguments representing attackers.
      Returns:
      true if the extension can defend itself from the specified attackers within the specified threshold.
    • gDefence

      public boolean gDefence(T gamma, Extension<DungTheory> e, Set<Argument> attackers, Set<Argument> attacked)
      Determines if the given extension can defend itself and specific arguments from a set of attackers up to a specified threshold gamma.
      Parameters:
      gamma - he threshold for defense, representing the maximum allowable difference between the attack and defense weights.
      e - The extension to g-defend itself.
      attackers - The set of arguments representing attackers.
      attacked - The set of arguments that need to be defended by the extension.
      Returns:
      true if the extension can defend itself and the specified arguments from the attackers within the specified threshold.
    • isAttacked

      public boolean isAttacked(Argument argument, Extension<? extends ArgumentationFramework<?>> ext)
      returns true if some argument of ext attacks argument and argument cannot w-defend itself.
      Specified by:
      isAttacked in interface ArgumentationFramework<T>
      Overrides:
      isAttacked in class DungTheory
      Parameters:
      argument - an argument
      ext - an extension, ie. a set of arguments
      Returns:
      true if some argument of ext successfully attacks argument.
    • isAttackedBy

      public boolean isAttackedBy(Argument attacker, Collection<Argument> ext)
      returns true if some argument of ext is attacked by argument and cannot be w-defended by ext.
      Overrides:
      isAttackedBy in class DungTheory
      Parameters:
      attacker - 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 and ext1 cannot w-defend itself
      Overrides:
      isAttacked in class DungTheory
      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
    • isAttackedBy

      public boolean isAttackedBy(Argument arg1, Argument arg2)
      Checks whether arg1 is attacked by arg2 and cannot w-defend itself.
      Overrides:
      isAttackedBy in class DungTheory
      Parameters:
      arg1 - an argument.
      arg2 - an argument.
      Returns:
      true if arg1 is attacked by arg2
    • isAlphaConflictFree

      public boolean isAlphaConflictFree(T alpha, Extension<DungTheory> ext)
      Determines if the given extension is alpha-conflict-free.
      Parameters:
      alpha - The threshold representing the maximum allowable combined weight of internal attacks.
      ext - The extension to be checked for alpha-conflict-freeness.
      Returns:
      true if the extension is alpha-conflict-free.
    • isAlphaGammaAdmissible

      public boolean isAlphaGammaAdmissible(T alpha, T gamma, Extension<DungTheory> ext)
      Determines if the given extension is both alpha-conflict-free and gamma-defensible.
      Parameters:
      alpha - The threshold representing the maximum allowable combined weight of internal attacks.
      gamma - The threshold for defense, representing the maximum allowable difference between the aggregated weights of attack and defense.
      ext - The extension to be checked for alpha-gamma-admissibility.
      Returns:
      true if the extension is alpha-conflict-free and gamma-defensible.
    • isAlphaGammaComplete

      public boolean isAlphaGammaComplete(T alpha, T gamma, Extension<DungTheory> ext)
      Determines if the given extension is both alpha-gamma-complete.
      Parameters:
      alpha - The threshold representing the maximum allowable combined weight of internal attacks.
      gamma - The threshold for defense, representing the maximum allowable difference between the aggregated weights of attack and defense.
      ext - The extension to be checked for alpha-gamma-completeness.
      Returns:
      true if the extension is alpha-gamma-complete.
    • isAlphaGammaPreferred

      public boolean isAlphaGammaPreferred(T alpha, T gamma, Extension<DungTheory> ext)
      Determines if the given extension is alpha-gamma-preferred.
      Parameters:
      alpha - The threshold representing the maximum allowable combined weight of internal attacks.
      gamma - The threshold for defense, representing the maximum allowable difference between the aggregated weights of attack and defense.
      ext - The extension to be checked for alpha-gamma-preference.
      Returns:
      true if the extension is alpha-gamma-preferred.
    • isAlphaGammaStable

      public boolean isAlphaGammaStable(T alpha, T gamma, Extension<DungTheory> ext)
      Determines if the given extension is alpha-gamma-stable.
      Parameters:
      alpha - The threshold representing the maximum allowable combined weight of internal attacks.
      gamma - The threshold for defense, representing the maximum allowable difference between the aggregated weights of attack and defense.
      ext - The extension to be checked for alpha-gamma-stability.
      Returns:
      true if the extension is alpha-gamma-stable.
    • isSMA

      public boolean isSMA(Extension<DungTheory> attacker, Extension<DungTheory> attacked)
      Determines whether the given attacker Extension is a set-maximal attack on the attacked Extension.
      Parameters:
      attacker - The set to be checked for set-maximal attack.
      attacked - The set that is potentially being attacked.
      Returns:
      true if the attacker is a set-maximal attack on the attacked set, false otherwise.
    • isWellFounded

      public boolean isWellFounded()
      returns true iff the theory is well-founded, i.e., there is no infinite sequence A1,A2,... of SMAs with Ai+1 w-defending Ai
      Overrides:
      isWellFounded in class DungTheory
      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
      Overrides:
      isCoherent in class DungTheory
      Returns:
      true if the theory is coherent
    • isCoherent

      public boolean isCoherent(T alpha, T gamma)
      Determines if the theory is coherent, i.e., if each alpha gamma preferred extension is stable
      Parameters:
      alpha - the alpha value
      gamma - the gammavalue
      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
      Overrides:
      isRelativelyCoherent in class DungTheory
      Returns:
      true if the theory is relatively coherent
    • isRelativelyCoherent

      public boolean isRelativelyCoherent(T alpha, T gamma)
      Determines if the theory is relatively coherent, i.e., if the alpha gamma grounded extension coincides with the intersection of all alpha gamma preferred extensions
      Parameters:
      alpha - the alpha value
      gamma - the gammavalue
      Returns:
      true if the theory is relatively coherent
    • setWeight

      public void setWeight(Attack attack, T weight)
      Sets the weight of a given attack in the framework.
      Parameters:
      attack - The attack for which the weight is to be set.
      weight - The weight to be set.
    • setWeight

      public void setWeight(Argument attacker, Argument attacked, T weight)
      Sets the weight of an attack between the specified attacker and attacked arguments in the framework.
      Parameters:
      attacker - The attacking argument.
      attacked - The attacked argument.
      weight - The weight to be set.
    • getWeight

      public T getWeight(Attack attack)
      Retrieves the weight of a given attack in the framework.
      Parameters:
      attack - The attack for which the weight is retrieved.
      Returns:
      The weight of the specified attack.
    • getWeights

      public Map<String,T> getWeights()
      Retrieves all weights in the framework.
      Returns:
      A map containing the weights of all attacks.
    • getNumericWeight

      public double getNumericWeight(Attack attack)
      Retrieves the numeric value of the weight associated with a given attack in the framework.
      Parameters:
      attack - The attack for which the numeric weight is retrieved.
      Returns:
      The numeric value of the weight of the specified attack.
    • getSemiring

      public Semiring<T> getSemiring()
      Retrieves the semiring used in the framework.
      Returns:
      The semiring associated with the framework.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<T>
      Overrides:
      hashCode in class DungTheory
    • isWeightedGraph

      public boolean isWeightedGraph()
      Indicates whether the framework is weighted.
      Specified by:
      isWeightedGraph in interface Graph<T>
      Overrides:
      isWeightedGraph in class DungTheory
      Returns:
      true
    • isSupport

      public boolean isSupport(Argument arg1, Argument arg2)
      Checks whether "arg1" supports "arg2", i.e. whether there is a path of supporting arguments between "arg1" and "arg2".
      Overrides:
      isSupport in class DungTheory
      Parameters:
      arg1 - an AbstractArgument.
      arg2 - an AbstractArgument.
      Returns:
      "true" iff "arg1" supports "arg2".
    • getDefendedArguments

      public Set<Argument> getDefendedArguments(Argument arg)
      Retrieves the set of arguments defended by the given argument. In order for b to be defended by a, all attackers of b that are also attacked by a have to be defeated by a. E.g if (c,b) and (d,b) as well as (a,c) and (a,d) are attacks, then w(a,c) + w(a,d) >= w(c,b) + w(d,b) is required for b to be defended by a.
      Parameters:
      arg - The argument for which defended arguments are to be retrieved.
      Returns:
      A set of arguments defended by the given argument.
    • isStronglyDefendedBy

      public boolean isStronglyDefendedBy(Argument arg, Collection<Argument> ext)
      Description copied from class: DungTheory
      Checks whether a specified argument is strongly defended by the given set of arguments.
      Overrides:
      isStronglyDefendedBy in class DungTheory
      Parameters:
      arg - some argument
      ext - a set of arguments
      Returns:
      true, iff the specified argument is strongly defended by the set
    • getUndefendedAttacks

      public Collection<Attack> getUndefendedAttacks(Collection<Argument> ext)
      Description copied from class: DungTheory
      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.
      Overrides:
      getUndefendedAttacks in class DungTheory
      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.
    • prettyPrint

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

      public String toString()
      Generates a string representation of the framework.
      Specified by:
      toString in interface BeliefBase
      Specified by:
      toString in interface Graph<T>
      Overrides:
      toString in class DungTheory
      Returns:
      The string representation of the framework.