25 template <Automaton Aut>
32 "hopcroft: require boolean weightset");
36 using set_t =
typename decltype(ps)::value_t;
37 using partition_t = std::set<set_t>;
39 unsigned size = a->all_states().back() + 1;
45 for (
auto s: a->all_states())
49 auto p = partition_t{f,
q};
50 auto w = partition_t{f};
52 const auto& ls = *a->labelset();
54 generators.emplace_back(ls.special());
58 auto sub_w = std::move(*begin(w));
60 for (
const auto l: generators)
66 auto p2 = partition_t(p);
71 if (!xny.empty() && !x_y.empty())
81 w.insert(xny.size() <= x_y.size() ? xny : x_y);
83 p.insert(std::move(xny));
84 p.insert(std::move(x_y));
89 auto res = std::vector<std::vector<state_t>>{};
90 std::transform(begin(p), end(p), std::back_inserter(res),
93 auto res = std::vector<state_t>();
94 res.reserve(set.size());
106 template <Automaton Aut>
108 std::enable_if_t<!is_free_boolean<Aut>(), quotient_t<Aut>>
111 raise(
"minimize: invalid algorithm"
112 " (non-Boolean or non-free labelset):",
ATTRIBUTE_NORETURN std::enable_if_t<!is_free_boolean< Aut >), Aut > minimize(const Aut &, brzozowski_tag)
Handling of errors for dyn::minimize.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
partition_automaton_t< Aut > quotient_t
The return type when calling quotient on Aut.
Request the set implementation (bool weights).
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
auto quotient(const Aut &a, typename detail::quotienter< Aut >::class_to_set_t &cs) -> quotient_t< Aut >
Provide a variadic mul on top of a binary mul(), and one().
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
Request for Hopcroft implementation of minimize (B and free).
auto label_of(const welement< Label, Weight > &m) -> decltype(m.label())
The label of a welement.
static dyn::context ctx(const driver &d)
Get the context of the driver.
Request the bitset implementation (bool weights).
auto minimize(const Aut &a, brzozowski_tag) -> std::enable_if_t< is_free_boolean< Aut >(), determinized_automaton< codeterminized_automaton< Aut >, wet_kind_t::bitset >>
Brzozowski-based minimization.
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
auto in(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions arriving to state s.
polynomialset< Context, Kind > make_polynomialset(const Context &context)
Ctx make_context(const std::string &name)