12#ifndef MCRL2_LTS_BUILDER_H
13#define MCRL2_LTS_BUILDER_H
46 auto i =
m_actions.find(sorted_multi_action);
61 virtual void save(
const std::string& filename) = 0;
75 void save(
const std::string& )
override
109 void save(
const std::string& filename)
override
126 mCRL2log(
log::verbose) <<
"writing state space in AUT format to '" << filename <<
"'." << std::endl;
127 out.open(filename.c_str());
157 void save(
const std::string& )
override
173 bool discard_state_labels =
false
203 std::size_t n = state_map.
size();
204 std::vector<state_label_lts> state_labels(n);
205 for (std::size_t i = 0; i < n; i++)
223 void save(
const std::string& filename)
override
233 std::unique_ptr<atermpp::binary_aterm_ostream>
stream;
239 const std::string& filename,
243 bool discard_state_labels =
false
247 bool to_stdout = filename.empty() || filename ==
"-";
250 fstream.open(filename, std::ofstream::out | std::ofstream::binary);
256 mCRL2log(
log::verbose) <<
"writing state space in LTS format to '" << filename <<
"'." << std::endl;
258 stream = std::make_unique<atermpp::binary_aterm_ostream>(to_stdout ? std::cout :
fstream);
276 for (std::size_t i = 0; i < state_map.
size(); i++)
278 if (is_aterm_balanced_tree(state_map[i]))
296 void save(
const std::string&)
override {}
304 :
super(dataspec, action_labels, process_parameters)
307 void save(
const std::string& filename)
override
320 :
super(dataspec, action_labels, process_parameters)
323 void save(
const std::string& filename)
override
334 switch (output_format)
340 return std::make_unique<lts_aut_builder>();
344 return std::make_unique<lts_aut_disk_builder>(output_filename);
360 default:
return std::make_unique<lts_none_builder>();
A set that assigns each element an unique index, and protects its internal terms en masse.
Read-only balanced binary tree of terms.
size_type size() const
Returns the size of the term_balanced_tree.
iterator begin() const
Returns an iterator pointing to the beginning of the term_balanced_tree.
const data::variable_list & process_parameters() const
Returns the sequence of process parameters.
\brief A timed multi-action
multi_action sort_actions() const
Returns the multiaction in which the list of actions is sorted.
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.
This class contains strings to be used as values for action labels in lts's.
void set_process_parameters(const data::variable_list ¶ms)
Set the state parameters for this LTS.
void set_action_label_declarations(const process::action_label_list &decls)
Set the action label information for this LTS.
void set_data(const data::data_specification &spec)
Set the mCRL2 data specification of this LTS.
void save(const std::string &filename) override
lts_aut_builder()=default
std::mutex m_exclusive_transition_access
void add_transition(std::size_t from, const lps::multi_action &a, std::size_t to, const std::size_t number_of_threads) override
void finalize(const indexed_set_for_states_type &state_map, bool) override
void finalize(const indexed_set_for_states_type &state_map, bool) override
void save(const std::string &) override
void add_transition(std::size_t from, const lps::multi_action &a, std::size_t to, const std::size_t number_of_threads) override
lts_aut_disk_builder(const std::string &filename)
std::mutex m_exclusive_transition_access
std::size_t m_transition_count
A simple labelled transition format with only strings as action labels.
void save(const std::string &filename) const
Save the labelled transition system to file.
void save(const std::string &filename) override
lts_dot_builder(const data::data_specification &dataspec, const process::action_label_list &action_labels, const data::variable_list &process_parameters)
A class to contain labelled transition systems in graphviz format.
void save(std::ostream &os) const
Save the labelled transition system to a stream.
void save(const std::string &filename) override
lts_fsm_builder(const data::data_specification &dataspec, const process::action_label_list &action_labels, const data::variable_list &process_parameters)
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.
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)
void add_transition(std::size_t from, const lps::multi_action &a, std::size_t to, const std::size_t number_of_threads) override
void save(const std::string &filename) override
bool m_discard_state_labels
void finalize(const indexed_set_for_states_type &state_map, bool timed) override
std::mutex m_exclusive_transition_access
void add_transition(std::size_t from, const lps::multi_action &a, std::size_t to, const std::size_t number_of_threads) override
std::unique_ptr< atermpp::binary_aterm_ostream > stream
bool m_discard_state_labels
lts_lts_disk_builder(const std::string &filename, const data::data_specification &dataspec, const process::action_label_list &action_labels, const data::variable_list &process_parameters, bool discard_state_labels=false)
std::mutex m_exclusive_transition_access
void finalize(const indexed_set_for_states_type &state_map, bool timed) override
void save(const std::string &) override
This class contains labelled transition systems in .lts format.
void save(const std::string &filename) const
Save the labelled transition system to file.
void finalize(const indexed_set_for_states_type &, bool) override
void add_transition(std::size_t, const lps::multi_action &, std::size_t, const std::size_t) override
void save(const std::string &) override
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_initial_state(const states_size_type state)
Sets the initial state number of this LTS.
void set_action_label(const labels_size_type action, const ACTION_LABEL_T &label)
Sets the label of an action.
This class contains state labels for an labelled transition system in .lts format.
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.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
This file contains lts_convert routines that translate different lts formats into each other.
This include file contains routines to read and write labelled transitions from and to files and from...
const data::data_expression & undefined_real()
Returns a data expression of type Real that corresponds to 'undefined'.
atermpp::term_balanced_tree< data::data_expression > state
std::string pp(const action_summand &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.
void write_lts_header(atermpp::aterm_ostream &stream, const data::data_specification &data, const data::variable_list ¶meters, const process::action_label_list &action_labels)
Writes the start of an LTS stream.
void write_initial_state(atermpp::aterm_ostream &stream, std::size_t index)
Write the initial state to the LTS stream.
void write_state_label(atermpp::aterm_ostream &stream, const state_label_lts &label)
Write a state label to the LTS stream.
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.
void write_transition(atermpp::aterm_ostream &stream, std::size_t from, const lps::multi_action &label, std::size_t to)
Write a transition to the LTS stream.
lps::state remove_time_stamp(const lps::state &s)
Removes the last element from state s.
std::unique_ptr< lts_builder > create_lts_builder(const lps::specification &lpsspec, const lps::explorer_options &options, lts_type output_format, const std::string &output_filename="")
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
virtual ~lts_builder()=default
virtual void add_transition(std::size_t from, const lps::multi_action &a, std::size_t to, const std::size_t number_of_threads=0)=0
atermpp::indexed_set< lps::state, mcrl2::utilities::detail::GlobalThreadSafe > indexed_set_for_states_type
virtual void finalize(const indexed_set_for_states_type &state_map, bool timed)=0
utilities::unordered_map_large< lps::multi_action, std::size_t > m_actions
virtual void save(const std::string &filename)=0
std::size_t add_action(const lps::multi_action &a)