pub struct WMethodEQ {
pub max_states: usize,
/* private fields */
}Expand description
W-method equivalence-test strategy.
Fields§
§max_states: usizeUpper bound on the number of states in the target system.
Implementations§
Source§impl WMethodEQ
impl WMethodEQ
Sourcepub fn new(
knowledge_base: Arc<Mutex<dyn KnowledgeBaseTrait>>,
input_letters: Vec<Letter>,
max_states: usize,
) -> Self
pub fn new( knowledge_base: Arc<Mutex<dyn KnowledgeBaseTrait>>, input_letters: Vec<Letter>, max_states: usize, ) -> Self
Create a new W-method equivalence tester.
Examples found in repository?
examples/all_eqtests_custom_kb.rs (line 24)
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 WMethodEQ
impl EquivalenceTest for WMethodEQ
Source§fn find_counterexample(
&self,
hypothesis: &mut Automata,
) -> Option<Counterexample>
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§
impl Freeze for WMethodEQ
impl RefUnwindSafe for WMethodEQ
impl !Send for WMethodEQ
impl !Sync for WMethodEQ
impl Unpin for WMethodEQ
impl UnsafeUnpin for WMethodEQ
impl UnwindSafe for WMethodEQ
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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