Class EAFAgreementReasoner

java.lang.Object
org.tweetyproject.arg.eaf.reasoner.EAFAgreementReasoner

public class EAFAgreementReasoner extends Object
This reasoner for epistemic Dung theories performs inference on the agreement states of arguments for multiple EAFs.
Author:
Sandra Hoffmann
  • Constructor Details

    • EAFAgreementReasoner

      public EAFAgreementReasoner(EpistemicArgumentationFramework eaf)
      Constructor with one initial EAF
      Parameters:
      eaf - the initial epistemic argumentation framework
  • Method Details

    • addEAF

      public boolean addEAF(EpistemicArgumentationFramework eaf) throws Exception
      Add another EAF with the same underlying AF
      Parameters:
      eaf - the EAF to add
      Returns:
      true if successfully added
      Throws:
      Exception - if the underlying AF doesn't match
    • addEAF

      public boolean addEAF(String constraint)
      Add another EAF with the same underlying AF but different constraint
      Parameters:
      constraint - the constraint for the new EAF
      Returns:
      true if successfully added
    • removeEAF

      public boolean removeEAF(EpistemicArgumentationFramework eaf)
      Remove a specific EAF from the reasoner
      Parameters:
      eaf - the EAF to remove
      Returns:
      true if successfully removed, false otherwise
    • removeEAF

      public boolean removeEAF(String constraint)
      Remove an EAF with a specific constraint
      Parameters:
      constraint - the constraint of the EAF to remove
      Returns:
      true if an EAF with the given constraint was found and removed, false otherwise
    • changeEAF

      public boolean changeEAF(EpistemicArgumentationFramework oldEAF, EpistemicArgumentationFramework newEAF) throws Exception
      Replace an EAF with a new one. This is akin to a believe change. If there are multiple EAFs with the same constraint as oldEAF, the first EAF that is found with this constraint is replaced by newEAF.
      Parameters:
      oldEAF - the existing EAF to be replaced
      newEAF - the new EAF to replace the old one
      Returns:
      true if replacement was successful, false otherwise
      Throws:
      Exception - if the underlying AF doesn't match
    • changeEAF

      public boolean changeEAF(String oldConstraint, String newConstraint) throws Exception
      Replace an EAF with a given constraint. This is akin to a believe change. If there are multiple EAFs with the same constraint as oldConstraint, the first EAF that is found with this constraint is replaced by a new EAF with newConstraint.
      Parameters:
      oldConstraint - the constraint of the existing EAF to be replaced
      newConstraint - the constraint of the new EAF to replace the old one
      Returns:
      true if replacement was successful, false otherwise
      Throws:
      Exception - if the underlying AF doesn't match
    • removeEAF

      public EpistemicArgumentationFramework removeEAF(int index)
      Remove an EAF by its index
      Parameters:
      index - the index of the EAF to remove
      Returns:
      the removed EAF, or null if index is out of bounds
    • changeEAF

      public EpistemicArgumentationFramework changeEAF(int index, EpistemicArgumentationFramework newEAF) throws Exception
      Replace an EAF at a specific index with a new EAF
      Parameters:
      index - the index of the EAF to replace
      newEAF - the new EAF to replace the old one
      Returns:
      the old EAF that was replaced, or null if index is out of bounds
      Throws:
      Exception - if the underlying AF doesn't match
    • listEAFs

      public void listEAFs()
      Print out all EAFs in the reasoner with their indices Prints to standard output
    • getEAFs

      Get a list of all EAFs in the reasoner
      Returns:
      a list of EAFs
    • query

      public Boolean query(String queryNode, InferenceMode mode, Semantics sem)
      Check if all EAFs agree on a formula under the given semantics and inference mode
      Parameters:
      queryNode - string representing the query (in(a), out(a), or und(a))
      mode - credulous or skeptical mode
      sem - the semantics to use
      Returns:
      boolean indicating whether all EAFs agree on the query
      Throws:
      IllegalArgumentException - if the query format is invalid or if an argument in the query is not found in the labeling
    • majorityVote

      public boolean majorityVote(String query, InferenceMode mode, Semantics sem)
      Performs majority voting over multiple EAFs to decide whether the given argument label (e.g., in(a), out(a), or und(a)) is accepted by the majority under the specified inference mode and semantics. In credulous mode, the label must be satisfied in at least one labelling set (M φ). In skeptical mode, the label must be satisfied in all labelling sets (K φ). The query label wins if it gets strictly more votes than any other label.
      Parameters:
      query - the argument label to evaluate, in the form in(arg), out(arg), or und(arg)
      mode - the inference mode to use (CREDULOUS or SKEPTICAL)
      sem - the argumentation semantics to apply
      Returns:
      true if the query label wins the majority vote, false otherwise
      Throws:
      IllegalArgumentException - if the query format is invalid