30#ifndef MCRL2_PBES_PBESINST_LAZY_H
31#define MCRL2_PBES_PBESINST_LAZY_H
43 std::unordered_set<propositional_variable_instantiation>
irrelevant;
52 if (contains(
todo, X))
57 std::unordered_set<propositional_variable_instantiation> tmp(
todo.begin(),
todo.end());
58 return tmp.size() ==
todo.size();
113 template <
typename FwdIter,
bool ThreadSafe>
117 const std::size_t thread_index)
121 for (FwdIter i = first; i != last; ++i)
129 else if (!contains(discovered, *i, thread_index))
140 std::unordered_set<propositional_variable_instantiation> new_irrelevant;
143 if (!contains(new_todo, x))
145 new_irrelevant.insert(x);
150 if (!contains(new_todo, x))
152 new_irrelevant.insert(x);
159 if (size_before != size_after)
213 if (equation_count > 0 && equation_count % 1000 == 0)
215 std::ostringstream out;
216 out <<
"Generated " << equation_count <<
" BES equations" << std::endl;
243 bool changed =
false;
367 std::atomic<std::size_t>& number_of_active_processes,
380 while (number_of_active_processes > 0)
394 const auto& phi = eqn.
formula();
396 R(psi_e, phi,
sigma);
411 <<
" with rank " << k << std::endl;
414 for (
auto i = occ.begin(); i != occ.end(); ++i)
431 number_of_active_processes--;
432 std::this_thread::sleep_for(std::chrono::milliseconds(100));
433 if (number_of_active_processes > 0)
435 number_of_active_processes++;
448 const std::size_t initialisation_thread_index = (number_of_threads==1?0:1);
449 std::atomic<std::size_t> number_of_active_processes = number_of_threads;
450 std::vector<std::thread> threads;
462 if (number_of_threads>1)
464 threads.reserve(number_of_threads);
465 for (std::size_t i = 1; i <= number_of_threads; ++i)
467 std::thread tr([&, i](){
470 number_of_active_processes,
475 threads.push_back(std::move(tr));
478 for (std::size_t i = 1; i <= number_of_threads; ++i)
486 const std::size_t single_thread_index=0;
489 number_of_active_processes,
A global variable for counting the number of BES equations in pbesinst and parity_game_generator....
A deque class in which aterms can be stored.
A set that assigns each element an unique index, and protects its internal terms en masse.
Generic substitution function.
Rewriter that operates on data expressions.
Component for selecting a subset of equations that are actually used in an encompassing specification...
bool is_mu() const
Returns true if the symbol is mu.
A rewriter that applies one point rule quantifier elimination to a PBES.
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
const fixpoint_symbol & symbol() const
Returns the fixpoint symbol of the equation.
const propositional_variable & variable() const
Returns the pbes variable of the equation.
parameterized boolean equation system
const data::data_specification & data() const
Returns the data specification.
const propositional_variable_instantiation & initial_state() const
Returns the initial state.
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the pbes.
const std::vector< pbes_equation > & equations() const
Returns the equations.
A PBES instantiation algorithm that uses a lazy strategy.
const pbes_equation_index & equation_index() const
const pbessolve_options & m_options
Algorithm options.
void next_todo(propositional_variable_instantiation &result)
virtual void on_report_equation(const std::size_t, const propositional_variable_instantiation &, const pbes_expression &, std::size_t)
Reports BES equations that are produced by the algorithm. This function is called for every BES equat...
virtual void on_end_while_loop()
This function is called right after the while loop is finished.
virtual bool solution_found(const propositional_variable_instantiation &) const
virtual ~pbesinst_lazy_algorithm()=default
virtual void rewrite_psi(const std::size_t, pbes_expression &result, const fixpoint_symbol &symbol, const propositional_variable_instantiation &X, const pbes_expression &psi)
pbes preprocess(const pbes &x) const
utilities::mutex m_todo_access
data::rewriter construct_rewriter(const pbes &pbesspec)
pbesinst_lazy_todo todo
The propositional variable instantiations that need to be handled.
volatile bool m_must_abort
propositional_variable_instantiation init
The initial value (after rewriting).
virtual void on_discovered_elements(const std::set< propositional_variable_instantiation > &)
This function is called when new elements are added to discovered.
std::size_t m_iteration_count
virtual void run()
Runs the algorithm. The result is obtained by calling the function get_result.
pbes_equation_index m_equation_index
A lookup map for PBES equations.
enumerate_quantifiers_rewriter m_global_R
The rewriter.
const fixpoint_symbol & symbol(std::size_t i) const
pbesinst_lazy_algorithm(const pbessolve_options &options, const pbes &p)
Constructor.
static void rewrite_true_false(pbes_expression &result, const fixpoint_symbol &symbol, const propositional_variable_instantiation &X, const pbes_expression &psi)
enumerate_quantifiers_rewriter & rewriter()
data::rewriter datar
Data rewriter.
virtual std::string status_message(std::size_t equation_count)
atermpp::indexed_set< propositional_variable_instantiation, true > discovered
The propositional variable instantiations that have been discovered (not necessarily handled).
virtual void run_thread(const std::size_t thread_index, pbesinst_lazy_todo &todo, std::atomic< std::size_t > &number_of_active_processes, data::mutable_indexed_substitution<> sigma, enumerate_quantifiers_rewriter R)
atermpp::deque< propositional_variable_instantiation > todo
std::unordered_set< propositional_variable_instantiation > irrelevant
const propositional_variable_instantiation & back() const
void insert(const propositional_variable_instantiation &x)
bool check_invariants() const
const propositional_variable_instantiation & front() const
const atermpp::deque< propositional_variable_instantiation > & elements() const
void set_todo(atermpp::deque< propositional_variable_instantiation > &new_todo)
void insert(FwdIter first, FwdIter last, const atermpp::indexed_set< propositional_variable_instantiation, ThreadSafe > &discovered, const std::size_t thread_index)
std::unordered_set< propositional_variable_instantiation > & irrelevant_elements()
const std::unordered_set< propositional_variable_instantiation > & irrelevant_elements() const
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
const core::identifier_string & name() const
const data::variable_list & parameters() const
Standard exception class for reporting runtime errors.
This is simply an exclusive lock based on the standard library with the ability to perform no locks w...
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
std::string print_list(const Container &v, const std::string &message="", bool print_index=false, bool boundary_spaces=true)
Creates a string representation of a container.
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.
data::mutable_map_substitution instantiate_global_variables(pbes &p)
Eliminates the global variables of a PBES, by substituting a constant value for them....
void check_bes_equation_limit(std::size_t size)
void replace_constants_by_variables(T &x, const data::rewriter &r, data::mutable_indexed_substitution<> &sigma, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Replace each constant data application c in x by a fresh variable v, and add extend the substitution ...
std::ostream & operator<<(std::ostream &os, const absinthe_strategy strategy)
pbes_expression order_quantified_variables(const pbes_expression &x, const data::data_specification &dataspec)
void find_function_symbols(const T &x, OutputIterator o)
void replace_propositional_variables(T &x, const Substitution &sigma, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Applies a propositional variable substitution.
void find_propositional_variable_instantiations(Container const &container, OutputIterator o)
Returns all data variables that occur in a range of expressions.
bool contains(const atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable > &c, const typename atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable >::key_type &v, const std::size_t thread_index=0)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void swap(atermpp::unprotected_aterm_core &t1, atermpp::unprotected_aterm_core &t2) noexcept
Swaps two aterms.
add your file description here.
add your file description here.
add your file description here.
add your file description here.
add your file description here.
add your file description here.
add your file description here.
add your file description here.
An attempt for improving the efficiency.
void clear_identifier_generator()
void thread_initialise()
Initialises this rewriter with thread dependent information.
enumerate_quantifiers_rewriter clone()
Create a clone of the rewriter in which the underlying rewriter is copied, and not passed as a shared...
std::size_t index(const core::identifier_string &name) const
Returns the index of the equation of the variable with the given name.
std::size_t rank(const core::identifier_string &name) const
Returns the rank of the equation of the variable with the given name.
search_strategy exploration_strategy
std::size_t number_of_threads
bool replace_constants_by_variables
data::rewrite_strategy rewrite_strategy
bool remove_unused_rewrite_rules
A rewriter that simplifies boolean expressions and quantifiers, and rewrites data expressions.
A rewriter that simplifies boolean expressions in a term.
add your file description here.