Skip to main content

ObservationTable

Struct ObservationTable 

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

Implementations§

Source§

impl ObservationTable

Source

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

Create a new observation table

Source

pub fn initialize(&mut self) -> Result<(), String>

Initialize the observation table with empty string in S and all input letters in D

Source

pub fn serialize(&self) -> String

Serialize the observation table to a string

Source

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.

Source

pub fn add_counterexample( &mut self, input_word: &Word, _output_word: &Word, ) -> Result<(), String>

Add a counterexample to the observation table

Source

pub fn make_consistent( &mut self, inconsistency: (((Word, Word), Word), Word), ) -> Result<(), String>

Make the observation table consistent

Source

pub fn is_closed(&self) -> bool

Check if the observation table is closed

Source

pub fn close_table(&mut self) -> Result<(), String>

Close the observation table by moving rows from SA to S

Source

pub fn is_consistent(&self) -> bool

Check if the observation table is consistent

Source

pub fn build_hypothesis(&self) -> Result<Automata, String>

Build a hypothesis automaton from the current observation table

Trait Implementations§

Source§

impl Display for ObservationTable

Source§

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

Formats the value using the given formatter. 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.