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):",
Ctx make_context(const std::string &name)
Build a context from its name.
std::vector< typename Cont::value_type > make_vector(const Cont &cont)
The content of cont as a vector.
partition_automaton_t< Aut > quotient_t
The return type when calling quotient on Aut.
size_t states_size(const Aut &aut)
The largest state number, plus one.
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.
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 label_of(const welement< Label, Weight > &m) -> decltype(m.label())
The label of a welement.
Request the bitset implementation (bool weights).
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
ATTRIBUTE_NORETURN std::enable_if_t<!is_free_boolean< Aut >), Aut > minimize(const Aut &, brzozowski_tag)
Handling of errors for dyn::minimize.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
Request the set implementation (bool weights).
auto quotient(const Aut &a, typename detail::quotienter< Aut >::class_to_set_t &cs) -> quotient_t< Aut >
polynomialset< Context, Kind > make_polynomialset(const Context &context)
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
auto transform(const Container &c, Fun &&fun)
Map a unary function on a container of values, and return the vector the results. ...
Provide a variadic mul on top of a binary mul(), and one().
Request for Hopcroft implementation of minimize (B and free).