Commit 834a6cb3 authored by Bharat Garhewal's avatar Bharat Garhewal
Browse files

LSharp now takes #inputs instead of a set

parent 379652fb
Pipeline #60969 failed with stages
in 3 minutes and 13 seconds
......@@ -51,12 +51,12 @@ where
/// the Lee-Yannakakis optimisation.
pub fn new(
oracle: Rc<RefCell<OutputOracle<'a, Tree>>>,
input_alphabet: &HashSet<InputSymbol, S>,
input_size: usize,
use_ly_ads: bool,
) -> Self {
Self {
oq_oracle: oracle,
input_size: input_alphabet.len(),
input_size,
basis: vec![State::new(0)],
frontier_to_basis_map: HashMap::default(),
use_ly_ads,
......
......@@ -23,7 +23,7 @@ use crate::{
writers::overall as MealyWriter,
},
};
use fnv::{FnvHashMap, FnvHashSet};
use fnv::FnvHashMap;
use rand::{prelude::StdRng, Rng, SeedableRng};
use std::{cell::RefCell, collections::HashMap, hash::BuildHasherDefault, rc::Rc, sync::Arc};
......@@ -104,10 +104,7 @@ pub fn learn_fsm<S: ::std::hash::BuildHasher + Default>(
let mut seq_oracle = SequenceOracle::new(Rc::clone(&oq_oracle), 10, rng.gen());
let mut learner = Lsharp::new(
Rc::clone(&oq_oracle),
&mealy_machine
.input_alphabet()
.into_iter()
.collect::<FnvHashSet<_>>(),
mealy_machine.input_alphabet().len(),
options.use_ly_ads,
);
......
......@@ -71,10 +71,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"soucha_spyh" => EqOracle::SouchaSPYH,
_ => unreachable!(),
};
let extra_states: usize = matches.get_one::<String>("extra_states").map_or(10, |x| {
x.parse()
.expect("Extra states must be a valid unsigned integer.")
});
let extra_states: usize = *matches.get_one::<usize>("extra_states").unwrap_or(&10);
let _rnd_infix_len: usize = matches
.get_one::<String>("expected_infix_length")
......
......@@ -351,6 +351,7 @@ where
.insert_observation(None, input_seq, output_seq)
}
#[allow(clippy::type_complexity)]
pub fn pass_maps(&self) -> (Vec<(String, InputSymbol)>, Vec<(String, OutputSymbol)>) {
(self.sul.input_map(), self.sul.output_map())
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment