![]() |
Awali
Another Weighted Automata library
|
Abstract interface listing the services provided by automata at the dynamical layer. More...
#include <abstract_automaton.hh>
Public Member Functions | |
virtual | ~abstract_automaton_t () |
virtual weight_t | add_eps_transition (state_t src, state_t dst)=0 |
Adds an epsilon transition going from src to dst . More... | |
virtual weight_t | add_eps_transition (state_t src, state_t dst, weight_t weight)=0 |
Adds an epsilon transition going from src to dst and weighted by weight . More... | |
virtual weight_t | add_final (state_t s, weight_t w)=0 |
Adds some final weight of state s to w (useful only for weighted automata). More... | |
virtual weight_t | add_initial (state_t s, weight_t w)=0 |
Adds some initial weight of state s to w (useful only for weighted automata). More... | |
virtual state_t | add_state ()=0 |
Adds a new isolated states. More... | |
virtual state_t | add_state (std::string name)=0 |
Adds a new isolated states with a custom name. More... | |
virtual weight_t | add_transition (state_t src, state_t dst, label_t label)=0 |
Adds a transition going from src to dst , labelled by label . More... | |
virtual weight_t | add_transition (state_t src, state_t dst, label_t label, weight_t weight)=0 |
Adds a transition going from src to dst , labelled by label and with weight weight ; or adds weight to an existing transition. More... | |
virtual weight_t | add_weight (transition_t tr, weight_t w)=0 |
Adds w to the weight of transition tr . More... | |
virtual std::vector< label_t > | alphabet () const =0 |
Return the alphabet of this abstract_automaton_t. More... | |
virtual bool | are_words_allowed () const =0 |
Returns true if words are allowed as labels. More... | |
virtual void | del_eps_transition (state_t src, state_t dst)=0 |
Deletes the epsilon transition going from state src to state dst . More... | |
virtual void | del_state (state_t s)=0 |
Deletes state s from this abstract_automaton_t. More... | |
virtual void | del_transition (state_t src, state_t dst)=0 |
Deletes all transitions going from state src to state dst . More... | |
virtual transition_t | del_transition (state_t src, state_t dst, label_t label)=0 |
Deletes the transition labelled by label and going from state src to state dst . More... | |
virtual void | del_transition (transition_t tr)=0 |
Deletes transition tr . More... | |
virtual state_t | dst_of (transition_t t) const =0 |
Returns the destination state of transition t . More... | |
virtual std::vector< state_t > | final_states () const =0 |
Returns the final states of this abstract_automaton_t. More... | |
virtual context_t | get_context () const =0 |
Gets the context of this abstract_automaton_t. More... | |
virtual const std::string & | get_desc () const =0 |
Return the description of this abstract_automaton_t. More... | |
virtual weight_t | get_final_weight (state_t s) const =0 |
Gets the final weight of s . More... | |
virtual weight_t | get_initial_weight (state_t s) const =0 |
Gets the initial weight of s . More... | |
virtual const std::string & | get_name () const =0 |
Return the name of this abstract_automaton_t. More... | |
virtual state_t | get_state_by_name (std::string name) const =0 |
Gets one of the state with given name. More... | |
virtual std::string | get_state_name (state_t s) const =0 |
Gets the name of state s . More... | |
virtual transition_t | get_transition (state_t src, state_t dst, label_t label) const =0 |
Gets the transition identifier going from state src to state dst and labelled by label . More... | |
virtual bool | has_explicit_name (state_t s) const =0 |
Returns true if state s has a name set. More... | |
virtual bool | has_state (state_t s) const =0 |
Returns true if this abstract_automaton_t contains state s . More... | |
virtual bool | has_transition (state_t src, state_t dst, label_t label) const =0 |
Returns true if there is a transition going from state src to state dst and labelled by label . More... | |
virtual bool | has_transition (transition_t t) const =0 |
Returns true if a transition with identifier t exists in this abstract_automaton_t. More... | |
virtual history_kind_t | history_kind () const =0 |
[experimental] Gives the kind of data this abstract_automaton_t comes from. More... | |
virtual std::vector< transition_t > | in (state_t s, label_t label) const |
Alias to incoming(state_t,label_t)const. More... | |
std::vector< transition_t > | in (state_t s, options_t opts={}) const |
Alias to incoming. More... | |
virtual std::vector< transition_t > | incoming (state_t s, label_t label) const =0 |
Returns the transitions coming in state s and labelled by label . More... | |
std::vector< transition_t > | incoming (state_t s, options_t opts={}) const |
Returns the transitions coming in state s . More... | |
virtual std::vector< state_t > | initial_states () const =0 |
Returns the initial states of this abstract_automaton_t. More... | |
virtual bool | is_eps_allowed () const =0 |
Returns true if epsilon transitions are allowed. More... | |
virtual bool | is_eps_transition (transition_t t) const =0 |
Returns true if transition t is an epsilon-transition. More... | |
virtual bool | is_final (state_t s) const =0 |
Returns true if given state s is final in this abstract_automaton_t. More... | |
virtual bool | is_initial (state_t s) const =0 |
Returns true if given state s is initial in this abstract_automaton_t. More... | |
virtual bool | is_int_automaton () const =0 |
Returns true if the labelset of this abstract_automaton_t is Z. More... | |
virtual bool | is_transducer () const =0 |
Returns true if this abstract_automaton_t has multiple tapes. More... | |
virtual label_t | label_of (transition_t t) const =0 |
Returns the label of transition t . More... | |
virtual label_t | label_of (transition_t t, unsigned i) const =0 |
Returns the label of the i -th tape on the transition t (transducers only). More... | |
virtual std::list< label_t > | labels_of (transition_t t) const =0 |
Returns the label of all tapes on the transition t (transducers only). More... | |
virtual weight_t | lmul_weight (transition_t tr, weight_t w)=0 |
Multiplies by w on the left the weight of transition tr . More... | |
virtual state_t | null_state () const =0 |
Returns the phony state, used for instance when no state is found. More... | |
virtual transition_t | null_transition () const =0 |
Returns the phony transition_t, used for instance when transition is found. More... | |
virtual size_t | num_finals () const =0 |
Returns the number of final states in this abstract_automaton_t. More... | |
virtual size_t | num_initials () const =0 |
Returns the number of initial states in this abstract_automaton_t. More... | |
virtual size_t | num_states () const =0 |
Returns the number of states in this abstract_automaton_t. More... | |
virtual size_t | num_transitions () const =0 |
Returns the number of transitions in this abstract_automaton_t. More... | |
virtual state_t | origin_of (state_t s) const =0 |
[experimental] Gives the the origin of state s , in the case where it comes from a single state. More... | |
virtual std::vector< state_t > | origins_of (state_t s) const =0 |
[experimental] Gives the origin of state s , in the case where it comes from a tuple of states. More... | |
std::vector< transition_t > | out (state_t s, label_t label) const |
Alias to outgoing(state_t, label_t)const. More... | |
std::vector< transition_t > | out (state_t s, options_t opts={}) const |
Alias to outgoing. More... | |
virtual std::vector< transition_t > | outgoing (state_t s, label_t label) const =0 |
Returns the transitions going out of state s and labelled by label . More... | |
std::vector< transition_t > | outgoing (state_t s, options_t opts={}) const |
Returns the transitions going out ofstate s . More... | |
virtual std::vector< transition_t > | outin (state_t src, state_t dst) const =0 |
Returns all transitions going from src to dst . More... | |
virtual state_t | post () const =0 |
Returns the postfinal state. More... | |
virtual state_t | pre () const =0 |
Returns the preinitial state. More... | |
virtual std::vector< state_t > | predecessors (state_t s) const =0 |
Returns the sources of all transitions coming in state s . More... | |
virtual std::vector< state_t > | predecessors (state_t s, label_t label) const =0 |
Returns the sources of all transitions labelled by label that are coming in state s . More... | |
virtual weight_t | rmul_weight (transition_t tr, weight_t we)=0 |
Multiplies by w on the right the weight of transition tr . More... | |
virtual void | set_desc (const std::string &desc)=0 |
Sets the description of this abstract_automaton_t. More... | |
virtual transition_t | set_eps_transition (state_t src, state_t dst)=0 |
Sets an epsilon transition going from src to dst . More... | |
virtual transition_t | set_eps_transition (state_t src, state_t dst, weight_t weight)=0 |
Sets an epsilon transition going from src to dst and weighted by weight . More... | |
virtual void | set_final (state_t s)=0 |
Sets state s as final. More... | |
virtual void | set_final (state_t s, weight_t w)=0 |
Sets final weight of state s to w (useful only for weightset automata). More... | |
virtual void | set_initial (state_t s)=0 |
Sets state s as initial. More... | |
virtual void | set_initial (state_t s, weight_t w)=0 |
Sets initial weight of state s to w (useful only for weightset automata). More... | |
virtual void | set_name (const std::string &name)=0 |
Sets the name of this abstract_automaton_t. More... | |
virtual void | set_state_name (state_t s, std::string name)=0 |
Sets to name the name of s . More... | |
virtual void | set_state_names_from_history ()=0 |
[experimental] Sets the name of each state based on its history. More... | |
virtual transition_t | set_transition (state_t src, state_t dst, label_t label)=0 |
Sets a transition going from src to dst and labelled by label . More... | |
virtual transition_t | set_transition (state_t src, state_t dst, label_t label, weight_t weight)=0 |
Sets (and possibly replaces) a transition going from src to dst , labelled by label and with weight weight . More... | |
virtual weight_t | set_weight (transition_t tr, weight_t w)=0 |
Sets to w the weight of transition tr . More... | |
virtual state_t | src_of (transition_t t) const =0 |
Returns the source state of transition t . More... | |
std::vector< state_t > | states (options_t opts={}) const |
Returns the states of this abstract_automaton_t. More... | |
virtual void | strip_history ()=0 |
Deletes all state history. More... | |
virtual std::vector< state_t > | successors (state_t s) const =0 |
Returns the destinations of all transitions going out of s . More... | |
virtual std::vector< state_t > | successors (state_t s, label_t label) const =0 |
Returns the destinations of all transitions labelled by label going out of s . More... | |
std::vector< transition_t > | transitions (options_t opts={}) const |
Returns the transitions in this abstract_automaton_t. More... | |
virtual void | unset_final (state_t s)=0 |
Sets state s as non-final. More... | |
virtual void | unset_initial (state_t s)=0 |
Sets state s as non-initial. More... | |
virtual weight_t | weight_of (transition_t t) const =0 |
Returns the weight of transition t . More... | |
Abstract interface listing the services provided by automata at the dynamical layer.
First, note that there is no difference if the automaton is Booolean (that is, if it as "classical" automaton).
In the following, let us assume that the automaton is weighted over a semiring (W,+,x).
Let src
and dst
be two states and lbl
be a label. (lbl
might be epsilon if the automaton allows it, or a tuple in the case of transducers.) In Awali, there is at most one transitions tr
going from src
to dst
and labelled by lbl
. In addition, This transition also bears weight wght
.
When modifying the transition going from src
to dst
and labelled by lbl
, one has to decide what to do with wght
.
set_transition(src,dst,lbl,new_wght)
ignores wght
, and sets the weight of tr
to new_wght
add_transition(src,dst,lbl,new_wght)
modifies the weights of tr
so that it now is wght+new_wght
.If the automaton features no transition going from src
to dst
and labelled by lbl
, everything behaves as if it had such a transition weighted by zero (in fact, the neutral element for +). In this case both functions above do the same thing.
|
virtual |
|
pure virtual |
Adds an epsilon transition going from src
to dst
.
|
pure virtual |
Adds an epsilon transition going from src
to dst
and weighted by weight
.
Adds some final weight of state s
to w
(useful only for weighted automata).
Let (W,+,x) be the weightset of this abstract_automaton_t. A call to this method makes the final weight of s
to become old+w, where old is the final weight of s
prior to the call.
s
|
pure virtual |
Adds some initial weight of state s
to w
(useful only for weighted automata).
Let (W,+,x) be the weightset of this abstract_automaton_t. A call to this method makes the initial weight of s
to become old+w, where old is the initial weight of s
prior to the call.
s
|
pure virtual |
Adds a new isolated states.
This method is not equivalent to calling add_state(std::string) with an empty string as parameter. This method leaves undefined the name of the new state.
|
pure virtual |
Adds a new isolated states with a custom name.
|
pure virtual |
Adds a transition going from src
to dst
, labelled by label
.
If this abstract_automaton_t is weighted over (W,+,x), this is the same as add_transition(src,dst,label,one)
where one is the neutral element for x.
src
to dst
and labelled by label
.
|
pure virtual |
Adds a transition going from src
to dst
, labelled by label
and with weight weight
; or adds weight to an existing transition.
src
to dst
and labelled by label
.
|
pure virtual |
Adds w
to the weight of transition tr
.
|
pure virtual |
Return the alphabet of this abstract_automaton_t.
|
pure virtual |
Returns true
if words are allowed as labels.
|
pure virtual |
Deletes the epsilon transition going from state src
to state dst
.
|
pure virtual |
Deletes state s
from this abstract_automaton_t.
|
pure virtual |
Deletes all transitions going from state src
to state dst
.
|
pure virtual |
Deletes the transition labelled by label
and going from state src
to state dst
.
|
pure virtual |
Deletes transition tr
.
|
pure virtual |
Returns the destination state of transition t
.
|
pure virtual |
Returns the final states of this abstract_automaton_t.
|
pure virtual |
Gets the context of this abstract_automaton_t.
|
pure virtual |
Return the description of this abstract_automaton_t.
Gets the final weight of s
.
|
pure virtual |
Gets the initial weight of s
.
|
pure virtual |
Return the name of this abstract_automaton_t.
|
pure virtual |
Gets one of the state with given name.
If there is no state with given name, a phony state is returned. Use method has_state to test if a state is phony or not.
|
pure virtual |
Gets the name of state s
.
If the state has no name, one is generated (but not registered).
|
pure virtual |
Gets the transition identifier going from state src
to state dst
and labelled by label
.
|
pure virtual |
Returns true if state s
has a name set.
|
pure virtual |
Returns true
if this abstract_automaton_t contains state s
.
s |
|
pure virtual |
Returns true
if there is a transition going from state src
to state dst
and labelled by label
.
|
pure virtual |
Returns true
if a transition with identifier t
exists in this abstract_automaton_t.
|
pure virtual |
[experimental] Gives the kind of data this abstract_automaton_t comes from.
|
virtual |
Alias to incoming(state_t,label_t)const.
std::vector<transition_t> awali::dyn::abstract_automaton_t::in | ( | state_t | s, |
options_t | opts = {} |
||
) | const |
Alias to incoming.
|
pure virtual |
Returns the transitions coming in state s
and labelled by label
.
std::vector<transition_t> awali::dyn::abstract_automaton_t::incoming | ( | state_t | s, |
options_t | opts = {} |
||
) | const |
Returns the transitions coming in state s
.
s | |
opts | A set of options; only PREPOST_PARADIGM is meaningful. |
true
(default is false
), the initial transitions coming in s
are also returned.
|
pure virtual |
Returns the initial states of this abstract_automaton_t.
|
pure virtual |
Returns true
if epsilon transitions are allowed.
|
pure virtual |
Returns true
if transition t
is an epsilon-transition.
|
pure virtual |
Returns true
if given state s
is final in this abstract_automaton_t.
If this abstract_automaton_t is weighted over a weightset (W,+,.), it returns true
if the final weight associated with s
is not the neutral element for +.
|
pure virtual |
Returns true
if given state s
is initial in this abstract_automaton_t.
If this abstract_automaton_t is weighted over a weightset (W,+,.), it returns true
if the initial weight associated with s
is not the neutral element for +.
|
pure virtual |
Returns true
if the labelset of this abstract_automaton_t is Z.
|
pure virtual |
Returns true
if this abstract_automaton_t has multiple tapes.
|
pure virtual |
Returns the label of transition t
.
|
pure virtual |
Returns the label of the i
-th tape on the transition t
(transducers only).
|
pure virtual |
Returns the label of all tapes on the transition t
(transducers only).
|
pure virtual |
Multiplies by w
on the left the weight of transition tr
.
|
pure virtual |
Returns the phony state, used for instance when no state is found.
|
pure virtual |
Returns the phony transition_t, used for instance when transition is found.
|
pure virtual |
Returns the number of final states in this abstract_automaton_t.
|
pure virtual |
Returns the number of initial states in this abstract_automaton_t.
|
pure virtual |
Returns the number of states in this abstract_automaton_t.
|
pure virtual |
Returns the number of transitions in this abstract_automaton_t.
[experimental] Gives the the origin of state s
, in the case where it comes from a single state.
|
pure virtual |
[experimental] Gives the origin of state s
, in the case where it comes from a tuple of states.
std::vector<transition_t> awali::dyn::abstract_automaton_t::out | ( | state_t | s, |
label_t | label | ||
) | const |
Alias to outgoing(state_t, label_t)const.
std::vector<transition_t> awali::dyn::abstract_automaton_t::out | ( | state_t | s, |
options_t | opts = {} |
||
) | const |
Alias to outgoing.
|
pure virtual |
Returns the transitions going out of state s
and labelled by label
.
std::vector<transition_t> awali::dyn::abstract_automaton_t::outgoing | ( | state_t | s, |
options_t | opts = {} |
||
) | const |
Returns the transitions going out ofstate s
.
s | |
opts | A set of options; only PREPOST_PARADIGM is meaningful. |
true
(default is false
), the initial transitions coming in s
are also returned.
|
pure virtual |
Returns all transitions going from src
to dst
.
|
pure virtual |
Returns the postfinal state.
See PREPOST_PARADIGM for details.
|
pure virtual |
Returns the preinitial state.
See PREPOST_PARADIGM for details.
|
pure virtual |
Returns the sources of all transitions coming in state s
.
|
pure virtual |
Returns the sources of all transitions labelled by label
that are coming in state s
.
|
pure virtual |
Multiplies by w
on the right the weight of transition tr
.
|
pure virtual |
Sets the description of this abstract_automaton_t.
When an automaton is output in JSON format, the description is written in the metadata section.
desc | New description of this abstract_automaton_t. |
|
pure virtual |
Sets an epsilon transition going from src
to dst
.
|
pure virtual |
Sets an epsilon transition going from src
to dst
and weighted by weight
.
|
pure virtual |
Sets state s
as final.
If this abstract_automaton_t is weighted over (W,+,x), this method sets the final weight of s
to the neutral element for x.
Sets final weight of state s
to w
(useful only for weightset automata).
|
pure virtual |
Sets state s
as initial.
If this abstract_automaton_t is weighted over (W,+,x), this method sets the initial weight of s
to the neutral element for x.
Sets initial weight of state s
to w
(useful only for weightset automata).
|
pure virtual |
Sets the name of this abstract_automaton_t.
name | The new name of this abstract_automaton_t. |
|
pure virtual |
Sets to name
the name of s
.
|
pure virtual |
[experimental] Sets the name of each state based on its history.
|
pure virtual |
Sets a transition going from src
to dst
and labelled by label
.
If this abstract_automaton_t is weighted over (W,+,x), this is the same as set_transition(src,dst,label,one)
where one is the neutral element for x.
|
pure virtual |
Sets (and possibly replaces) a transition going from src
to dst
, labelled by label
and with weight weight
.
If there is, prior to the call to this method, a transition going from src
to dst
and labelled by label
, its weight is overriden by weight
. Use add_transition if you want to add the weights instead.
|
pure virtual |
Sets to w
the weight of transition tr
.
|
pure virtual |
Returns the source state of transition t
.
Returns the states of this abstract_automaton_t.
opts | A set of options; Only PREPOST_PARADIGM is meaningful. |
true
(defaults is false
), the "preinitial" and postfinal states are also returned.
|
pure virtual |
Deletes all state history.
|
pure virtual |
Returns the destinations of all transitions going out of s
.
|
pure virtual |
Returns the destinations of all transitions labelled by label
going out of s
.
std::vector<transition_t> awali::dyn::abstract_automaton_t::transitions | ( | options_t | opts = {} | ) | const |
Returns the transitions in this abstract_automaton_t.
opts | A set of options; only PREPOST_PARADIGM is meaningful. |
true
(default is false
), the initial and final transitions are returned.
|
pure virtual |
Sets state s
as non-final.
If this abstract_automaton_t is weighted over (W,+,x), this method sets the final weight of s
to the neutral element for +.
|
pure virtual |
Sets state s
as non-initial.
If this abstract_automaton_t is weighted over (W,+,x), this method sets the initial weight of s
to the neutral element for +.
|
pure virtual |
Returns the weight of transition t
.