12#ifndef MCRL2_LTS_STOCHASTIC_LTS_BUILDER_H
13#define MCRL2_LTS_STOCHASTIC_LTS_BUILDER_H
45 virtual void set_initial_state(
const std::list<std::size_t>& targets,
const std::vector<data::data_expression>& probabilities) = 0;
48 virtual void add_transition(std::size_t
from,
const lps::multi_action& a,
const std::list<std::size_t>& targets,
const std::vector<data::data_expression>& probabilities,
const std::size_t number_of_threads = 1) = 0;
54 virtual void save(
const std::string& filename) = 0;
62 void set_initial_state(
const std::list<std::size_t>& ,
const std::vector<data::data_expression>& )
override
65 void add_transition(std::size_t ,
const lps::multi_action& ,
const std::list<std::size_t>& ,
const std::vector<data::data_expression>& ,
const std::size_t )
override
71 void save(
const std::string& )
override
85 stochastic_state(std::list<std::size_t> targets_, std::vector<data::data_expression> probabilities_)
109 transition(std::size_t from_, std::size_t label_, std::size_t to_)
128 void set_initial_state(
const std::list<std::size_t>& targets,
const std::vector<data::data_expression>& probabilities)
override
134 void add_transition(std::size_t
from,
const lps::multi_action& a,
const std::list<std::size_t>& targets,
const std::vector<data::data_expression>& probabilities,
const std::size_t number_of_threads)
override
150 void save(std::ostream& out)
const
152 std::vector<lps::multi_action> actions{
m_actions.size() };
155 actions[p.second] = p.first;
164 out <<
"(" << t.from <<
",\"" <<
lps::pp(actions[t.label]) <<
"\",";
171 void save(
const std::string& filename)
override
173 if (filename.empty())
179 std::ofstream out(filename.c_str());
203 bool discard_state_labels =
false
207 m_lts.set_data(dataspec);
208 m_lts.set_process_parameters(process_parameters);
209 m_lts.set_action_label_declarations(action_labels);
216 assert(targets.size()>0);
217 if (targets.size()==1)
219 result.
set(targets.front());
223 std::list<std::size_t>::const_iterator ti = targets.begin();
224 std::vector<data::data_expression>::const_iterator pi = probabilities.begin();
225 for (; ti != targets.end(); ++pi, ++ti)
234 void set_initial_state(
const std::list<std::size_t>& targets,
const std::vector<data::data_expression>& probabilities)
override
240 void add_transition(std::size_t
from,
const lps::multi_action& a,
const std::list<std::size_t>& targets,
const std::vector<data::data_expression>& probabilities,
const std::size_t number_of_threads)
override
264 std::size_t n = state_map.
size();
265 std::vector<state_label_lts> state_labels(n);
266 for (std::size_t i = 0; i < n; i++)
285 void save(
const std::string& filename)
override
296 :
super(dataspec, action_labels, process_parameters)
299 void save(
const std::string& filename)
override
310 switch (output_format)
312 case lts_aut:
return std::make_unique<stochastic_lts_aut_builder>();
315 default:
return std::make_unique<stochastic_lts_none_builder>();
A set that assigns each element an unique index, and protects its internal terms en masse.
const data::variable_list & process_parameters() const
Returns the sequence of process parameters.
\brief A timed multi-action
This class contains labels for probabilistic transistions, consisting of a numerator and a denumerato...
const process::action_label_list & action_labels() const
Returns a sequence of action labels. This sequence contains all action labels occurring in the specif...
const LinearProcess & process() const
Returns the linear process of the specification.
const data::data_specification & data() const
Returns the data specification.
Linear process specification.
A class containing the values for action labels for the .lts format.
void add_transition(const transition &t)
Add a transition to the lts.
void set_num_action_labels(const labels_size_type n)
Sets the number of action labels 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.
std::vector< STATE_LABEL_T > & state_labels()
Provides the state labels of an LTS.
void set_action_label(const labels_size_type action, const ACTION_LABEL_T &label)
Sets the label of an action.
The class lts_fsm_t contains labelled transition systems in .fsm format.
void save(const std::string &filename) const
Save the labelled transition system to file.
This class contains probabilistic labelled transition systems in .lts format.
void save(const std::string &filename) const
Save the labelled transition system to file.
void set_initial_probabilistic_state(const PROBABILISTIC_STATE_T &state)
Sets the probabilistic initial state number of this LTS.
states_size_type add_probabilistic_state(const PROBABILISTIC_STATE_T &s)
Adds a probabilistic state to this LTS.
A class that contains a probabilistic state.
void set(const STATE &s)
Set this probabilistic state to a single state with probability one.
void add(const STATE &s, const PROBABILITY &p)
Add a state with a probability to the probabilistic state.
This class contains state labels for an labelled transition system in .lts format.
void save(const std::string &filename) override
void finalize(const indexed_set_for_states_type &state_map, bool) override
void add_transition(std::size_t from, const lps::multi_action &a, const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities, const std::size_t number_of_threads) override
void save(std::ostream &out) const
std::size_t m_number_of_states
stochastic_lts_aut_builder()=default
std::mutex m_exclusive_transition_access
std::vector< transition > m_transitions
std::vector< stochastic_state > m_stochastic_states
void set_initial_state(const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities) override
stochastic_lts_lts_builder super
void save(const std::string &filename) override
stochastic_lts_fsm_builder(const data::data_specification &dataspec, const process::action_label_list &action_labels, const data::variable_list &process_parameters)
std::mutex m_exclusive_transition_access
probabilistic_lts_lts_t m_lts
void save(const std::string &filename) override
probabilistic_state< std::size_t, lps::probabilistic_data_expression > m_initial_state
static probabilistic_state< std::size_t, lps::probabilistic_data_expression > make_probabilistic_state(const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities)
stochastic_lts_lts_builder(const data::data_specification &dataspec, const process::action_label_list &action_labels, const data::variable_list &process_parameters, bool discard_state_labels=false)
bool m_discard_state_labels
void add_transition(std::size_t from, const lps::multi_action &a, const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities, const std::size_t number_of_threads) override
void set_initial_state(const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities) override
void finalize(const indexed_set_for_states_type &state_map, bool timed) override
void save(const std::string &) override
void set_initial_state(const std::list< std::size_t > &, const std::vector< data::data_expression > &) override
void finalize(const indexed_set_for_states_type &, bool) override
void add_transition(std::size_t, const lps::multi_action &, const std::list< std::size_t > &, const std::vector< data::data_expression > &, const std::size_t) override
A class containing triples, source label and target representing transitions.
Standard exception class for reporting runtime errors.
size_type size(std::size_t thread_index=0) const
The number of elements in the indexed set.
A class for a map of keys to values in T based using the simple hash table set implementation.
add your file description here.
const data::data_expression & undefined_real()
Returns a data expression of type Real that corresponds to 'undefined'.
std::string pp(const action_summand &x)
std::string print_probability(const data::data_expression &x)
void lts_convert(const lts< STATE_LABEL1, ACTION_LABEL1, LTS_BASE1 > <s_in, lts< STATE_LABEL2, ACTION_LABEL2, LTS_BASE2 > <s_out)
lts_type
The enumerated type lts_type contains an index for every type type of labelled transition system that...
std::size_t to(const outgoing_pair_t &p)
Target state of a label state pair.
std::unique_ptr< stochastic_lts_builder > create_stochastic_lts_builder(const lps::stochastic_specification &lpsspec, const lps::explorer_options &options, lts_type output_format)
std::size_t label(const outgoing_pair_t &p)
Label of a pair of a label and target state.
std::size_t from(const outgoing_transitions_per_state_action_t::const_iterator &i)
From state of an iterator exploring transitions per outgoing state and action.
lps::state remove_time_stamp(const lps::state &s)
Removes the last element from state s.
static constexpr bool GlobalThreadSafe
Enables thread safety for the whole toolset.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
bool discard_lts_state_labels
std::vector< data::data_expression > probabilities
stochastic_state()=default
stochastic_state(std::list< std::size_t > targets_, std::vector< data::data_expression > probabilities_)
void save_to_aut(std::ostream &out) const
std::list< std::size_t > targets
bool operator<(const transition &other) const
transition(std::size_t from_, std::size_t label_, std::size_t to_)
utilities::unordered_map_large< lps::multi_action, std::size_t > m_actions
virtual ~stochastic_lts_builder()=default
virtual void save(const std::string &filename)=0
virtual void set_initial_state(const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities)=0
atermpp::indexed_set< lps::state, mcrl2::utilities::detail::GlobalThreadSafe > indexed_set_for_states_type
std::size_t add_action(const lps::multi_action &a)
virtual void add_transition(std::size_t from, const lps::multi_action &a, const std::list< std::size_t > &targets, const std::vector< data::data_expression > &probabilities, const std::size_t number_of_threads=1)=0
virtual void finalize(const indexed_set_for_states_type &state_map, bool timed)=0