pub struct ObservationTable {
pub input_letters: Vec<Letter>,
pub D: Vec<Word>,
pub S: Vec<Word>,
pub SA: Vec<Word>,
pub ot_content: HashMap<Word, HashMap<Word, Option<Letter>>>,
pub initialized: bool,
/* private fields */
}Expand description
The Observation Table is the core data structure of the L* algorithm It maintains:
- D: the set of distinguishing strings (suffixes)
- S: the set of short prefixes
- SA: the set of long prefixes
- ot_content: the table content mapping (prefix, suffix) -> output
Fields§
§input_letters: Vec<Letter>§D: Vec<Word>§S: Vec<Word>§SA: Vec<Word>§ot_content: HashMap<Word, HashMap<Word, Option<Letter>>>§initialized: boolImplementations§
Source§impl ObservationTable
impl ObservationTable
Sourcepub fn new(
input_letters: Vec<Letter>,
knowledge_base: Arc<Mutex<dyn KnowledgeBaseTrait>>,
) -> Self
pub fn new( input_letters: Vec<Letter>, knowledge_base: Arc<Mutex<dyn KnowledgeBaseTrait>>, ) -> Self
Create a new observation table
Sourcepub fn initialize(&mut self) -> Result<(), String>
pub fn initialize(&mut self) -> Result<(), String>
Initialize the observation table with empty string in S and all input letters in D
Sourcepub fn find_inconsistency(&self) -> Option<(((Word, Word), Word), Word)>
pub fn find_inconsistency(&self) -> Option<(((Word, Word), Word), Word)>
Find an inconsistency in the observation table
Returns: Some(((prefix1, prefix2), (suffix, distinguishing_word))) when
a pair of equivalent prefixes in S behave differently after appending
suffix for some distinguishing column in D.
Sourcepub fn add_counterexample(
&mut self,
input_word: &Word,
_output_word: &Word,
) -> Result<(), String>
pub fn add_counterexample( &mut self, input_word: &Word, _output_word: &Word, ) -> Result<(), String>
Add a counterexample to the observation table
Sourcepub fn make_consistent(
&mut self,
inconsistency: (((Word, Word), Word), Word),
) -> Result<(), String>
pub fn make_consistent( &mut self, inconsistency: (((Word, Word), Word), Word), ) -> Result<(), String>
Make the observation table consistent
Sourcepub fn close_table(&mut self) -> Result<(), String>
pub fn close_table(&mut self) -> Result<(), String>
Close the observation table by moving rows from SA to S
Sourcepub fn is_consistent(&self) -> bool
pub fn is_consistent(&self) -> bool
Check if the observation table is consistent
Sourcepub fn build_hypothesis(&self) -> Result<Automata, String>
pub fn build_hypothesis(&self) -> Result<Automata, String>
Build a hypothesis automaton from the current observation table
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObservationTable
impl RefUnwindSafe for ObservationTable
impl !Send for ObservationTable
impl !Sync for ObservationTable
impl Unpin for ObservationTable
impl UnsafeUnpin for ObservationTable
impl UnwindSafe for ObservationTable
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