mCRL2
Loading...
Searching...
No Matches
explorer_options.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9/// \file mcrl2/lps/explorer_options.h
10/// \brief Options used by the state space explorer.
11
12#ifndef MCRL2_LPS_EXPLORER_OPTIONS_H
13#define MCRL2_LPS_EXPLORER_OPTIONS_H
14
15#include "mcrl2/core/detail/print_utility.h"
16#include "mcrl2/data/rewrite_strategy.h"
17#include "mcrl2/lps/multi_action.h"
18#include "mcrl2/lps/exploration_strategy.h"
19
20namespace mcrl2::lps
21{
22
24{
25 data::rewrite_strategy rewrite_strategy = data::rewrite_strategy::jitty;
26 exploration_strategy search_strategy;
30 bool cached = false;
31 bool global_cache = false;
32 bool confluence = false;
33 bool use_projections = false;
34#ifdef MCRL2_USE_CONTROL_FLOW
35 bool use_control_flow = false;
36#endif
37 bool detect_deadlock = false;
39 bool detect_divergence = false;
40 bool detect_action = false;
41 bool check_probabilities = false;
42 bool save_error_trace = false;
43 bool generate_traces = false;
45 bool save_at_end = false;
46 bool dfs_recursive = false;
48 bool rewrite_actions = true; // If false, this option prevents rewriting actions.
49 // Rewriting actions is only needed if they occur in the
50 // generated lts, or in traces.
60
61 // Constructor.
62 explorer_options() = default;
63
64 // Constructor.
65 explorer_options(data::rewrite_strategy rewr_strat)
66 : rewrite_strategy(rewr_strat)
67 {}
68
69 //
70 explorer_options(const explorer_options& other) = default;
71 explorer_options& operator=(const explorer_options& other) = default;
72};
73
74inline
76{
77 out << "rewrite-strategy = " << options.rewrite_strategy << std::endl;
78 out << "search-strategy = " << options.search_strategy << std::endl;
79 out << "cached = " << std::boolalpha << options.cached << std::endl;
80 out << "global-cache = " << std::boolalpha << options.global_cache << std::endl;
81 out << "confluence = " << std::boolalpha << options.confluence << std::endl;
82 out << "confluence-action = " << options.confluence_action << std::endl;
83 out << "use-projections = " << std::boolalpha << options.use_projections << std::endl;
84#ifdef MCRL2_USE_CONTROL_FLOW
85 out << "use-control-flow = " << std::boolalpha << options.use_control_flow << std::endl;
86#endif
87 out << "one-point-rule-rewrite = " << std::boolalpha << options.one_point_rule_rewrite << std::endl;
88 out << "replace-constants-by-variables = " << std::boolalpha << options.replace_constants_by_variables << std::endl;
89 out << "remove-unused-rewrite-rules = " << std::boolalpha << options.remove_unused_rewrite_rules << std::endl;
90 out << "check-probabilities = " << std::boolalpha << options.check_probabilities << std::endl;
91 out << "detect-deadlock = " << std::boolalpha << options.detect_deadlock << std::endl;
92 out << "detect-nondeterminism = " << std::boolalpha << options.detect_nondeterminism << std::endl;
93 out << "detect-divergence = " << std::boolalpha << options.detect_divergence << std::endl;
94 out << "detect-action = " << std::boolalpha << options.detect_action << std::endl;
95 out << "discard-lts-state-labels = " << std::boolalpha << options.discard_lts_state_labels << std::endl;
96 out << "save-error-trace = " << std::boolalpha << options.save_error_trace << std::endl;
97 out << "generate-traces = " << std::boolalpha << options.generate_traces << std::endl;
98 out << "suppress-progress-messages = " << std::boolalpha << options.suppress_progress_messages << std::endl;
99 out << "save-aut-at-end = " << std::boolalpha << options.save_at_end << std::endl;
100 out << "dfs-recursive = " << std::boolalpha << options.dfs_recursive << std::endl;
101 out << "max-states = " << options.max_states << std::endl;
102 out << "max-traces = " << options.max_traces << std::endl;
103 out << "todo-max = " << options.highway_todo_max << std::endl;
104 out << "threads = " << options.number_of_threads << std::endl;
105 out << "trace-prefix = " << options.trace_prefix << std::endl;
106 out << "trace-actions = " << core::detail::print_set(options.trace_actions) << std::endl;
107 out << "trace-multiactions = " << core::detail::print_set(options.trace_multiactions) << std::endl;
108 out << "actions-internal-for-divergencies = " << core::detail::print_set(options.actions_internal_for_divergencies) << std::endl;
109 return out;
110}
111
112} // namespace mcrl2::lps
113
114#endif // MCRL2_LPS_EXPLORER_OPTIONS_H
A list of aterm objects.
Definition aterm_list.h:26
A unordered_map class in which aterms can be stored.
const variable_list & variables() const
Definition abstraction.h:60
data_expression & operator=(data_expression &&) noexcept=default
existential quantification.
Definition exists.h:23
universal quantification.
Definition forall.h:25
Rewriter that operates on data expressions.
Definition rewriter.h:84
data_expression operator()(const data_expression &d) const
Rewrites a data expression.
Definition rewriter.h:161
\brief A data variable
Definition variable.h:25
std::vector< data::variable > m_process_parameters
Definition explorer.h:87
void make_timed_state(state &result, const state &s, const data::data_expression &t) const
Definition explorer.h:912
data::enumerator_algorithm m_global_enumerator
Definition explorer.h:77
void abort() override
Abort the state space generation.
Definition explorer.h:1196
lps::multi_action rewrite_action(const lps::multi_action &a, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr) const
Rewrite action a, and put it back in place.
Definition explorer.h:285
std::vector< state > generate_successors(const state &s0, const SummandSequence &summands, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator, const SummandSequence &confluent_summands=SummandSequence())
Definition explorer.h:701
std::condition_variable m_signal_global_todo_buffer_filled
Definition explorer.h:85
void compute_stochastic_state(stochastic_state &result, const stochastic_distribution &distribution, const DataExpressionSequence &next_state) const
Definition explorer.h:885
const state_type & make_state(const stochastic_state &s) const
Definition explorer.h:931
std::size_t m_n
Definition explorer.h:88
void generate_state_space(bool recursive, const StateType &s0, const SummandSequence &regular_summands, const SummandSequence &confluent_summands, indexed_set_for_states_type &discovered, DiscoverState discover_state=DiscoverState(), ExamineTransition examine_transition=ExamineTransition(), StartState start_state=StartState(), FinishState finish_state=FinishState(), DiscoverInitialState discover_initial_state=DiscoverInitialState())
const indexed_set_for_states_type & state_map() const
Returns a mapping containing all discovered states.
Definition explorer.h:1202
bool less_equal(const data::data_expression &t0, const data::data_expression &t1, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr) const
Definition explorer.h:144
const std::vector< data::variable > & process_parameters() const
Definition explorer.h:1217
const std::vector< explorer_summand > & confluent_summands() const
Definition explorer.h:1212
void set_process_parameter_values(const data::data_expression_list &values, data::mutable_indexed_substitution<> &sigma)
Definition explorer.h:1233
void set_process_parameter_values(const data::data_expression_list &values)
Definition explorer.h:1238
~explorer() override=default
std::set< data::function_symbol > add_real_operators(std::set< data::function_symbol > s) const
Definition explorer.h:746
data::enumerator_identifier_generator m_global_id_generator
Definition explorer.h:78
explorer(const Specification &lpsspec, const explorer_options &options_, const data::rewriter &rewr)
Definition explorer.h:793
void enumerate_solutions(const explorer_summand &summand, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::data_expression &condition, data::enumerator_algorithm<> &enumerator, EmitSolution emit_solution)
Definition explorer.h:342
Specification m_global_lpsspec
Definition explorer.h:80
data::data_expression_list process_parameter_values() const
Process parameter values for use in a single thread.
Definition explorer.h:1228
void generate_transitions(const explorer_summand &summand, const SummandSequence &confluent_summands, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::data_expression &condition, state_type &s1, atermpp::aterm key, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator, ReportTransition report_transition=ReportTransition())
Definition explorer.h:399
void generate_state_space_dfs_recursive(bool recursive, DiscoverState discover_state=DiscoverState(), ExamineTransition examine_transition=ExamineTransition(), TreeEdge tree_edge=TreeEdge(), BackEdge back_edge=BackEdge(), ForwardOrCrossEdge forward_or_cross_edge=ForwardOrCrossEdge(), FinishState finish_state=FinishState())
static constexpr bool is_timed
Definition explorer.h:56
const data::data_expression_list & initial_state() const
Definition explorer.h:866
void generate_state_space_thread(std::unique_ptr< todo_set > &todo, std::size_t thread_index, std::atomic< std::size_t > &number_of_active_processes, const SummandSequence &regular_summands, const SummandSequence &confluent_summands, indexed_set_for_states_type &discovered, DiscoverState discover_state, ExamineTransition examine_transition, StartState start_state, FinishState finish_state, data::rewriter thread_rewr, data::mutable_indexed_substitution<> thread_sigma)
void generate_state_space(bool recursive, DiscoverState discover_state=DiscoverState(), ExamineTransition examine_transition=ExamineTransition(), StartState start_state=StartState(), FinishState finish_state=FinishState(), DiscoverInitialState discover_initial_state=DiscoverInitialState())
Generates the state space, and reports all discovered states and transitions by means of callback fun...
indexed_set_for_states_type m_discovered
Definition explorer.h:100
state find_representative(state &u0, const SummandSequence &summands, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator)
Definition explorer.h:154
std::vector< explorer_summand > m_regular_summands
Definition explorer.h:92
const explorer_options m_options
Definition explorer.h:72
summand_cache_map global_cache
Definition explorer.h:98
const data::rewriter & get_rewriter() const
Definition explorer.h:872
data::data_expression_list m_initial_state
Definition explorer.h:89
std::mutex m_exclusive_state_access
Definition explorer.h:82
data::mutable_indexed_substitution m_global_sigma
Definition explorer.h:75
data::data_expression_list process_parameter_values(data::mutable_indexed_substitution<> &sigma) const
Definition explorer.h:1222
state_type make_state(const state &s) const
Definition explorer.h:919
lps::stochastic_distribution m_initial_distribution
Definition explorer.h:90
void compute_projected_state(lps::state &result, const DataExpressionSequence &next_state, const IndexSequence &I_w, data::mutable_indexed_substitution<> &sigma, const data::rewriter &rewr) const
Definition explorer.h:224
void compute_state(state &result, const DataExpressionSequence &v, data::mutable_indexed_substitution<> &sigma, const data::rewriter &rewr) const
Definition explorer.h:173
std::vector< explorer_summand > m_confluent_summands
Definition explorer.h:93
void compute_initial_stochastic_state(stochastic_state &result) const
Definition explorer.h:878
volatile std::atomic< bool > m_must_abort
Definition explorer.h:95
data::rewriter m_global_rewr
Definition explorer.h:76
void generate_state_space_dfs_iterative(const state &s0, std::unordered_set< state > &discovered, const SummandSequence &regular_summands, const SummandSequence &confluent_summands, DiscoverState discover_state=DiscoverState(), ExamineTransition examine_transition=ExamineTransition(), TreeEdge tree_edge=TreeEdge(), BackEdge back_edge=BackEdge(), ForwardOrCrossEdge forward_or_cross_edge=ForwardOrCrossEdge(), FinishState finish_state=FinishState())
void check_enumerator_solution(const data::data_expression &p_expression, const explorer_summand &summand, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr) const
Definition explorer.h:312
void compute_stochastic_state(stochastic_state &result, const stochastic_distribution &distribution, const DataExpressionSequence &next_state, data::mutable_indexed_substitution<> &sigma, const data::rewriter &rewr, const data::enumerator_algorithm<> &enumerator) const
Definition explorer.h:185
const std::vector< explorer_summand > & regular_summands() const
Definition explorer.h:1207
std::unique_ptr< todo_set > make_todo_set(const state &init)
Definition explorer.h:755
std::mutex m_global_todo_buffer_mutex
Definition explorer.h:84
std::unique_ptr< todo_set > make_todo_set(ForwardIterator first, ForwardIterator last)
Definition explorer.h:767
std::list< transition > out_edges(const state &s)
Definition explorer.h:894
std::vector< data::data_expression > timed_state
Definition explorer.h:103
void project(lps::state &result, const std::vector< std::size_t > &I_r, const data::mutable_indexed_substitution<> &sigma)
Definition explorer.h:383
std::list< transition > out_edges(const state &s, const SummandSequence &regular_summands, const SummandSequence &confluent_summands, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator)
Definition explorer.h:644
Specification preprocess(const Specification &lpsspec)
Definition explorer.h:126
std::list< transition > out_edges(const state &s, const std::size_t summand_index)
Definition explorer.h:902
bool is_confluent_tau(const multi_action &a)
Definition explorer.h:779
static constexpr bool is_stochastic
Definition explorer.h:55
void generate_state_space_dfs_iterative(bool recursive, DiscoverState discover_state=DiscoverState(), ExamineTransition examine_transition=ExamineTransition(), TreeEdge tree_edge=TreeEdge(), BackEdge back_edge=BackEdge(), ForwardOrCrossEdge forward_or_cross_edge=ForwardOrCrossEdge(), FinishState finish_state=FinishState())
void compute_stochastic_projected_state(stochastic_state &result, const stochastic_distribution &distribution, const DataExpressionSequence &next_state, const IndexSequence &I_w, data::mutable_indexed_substitution<> &sigma, const data::rewriter &rewr, data::enumerator_algorithm<> &enumerator) const
Definition explorer.h:243
\brief A timed multi-action
const process::action_list & actions() const
const data::data_expression & time() const
Simulation process.
Definition simulation.h:22
void enable_auto_select_probability(bool enable)
If enabled, automatically a probabilistic state is chosen using its intrinsic probability.
void select_transition(std::size_t transition_number)
Choose outgoing transition indexed by transition_number and add its state to the state vector.
void add_new_state(const lps::stochastic_state &s)
std::uniform_int_distribution< std::size_t > m_distrib
Definition simulation.h:87
std::deque< simulator_state_t > m_full_trace
Definition simulation.h:90
void randomly_select_state()
Randomly choose one state among a sequence of probabilistic states.
bool m_auto_select_probabilistic_state
Definition simulation.h:85
void select_state(std::size_t state_number)
Choose one state among a sequence of probabilistic states.
simulation(const stochastic_specification &specification, data::rewrite_strategy strategy=data::rewrite_strategy())
Constructor.
void randomly_select_transition()
Randomly choose an outgoing transition and add its state to the state vector.
std::vector< transition_type > transitions(const lps::state &source_state)
bool match_trace_transition(lts::trace &trace)
void environment(std::vector< std::string > values)
Goto the state indicated by the environment, which is given by a vector of strings.
virtual ~simulation()=default
bool match_trace_probabilistic_state(lts::trace &trace)
data::rewriter m_rewriter
Definition simulation.h:83
void save(const std::string &filename) const
Save the trace to a file.
bool probabilistic_state_must_be_selected(const std::size_t state_index) const
Indicate whether a probabilistic state has been selected.
Definition simulation.h:63
explorer_type m_explorer
Definition simulation.h:84
const std::deque< simulator_state_t > & trace() const
Returns the current annotated state vector.
Definition simulation.h:42
stochastic_specification m_specification
Definition simulation.h:82
void truncate(std::size_t state_number, bool probabilistic)
Remove states from the end of the simulation, making state_number the last state.
void load(const std::string &filename)
Load a trace from a file.
\brief A stochastic distribution
bool is_defined() const
Returns true if the distribution is defined, i.e. it contains a valid distribution....
This class contains a trace consisting of a sequence of (timed) actions possibly with intermediate st...
Definition trace.h:51
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:435
Namespace for system defined sort bool_.
Definition bool.h:29
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:74
Namespace for system defined sort real_.
data_expression & real_one()
data_expression & real_zero()
std::set< variable > find_quantifier_variables(const data_expression &x)
bool is_false(const data_expression &x)
Test if x is false.
Definition consistency.h:36
void add_assignments(data::mutable_indexed_substitution<> &sigma, const VariableSequence &v, const DataExpressionSequence &e)
Adds assignments [v := e] to the substitution sigma for each variable in v.
void remove_assignments(data::mutable_indexed_substitution<> &sigma, const VariableSequence &v)
Removes assignments to variables in v from the substitution sigma.
application greater_equal(const data_expression &arg0, const data_expression &arg1)
Application of function symbol >=.
Definition standard.h:374
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
The main namespace for the LPS library.
Definition constelm.h:18
void check_stochastic_state(const stochastic_state &s, const data::rewriter &rewr)
void check_probability(const data::data_expression &x, const data::rewriter &rewr)
std::ostream & operator<<(std::ostream &out, const explorer_options &options)
std::string print_probability(const data::data_expression &x)
The main namespace for the Process library.
Visitor for collecting the quantifier variables that occur in a pbes expression.
transition(lps::multi_action action_, const state_type &state_)
Definition explorer.h:65
std::set< core::identifier_string > actions_internal_for_divergencies
std::set< core::identifier_string > trace_actions
explorer_options(data::rewrite_strategy rewr_strat)
exploration_strategy search_strategy
explorer_options & operator=(const explorer_options &other)=default
std::set< lps::multi_action > trace_multiactions
explorer_options(const explorer_options &other)=default
std::vector< transition_type > transitions
Definition simulation.h:33
void push_back(const data::data_expression &probability, const state &s)
std::vector< data::data_expression > probabilities
std::vector< state > states