pub struct MultipleEqtests {
pub eqtests: Vec<Arc<dyn EquivalenceTest>>,
}Expand description
Compose multiple equivalence strategies and return the first counterexample.
Fields§
§eqtests: Vec<Arc<dyn EquivalenceTest>>Implementations§
Source§impl MultipleEqtests
impl MultipleEqtests
Sourcepub fn new(eqtests: Vec<Arc<dyn EquivalenceTest>>) -> Self
pub fn new(eqtests: Vec<Arc<dyn EquivalenceTest>>) -> Self
Examples found in repository?
examples/all_eqtests_custom_kb.rs (line 54)
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 MultipleEqtests
impl EquivalenceTest for MultipleEqtests
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 MultipleEqtests
impl !RefUnwindSafe for MultipleEqtests
impl !Send for MultipleEqtests
impl !Sync for MultipleEqtests
impl Unpin for MultipleEqtests
impl UnsafeUnpin for MultipleEqtests
impl !UnwindSafe for MultipleEqtests
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