26 template <Automaton Aut>
33 "hopcroft: require boolean weightset");
37 using set_t =
typename decltype(ps)::value_t;
38 using partition_t = std::set<set_t>;
46 for (
auto s: a->all_states())
50 auto p = partition_t{f,
q};
51 auto w = partition_t{f};
53 const auto& ls = *a->labelset();
55 generators.emplace_back(ls.special());
59 auto sub_w = std::move(*begin(w));
61 for (
const auto l: generators)
67 auto p2 = partition_t(p);
72 if (!xny.empty() && !x_y.empty())
82 w.insert(xny.size() <= x_y.size() ? xny : x_y);
84 p.insert(std::move(xny));
85 p.insert(std::move(x_y));
90 auto res = std::vector<std::vector<state_t>>{};
94 auto res = std::vector<state_t>();
95 res.reserve(set.size());
107 template <Automaton Aut>
109 std::enable_if_t<!is_free_boolean<Aut>(), quotient_t<Aut>>
112 raise(
"minimize: invalid algorithm"
113 " (non-Boolean or non-free labelset):",
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
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.
auto quotient(const Aut &a, typename detail::quotienter< Aut >::class_to_set_t &cs) -> quotient_t< Aut >
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
Provide a variadic mul on top of a binary mul(), and one().
size_t states_size(const Aut &aut)
The largest state number, plus one.
polynomialset< Context, Kind > make_polynomialset(const Context &context)
auto in(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions arriving to state s.
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
auto transform(const Container &c, Fun &&fun)
Map a unary function on a container of values, and return the vector the results. ...
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
partition_automaton_t< Aut > quotient_t
The return type when calling quotient on Aut.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
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.
Request the bitset implementation (bool weights).
Ctx make_context(const std::string &name)
Build a context from its name.
Request the set implementation (bool weights).
ATTRIBUTE_NORETURN std::enable_if_t<!is_free_boolean< Aut >), Aut > minimize(const Aut &, brzozowski_tag)
Handling of errors for dyn::minimize.