12#ifndef MCRL2_LTS_DETAIL_FSM_BUILDER_H
13#define MCRL2_LTS_DETAIL_FSM_BUILDER_H
22inline std::string
split_string_until(std::string& s,
const std::string& c1,
const std::string& c2=
"")
24 std::size_t n=s.find(c1);
27 n=std::min(n,s.find(c2));
29 if (n==std::string::npos)
37 throw mcrl2::runtime_error(
"Expect either '" + c1 +
"' or '" + c2 +
" in distribution " + s +
".");
40 std::string result=s.substr(0,n);
47 if (distribution.find(
'[')==std::string::npos)
58 std::vector<lts_fsm_base::state_probability_pair> result;
60 if (s.substr(0,1) !=
"[")
68 if (state_number == 0)
95 const std::string&
name()
const
105 const std::string&
sort()
const
126 const std::vector<std::string>&
values()
const
216 std::map<std::string, std::size_t>
labels;
233 if (distribution.
size()>1)
237 max = std::max(
max, p.state());
280 void add_parameter(
const std::string& name,
const std::string& cardinality,
const std::string& sort,
const std::vector<std::string>& domain_values)
282 parameters.emplace_back(name, cardinality, sort, domain_values);
302 std::size_t index = 0;
305 if (param.cardinality() > 0)
307 fsm.add_process_parameter(param.name(), param.sort());
308 for (
const std::string& value: param.values())
310 fsm.add_state_element_value(index, value);
This class contains strings to be used as values for action labels in lts's.
static const action_label_string & tau_action()
std::vector< std::string > m_values
std::size_t m_cardinality
const std::vector< std::string > & values() const
std::size_t cardinality() const
const std::string & name() const
fsm_parameter(const std::string &name, const std::string &cardinality, const std::string &sort, const std::vector< std::string > &values)
std::vector< std::string > & values()
const std::string & sort() const
std::size_t & cardinality()
const std::string & label() const
const lts_fsm_base::probabilistic_state & target() const
lts_fsm_base::probabilistic_state & target()
fsm_transition(std::size_t source, std::size_t target, const std::string &label)
fsm_transition(const std::string &source_text, const std::string &target_text, const std::string &label)
detail::lts_fsm_base::probabilistic_state m_target
std::size_t source() const
void add_transition(const transition &t)
Add a transition to the lts.
states_size_type num_states() const
Gets the number of states of this LTS.
void set_num_states(const states_size_type n, const bool has_state_labels=true)
Sets the number of states of this LTS.
bool has_state_info() const
Checks whether this LTS has state values associated with its states.
std::vector< action_label_string >::size_type labels_size_type
The sort that represents the indices of labels.
states_size_type add_state(const STATE_LABEL_T &label=STATE_LABEL_T())
Adds a state to this LTS.
labels_size_type add_action(const ACTION_LABEL_T &label)
Adds an action with a label to this LTS.
The class lts_fsm_t contains labelled transition systems in .fsm format.
void set_initial_probabilistic_state(const PROBABILISTIC_STATE_T &state)
Sets the probabilistic initial state number of this LTS.
void clear()
Clear the transitions system.
states_size_type add_probabilistic_state(const PROBABILISTIC_STATE_T &s)
Adds a probabilistic state to this LTS.
std::size_t size() const
Gets the number of probabilistic states in the vector representation of this state....
STATE get() const
Get a probabilistic state if is is simple, i.e., consists of a single state.
This class contains state labels for the fsm format.
A class containing triples, source label and target representing transitions.
Standard exception class for reporting runtime errors.
This class contains labels for probabilistic transistions, consisting of a numerator and a denominato...
This file contains a class that contains labelled transition systems in fsm format.
data_expression max(const data_expression &e1, const data_expression &e2, const rewriter &)
A base class for the lts_dot labelled transition system.
std::string split_string_until(std::string &s, const std::string &c1, const std::string &c2="")
lts_fsm_base::probabilistic_state parse_distribution(const std::string &distribution)
std::size_t label(const outgoing_pair_t &p)
Label of a pair of a label and target state.
std::size_t parse_natural_number(const std::string &text)
Parses a natural number from a string.
std::string trim_copy(const std::string &text)
Remove all trailing and leading spaces from the input.
add your file description here.
fsm_builder(probabilistic_lts_fsm_t &fsm_)
std::map< std::string, std::size_t > labels
void add_initial_distribution(const std::string &distribution)
void add_state(const std::vector< std::size_t > &values)
probabilistic_lts_fsm_t & fsm
void add_parameter(const std::string &name, const std::string &cardinality, const std::string &sort, const std::vector< std::string > &domain_values)
void add_transition(const std::string &source, const std::string &target, const std::string &label)
bool m_initial_state_is_set
std::vector< fsm_parameter > parameters
std::size_t find_maximal_state_index(const lts_fsm_base::probabilistic_state &distribution)