17 #ifndef AWALI_CORE_RATEXP_AUTOMATON_HH
18 # define AWALI_CORE_RATEXP_AUTOMATON_HH
35 # define DEBUG_IFELSE(Then, Else) Then
37 # define DEBUG_IFELSE(Then, Else) Else
40 # define DEBUG_IF(Then) DEBUG_IFELSE(Then,)
42 namespace awali {
namespace sttc {
51 template <
typename Aut>
58 using ratexp_t =
typename ratexpset_t::value_t;
80 internal::hash<ratexpset_t>,
90 auto i =
map_.find(
r);
91 if (i == std::end(
map_))
94 std::cerr <<
"New state: ";
95 rs_.print(
r, std::cerr) <<
'\n';
130 const std::string& fmt)
const
147 for (
const auto& p:
map_)
162 template <
typename Aut>
164 = std::shared_ptr<internal::ratexp_automaton_impl<Aut>>;
Aggregate an automaton, and forward calls to it.
Definition: automaton_decorator.hh:36
Aut automaton_t
The type of automaton to wrap.
Definition: automaton_decorator.hh:39
auto set_initial(Args &&... args) -> decltype(aut_-> set_initial(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:192
static constexpr auto sname(Args &&... args) -> decltype(automaton_t::element_type::sname(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:112
auto print_state(Args &&... args) const -> decltype(aut_-> print_state(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:154
typename labelset_t::value_t label_t
Definition: automaton_decorator.hh:50
auto add_state(Args &&... args) -> decltype(aut_-> add_state(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:187
Context context_t
Definition: automaton_decorator.hh:45
typename weightset_t::value_t weight_t
Definition: automaton_decorator.hh:54
auto vname(Args &&... args) const -> decltype(aut_-> vname(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:159
auto add_transition(Args &&... args) -> decltype(aut_-> add_transition(std::forward< Args >(args)...))
Definition: automaton_decorator.hh:181
An incremental automaton whose states are ratexps.
Definition: ratexp_automaton.hh:53
std::ostream & print_state_name(state_t s, std::ostream &o, const std::string &fmt) const
Definition: ratexp_automaton.hh:129
std::stack< ratexp_t > todo_
States to visit.
Definition: ratexp_automaton.hh:155
std::unordered_map< ratexp_t, state_t, internal::hash< ratexpset_t >, utils::equal_to< ratexpset_t > > smap
Symbolic states to state handlers.
Definition: ratexp_automaton.hh:81
std::map< state_t, ratexp_t > origins_t
Ordered map: state -> its derived term.
Definition: ratexp_automaton.hh:141
void add_transition(const ratexp_t &src, const ratexp_t &dst, const label_t &l, const weight_t &w)
Definition: ratexp_automaton.hh:108
void add_transition(state_t src, const ratexp_t &dst, const label_t &l, const weight_t &w)
Definition: ratexp_automaton.hh:115
void set_initial(const ratexp_t &s, const weight_t &w)
Definition: ratexp_automaton.hh:123
state_t state(const ratexp_t &r)
The state for ratexp r.
Definition: ratexp_automaton.hh:85
const origins_t & origins() const
Definition: ratexp_automaton.hh:144
std::string vname(bool full=true) const
Definition: ratexp_automaton.hh:73
ratexp_automaton_impl(const context_t &ctx)
Definition: ratexp_automaton.hh:63
typename ratexpset_t::value_t ratexp_t
Definition: ratexp_automaton.hh:58
origins_t origins_
Definition: ratexp_automaton.hh:142
smap map_
ratexp -> state.
Definition: ratexp_automaton.hh:157
ratexpset_t rs_
The ratexp's set.
Definition: ratexp_automaton.hh:153
static std::string sname()
Definition: ratexp_automaton.hh:68
The semiring of floating Numbers.
Definition: r.hh:35
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
Definition: hash.hh:42
identities
A ratexpset can implement several different sets of identities on expressions.
Definition: identities.hh:32
typename internal::label_t_of_impl< internal::base_t< ValueSet > >::type label_t_of
Helper to retrieve the type of the labels of a value set.
Definition: traits.hh:71
typename internal::weight_t_of_impl< internal::base_t< ValueSet > >::type weight_t_of
Helper to retrieve the type of the weights of a value set.
Definition: traits.hh:81
std::shared_ptr< internal::ratexp_automaton_impl< Aut > > ratexp_automaton
A ratexp automaton as a shared pointer.
Definition: ratexp_automaton.hh:164
std::ostream & str_escape(std::ostream &os, const int c)
Definition: escape.hh:30
typename internal::context_t_of_impl< internal::base_t< ValueSet > >::type context_t_of
Helper to retrieve the type of the context of a value set.
Definition: traits.hh:66
auto format(const ValueSet &vs, const typename ValueSet::value_t &v, Args &&... args) -> std::string
Format v via vs.print.
Definition: stream.hh:109
static const std::string full
Completely version of Awali as a std::string.
Definition: version.hh:42
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21
#define DEBUG_IF(Then)
Definition: ratexp_automaton.hh:40
Provide a variadic mul on top of a binary mul(), and one().
Definition: weightset.hh:38