pub struct ArgumentationFramework<A: Clone + Eq + Hash> { /* private fields */ }Expand description
A Dung-style argumentation framework over argument type A.
Implementations§
Source§impl<A: Clone + Eq + Hash> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash> ArgumentationFramework<A>
Sourcepub fn add_argument(&mut self, a: A)
pub fn add_argument(&mut self, a: A)
Add an argument. Adding an argument that already exists is a no-op.
Sourcepub fn add_attack(&mut self, attacker: &A, target: &A) -> Result<(), Error>where
A: Debug,
pub fn add_attack(&mut self, attacker: &A, target: &A) -> Result<(), Error>where
A: Debug,
Add an attack from attacker to target. Both must already be present.
Adding the same attack edge twice is a no-op: ArgumentationFramework
does not model weighted or multi-edge attacks.
The Debug bound on A lets the error message name the offending
argument when one is missing. Arguments are taken by reference to avoid
cloning owned types like String or Arc<T> on every call.
Sourcepub fn arguments(&self) -> impl Iterator<Item = &A>
pub fn arguments(&self) -> impl Iterator<Item = &A>
Iterate over all arguments in the framework.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of arguments currently in the framework.
Constant-time. Useful for size-gating exponential enumerators
against crate::ENUMERATION_LIMIT before calling them.
Sourcepub fn attacked_by(&self, a: &A) -> Vec<&A>
pub fn attacked_by(&self, a: &A) -> Vec<&A>
Return the arguments attacked by a.
Source§impl<A: Clone + Eq + Hash> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash> ArgumentationFramework<A>
Sourcepub fn is_conflict_free(&self, s: &HashSet<A>) -> bool
pub fn is_conflict_free(&self, s: &HashSet<A>) -> bool
A set s is conflict-free iff no argument in s attacks another in s.
Sourcepub fn defends(&self, s: &HashSet<A>, a: &A) -> bool
pub fn defends(&self, s: &HashSet<A>, a: &A) -> bool
s defends a iff every attacker of a is itself attacked by some member of s.
Sourcepub fn is_admissible(&self, s: &HashSet<A>) -> bool
pub fn is_admissible(&self, s: &HashSet<A>) -> bool
s is admissible iff it is conflict-free and defends all its members.
Source§impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
Sourcepub fn complete_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
pub fn complete_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
Enumerate all complete extensions via subset search.
Performance: O(2^n) in the number of arguments. Frameworks with
more than the internal enumeration limit are rejected with
crate::Error::TooLarge; use a SAT-based semantics entry point
(future work) for larger instances.
Source§impl<A: Clone + Eq + Hash> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash> ArgumentationFramework<A>
Sourcepub fn grounded_extension(&self) -> HashSet<A>
pub fn grounded_extension(&self) -> HashSet<A>
Compute the grounded extension.
Returns the unique least complete extension (always exists, always unique).
Source§impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
Sourcepub fn ideal_extension(&self) -> Result<HashSet<A>, Error>
pub fn ideal_extension(&self) -> Result<HashSet<A>, Error>
Compute the ideal extension.
Defined as the largest admissible subset of the intersection of all preferred extensions. Unique. The grounded extension is always a subset of the ideal extension.
Returns crate::Error::TooLarge for frameworks above the enumeration limit.
Source§impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
Sourcepub fn extension_to_labelling(&self, ext: &HashSet<A>) -> Labelling<A>
pub fn extension_to_labelling(&self, ext: &HashSet<A>) -> Labelling<A>
Compute the labelling corresponding to a given extension.
An argument is In iff in the extension; Out iff attacked by
something in the extension; Undec otherwise.
Sourcepub fn complete_labellings(&self) -> Result<Vec<Labelling<A>>, Error>
pub fn complete_labellings(&self) -> Result<Vec<Labelling<A>>, Error>
Return labellings corresponding to all complete extensions.
Propagates crate::Error::TooLarge from complete_extensions.
Sourcepub fn grounded_labelling(&self) -> Labelling<A>
pub fn grounded_labelling(&self) -> Labelling<A>
Compute the labelling corresponding to the grounded extension.
Sourcepub fn preferred_labellings(&self) -> Result<Vec<Labelling<A>>, Error>
pub fn preferred_labellings(&self) -> Result<Vec<Labelling<A>>, Error>
Compute labellings corresponding to all preferred extensions.
Sourcepub fn stable_labellings(&self) -> Result<Vec<Labelling<A>>, Error>
pub fn stable_labellings(&self) -> Result<Vec<Labelling<A>>, Error>
Compute labellings corresponding to all stable extensions.
Sourcepub fn ideal_labelling(&self) -> Result<Labelling<A>, Error>
pub fn ideal_labelling(&self) -> Result<Labelling<A>, Error>
Compute the labelling corresponding to the ideal extension.
Source§impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
Sourcepub fn preferred_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
pub fn preferred_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
Enumerate all preferred extensions.
A preferred extension is a subset-maximal admissible set. Every argumentation framework has at least one preferred extension.
Returns crate::Error::TooLarge for frameworks above the
enumeration limit.
Source§impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
Sourcepub fn semi_stable_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
pub fn semi_stable_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
Enumerate all semi-stable extensions.
Returns crate::Error::TooLarge for frameworks above the enumeration limit.
Source§impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>
Sourcepub fn stable_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
pub fn stable_extensions(&self) -> Result<Vec<HashSet<A>>, Error>
Enumerate all stable extensions.
A stable extension is a conflict-free set S such that every argument
not in S is attacked by some member of S. Stable extensions may not
exist (e.g., in odd cycles).
Returns crate::Error::TooLarge for frameworks above the enumeration limit.
Trait Implementations§
Source§impl<A: Clone + Clone + Eq + Hash> Clone for ArgumentationFramework<A>
impl<A: Clone + Clone + Eq + Hash> Clone for ArgumentationFramework<A>
Source§fn clone(&self) -> ArgumentationFramework<A>
fn clone(&self) -> ArgumentationFramework<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more