Skip to main content

BDistMethod

Struct BDistMethod 

Source
pub struct BDistMethod { /* private fields */ }
Expand description

BDist equivalence-test strategy.

Implementations§

Source§

impl BDistMethod

Source

pub fn new( knowledge_base: Arc<Mutex<dyn KnowledgeBaseTrait>>, input_letters: Vec<Letter>, bdist: usize, ) -> Self

Create a new BDist equivalence tester.

bdist controls the maximum distinguishing suffix length.

Examples found in repository?
examples/all_eqtests_custom_kb.rs (line 35)
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15    println!("=== Custom KB: All Equivalence Tests ===");
16    println!("System under learning: ATM protocol");
17
18    let mut reports = Vec::new();
19
20    let strategies: Vec<(&str, Box<EqBuilder>)> = vec![
21        (
22            "WMethodEQ",
23            Box::new(|kb, input_letters, max_states| {
24                Arc::new(WMethodEQ::new(kb, input_letters, max_states))
25            }),
26        ),
27        (
28            "RandomWalkMethod",
29            Box::new(|kb, input_letters, _| {
30                Arc::new(RandomWalkMethod::new(kb, input_letters, 10_000, 0.75))
31            }),
32        ),
33        (
34            "BDistMethod",
35            Box::new(|kb, input_letters, _| Arc::new(BDistMethod::new(kb, input_letters, 2))),
36        ),
37        (
38            "MultipleEqtests",
39            Box::new(|kb, input_letters, max_states| {
40                let eqtests: Vec<Arc<dyn EquivalenceTest>> = vec![
41                    Arc::new(WMethodEQ::new(
42                        kb.clone(),
43                        input_letters.clone(),
44                        max_states,
45                    )),
46                    Arc::new(RandomWalkMethod::new(
47                        kb.clone(),
48                        input_letters.clone(),
49                        5_000,
50                        0.65,
51                    )),
52                    Arc::new(BDistMethod::new(kb, input_letters, 2)),
53                ];
54                Arc::new(MultipleEqtests::new(eqtests))
55            }),
56        ),
57    ];
58
59    for (name, builder) in strategies {
60        reports.push(run_strategy(name, builder.as_ref()));
61    }
62
63    print_summary(&reports);
64
65    Ok(())
66}

Trait Implementations§

Source§

impl EquivalenceTest for BDistMethod

Source§

fn find_counterexample( &self, hypothesis: &mut Automata, ) -> Option<Counterexample>

Find a counterexample for the given hypothesis Returns None if the automaton is equivalent to the system under learning

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.