Skip to main content

ArgumentationFramework

Struct ArgumentationFramework 

Source
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>

Source

pub fn new() -> Self

Create an empty framework.

Source

pub fn add_argument(&mut self, a: A)

Add an argument. Adding an argument that already exists is a no-op.

Source

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.

Source

pub fn arguments(&self) -> impl Iterator<Item = &A>

Iterate over all arguments in the framework.

Source

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.

Source

pub fn is_empty(&self) -> bool

Whether the framework contains zero arguments.

Source

pub fn attackers(&self, a: &A) -> Vec<&A>

Return the arguments that attack a.

Source

pub fn attacked_by(&self, a: &A) -> Vec<&A>

Return the arguments attacked by a.

Source§

impl<A: Clone + Eq + Hash> ArgumentationFramework<A>

Source

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.

Source

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.

Source

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>

Source

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>

Source

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>

Source

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>

Source

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.

Source

pub fn complete_labellings(&self) -> Result<Vec<Labelling<A>>, Error>

Return labellings corresponding to all complete extensions.

Propagates crate::Error::TooLarge from complete_extensions.

Source

pub fn grounded_labelling(&self) -> Labelling<A>

Compute the labelling corresponding to the grounded extension.

Source

pub fn preferred_labellings(&self) -> Result<Vec<Labelling<A>>, Error>

Compute labellings corresponding to all preferred extensions.

Source

pub fn stable_labellings(&self) -> Result<Vec<Labelling<A>>, Error>

Compute labellings corresponding to all stable extensions.

Source

pub fn ideal_labelling(&self) -> Result<Labelling<A>, Error>

Compute the labelling corresponding to the ideal extension.

Source

pub fn semi_stable_labellings(&self) -> Result<Vec<Labelling<A>>, Error>

Compute labellings corresponding to all semi-stable extensions.

Source§

impl<A: Clone + Eq + Hash + Ord> ArgumentationFramework<A>

Source

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>

Source

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>

Source

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>

Source§

fn clone(&self) -> ArgumentationFramework<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + Clone + Eq + Hash> Debug for ArgumentationFramework<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Clone + Eq + Hash> Default for ArgumentationFramework<A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.