12#ifndef MCRL2_LPS_EXPLORER_H
13#define MCRL2_LPS_EXPLORER_H
49 default: os.setstate(std::ios_base::failbit);
57 return std::vector<data::data_expression>(v.
begin(), v.
end());
73 template<
typename ForwardIterator>
74 todo_set(ForwardIterator first, ForwardIterator last)
82 result =
todo.front();
99 virtual std::size_t
size()
const
116 template<
typename ForwardIterator>
123 result =
todo.front();
150 template<
typename ForwardIterator>
157 result =
todo.back();
186 template<
typename ForwardIterator>
192 for(ForwardIterator i=first; i!=last; ++i)
205 result =
todo.front();
217 std::uniform_int_distribution<> distribution(0,
n-1);
228 std::size_t
size()
const override
243template <
typename Summand>
246 static stochastic_distribution empty_distribution;
247 return empty_distribution;
260 return empty_distribution;
294 std::vector<data::variable>::const_iterator i=key2.
m_gamma.begin();
342 detail::cache_equality,
343 std::allocator< std::pair<atermpp::aterm, atermpp::term_list<data::data_expression_list>> >,
363 template <
typename ActionSummand>
365 :
variables(summand.summation_variables()),
370 index(summand_index),
381 template <
typename T>
386 std::vector<data::variable> result;
389 if (contains(FV, vi))
391 result.push_back(vi);
402 bool is_first_element =
true;
406 if (is_first_element)
408 is_first_element = false;
412 sigma.apply(x, result);
422 sigma.apply(x, result);
446template <
bool Stochastic,
bool Timed,
typename Specification>
450 using state_type =
typename std::conditional<Stochastic, stochastic_state, state>::type;
451 using state_index_type =
typename std::conditional<Stochastic, std::list<std::size_t>, std::size_t>::type;
453 static constexpr bool is_timed = Timed;
464 : action(
std::move(action_)),
state(state_)
486 bool m_recursive =
false;
490 volatile std::atomic<bool> m_must_abort =
false;
502 Specification result = lpsspec;
503 detail::instantiate_global_variables(result);
504 lps::order_summand_variables(result);
505 resolve_summand_variable_name_clashes(result);
508 one_point_rule_rewrite(result);
523 return rewr(data::less_equal(t0, t1),
sigma) == data::sort_bool::true_();
527 template <
typename SummandSequence>
529 const SummandSequence& summands,
535 bool recursive_undo = m_recursive;
538 state result = lps::find_representative(u0,
540 {
return generate_successors(u, summands,
sigma, rewr, enumerator, id_generator); });
541 set_process_parameter_values(process_parameter_undo,
sigma);
542 m_recursive = recursive_undo;
546 template <
typename DataExpressionSequence>
548 const DataExpressionSequence& v,
552 lps::make_state(result,
558 template <
typename DataExpressionSequence>
561 const DataExpressionSequence& next_state,
577 result.
states.emplace_back();
578 compute_state(result.
states.back(), next_state,
sigma, rewr);
592 result.
states.emplace_back();
593 compute_state(result.
states.back(),next_state,
sigma,rewr);
611 const data::data_expression_list& args = a.arguments();
612 return process::make_action(result,
614 data::data_expression_list(args.begin(),
616 [&](data::data_expression& result,
617 const data::data_expression& x) -> void
618 { rewr(result, x, sigma); }));
621 a.has_time() ? rewr(time,
sigma) : time
630 if (p_expression != data::sort_bool::true_())
632 std::string printed_condition = data::pp(p_expression);
633 data::remove_assignments(
sigma, m_process_parameters);
637 " does not rewrite to true or false. \nCulprit: "
638 + printed_condition.substr(0,300)
639 + (printed_condition.size() > 300 ?
"..." :
""));
645 template <
typename SummandSequence,
typename ReportTransition = utilities::skip>
648 const SummandSequence& confluent_summands,
656 ReportTransition report_transition = ReportTransition()
659 bool variables_are_assigned_to_sigma=
false;
662 id_generator.
clear();
667 if (!data::is_false(condition))
672 check_enumerator_solution(condition, summand,
sigma,rewr);
674 if constexpr (Stochastic)
681 if (!confluent_summands.empty())
689 report_transition(s1);
696 report_transition(a,s1);
711 check_enumerator_solution(p.expression(), summand,
sigma, rewr);
713 variables_are_assigned_to_sigma=
true;
715 if constexpr (Stochastic)
722 if (!confluent_summands.empty())
727 if (m_recursive && variables_are_assigned_to_sigma)
730 variables_are_assigned_to_sigma=
false;
735 report_transition(s1);
742 report_transition(a,s1);
763 if (q == cache.
end())
768 if (!data::is_false(condition))
775 check_enumerator_solution(p.expression(), summand,
sigma, rewr);
783 q = cache.
insert({key, solutions}).first;
793 variables_are_assigned_to_sigma=
true;
794 if constexpr (Stochastic)
801 if (!confluent_summands.empty())
806 if (m_recursive && variables_are_assigned_to_sigma)
809 variables_are_assigned_to_sigma=
false;
814 report_transition(s1);
821 report_transition(a,s1);
831 if (!m_recursive && variables_are_assigned_to_sigma)
837 template <
typename SummandSequence>
839 const SummandSequence& regular_summands,
840 const SummandSequence& confluent_summands,
850 std::list<transition> transitions;
851 data::add_assignments(
sigma, m_process_parameters, s);
854 generate_transitions(
874 make_timed_state(state_, s1, t1);
875 transitions.emplace_back(a, state_);
879 transitions.emplace_back(a, s1);
888 template <
typename SummandSequence>
891 const SummandSequence& summands,
896 const SummandSequence& confluent_summands = SummandSequence()
902 std::vector<state> result;
903 data::add_assignments(
sigma, m_process_parameters, s0);
906 generate_transitions(
919 result.push_back(s1);
930 std::set<data::function_symbol> result = std::move(s);
931 result.insert(data::less_equal(data::sort_real::real_()));
932 result.insert(data::greater_equal(data::sort_real::real_()));
933 result.insert(data::sort_real::plus(data::sort_real::real_(), data::sort_real::real_()));
941 case lps::es_breadth:
return std::make_unique<breadth_first_todo_set>(
init);
942 case lps::es_depth:
return std::make_unique<depth_first_todo_set>(
init);
943 case lps::es_highway:
return std::make_unique<highway_todo_set>(
init, m_options.
highway_todo_max);
948 template <
typename ForwardIterator>
949 std::unique_ptr<todo_set>
make_todo_set(ForwardIterator first, ForwardIterator last)
953 case lps::es_breadth:
return std::make_unique<breadth_first_todo_set>(first, last);
954 case lps::es_depth:
return std::make_unique<depth_first_todo_set>(first, last);
955 case lps::es_highway:
return std::make_unique<highway_todo_set>(first, last, m_options.
highway_todo_max);
962 if (remove_unused_rewrite_rules)
989 : m_options(options_),
990 m_global_rewr(construct_rewriter(lpsspec, m_options.remove_unused_rewrite_rules)),
991 m_global_enumerator(m_global_rewr, lpsspec.data(), m_global_rewr, m_global_id_generator, false),
992 m_global_lpsspec(preprocess(lpsspec)),
993 m_discovered(m_options.number_of_threads)
996 m_process_parameters = std::vector<data::variable>(params.
begin(), params.
end());
997 m_n = m_process_parameters.size();
998 timed_state.resize(m_n + 1);
999 m_initial_state = m_global_lpsspec.initial_process().expressions();
1003 const auto& lpsspec_summands = m_global_lpsspec.process().action_summands();
1004 for (std::size_t i = 0; i < lpsspec_summands.size(); i++)
1006 const auto& summand = lpsspec_summands[i];
1007 caching cache_strategy = m_options.
cached ? (m_options.
global_cache ? lps::caching::global : lps::caching::local) : lps::caching::none;
1010 m_confluent_summands.emplace_back(summand, i, m_global_lpsspec.process().process_parameters(), cache_strategy);
1014 m_regular_summands.emplace_back(summand, i, m_global_lpsspec.process().process_parameters(), cache_strategy);
1024 return m_initial_state;
1030 return m_global_rewr;
1037 return out_edges(s, m_regular_summands, m_confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator);
1045 assert(summand_index<m_regular_summands.size());
1047 std::vector(1, m_regular_summands[summand_index]),
1048 m_confluent_summands,
1049 m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator);
1055 std::copy(s.
begin(), s.
end(), timed_state.begin());
1056 timed_state.back() = t;
1057 lps::make_state(result, timed_state.
begin(), m_n + 1);
1062 if constexpr (Stochastic)
1079 typename SummandSequence,
1087 std::unique_ptr<todo_set>& todo,
1088 const std::size_t thread_index,
1089 std::atomic<std::size_t>& number_of_active_processes,
1090 std::atomic<std::size_t>& number_of_idle_processes,
1091 const SummandSequence& regular_summands,
1092 const SummandSequence& confluent_summands,
1094 DiscoverState discover_state,
1095 ExamineTransition examine_transition,
1096 StartState start_state,
1097 FinishState finish_state,
1103 mCRL2log(log::debug) <<
"Start thread " << thread_index <<
".\n";
1107 state current_state;
1110 std::vector<state> dummy;
1111 std::unique_ptr<todo_set> thread_todo=make_todo_set(dummy.begin(),dummy.end());
1115 while (number_of_active_processes>0 || !todo->empty())
1117 assert(m_must_abort || thread_todo->empty());
1121 todo->choose_element(current_state);
1122 thread_todo->insert(current_state);
1125 while (!thread_todo->empty() && !m_must_abort.load(std::memory_order_relaxed))
1127 thread_todo->choose_element(current_state);
1128 std::size_t s_index = discovered.
index(current_state,thread_index);
1129 start_state(thread_index, current_state, s_index);
1130 data::add_assignments(thread_sigma, m_process_parameters, current_state);
1133 generate_transitions(
1142 thread_id_generator,
1145 if constexpr (Timed)
1148 if (a.
has_time() && less_equal(a.
time(), t, thread_sigma, thread_rewr))
1153 if constexpr (Stochastic)
1155 std::list<std::size_t> s1_index;
1156 const auto& S1 = s1.states;
1158 for (
const state& s1_: S1)
1160 std::size_t k = discovered.
index(s1_,thread_index);
1161 if (k >= discovered.
size())
1163 thread_todo->insert(s1_);
1164 k = discovered.
insert(s1_, thread_index).first;
1165 discover_state(thread_index, s1_, k);
1167 s1_index.push_back(k);
1170 examine_transition(thread_index, m_options.
number_of_threads, current_state, s_index, a, s1, s1_index, summand.
index);
1174 std::size_t s1_index;
1175 if constexpr (Timed)
1177 s1_index = discovered.
index(s1,thread_index);
1178 if (s1_index >= discovered.
size())
1182 make_timed_state(state_, s1, t1);
1183 s1_index = discovered.
insert(state_, thread_index).first;
1184 discover_state(thread_index, state_, s1_index);
1185 thread_todo->insert(state_);
1190 std::pair<std::size_t,bool> p = discovered.
insert(s1, thread_index);
1194 discover_state(thread_index, s1, s1_index);
1195 thread_todo->insert(s1);
1199 examine_transition(thread_index, m_options.
number_of_threads, current_state, s_index, a, s1, s1_index, summand.
index);
1205 if (number_of_idle_processes>0 && thread_todo->size()>1)
1212 for(std::size_t i=0; i<std::min(thread_todo->size()-1,1+(thread_todo->size()/4)); ++i)
1214 thread_todo->choose_element(current_state);
1215 todo->insert(current_state);
1222 finish_state(thread_index, m_options.
number_of_threads, current_state, s_index, thread_todo->
size());
1223 thread_todo->finish_state();
1233 number_of_active_processes--;
1234 number_of_idle_processes++;
1237 assert(thread_todo->empty() || m_must_abort);
1241 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1244 if (number_of_active_processes>0 || !todo->empty())
1246 number_of_active_processes++;
1248 number_of_idle_processes--;
1250 mCRL2log(log::debug) <<
"Stop thread " << thread_index <<
".\n";
1260 typename SummandSequence,
1269 const StateType& s0,
1270 const SummandSequence& regular_summands,
1271 const SummandSequence& confluent_summands,
1273 DiscoverState discover_state = DiscoverState(),
1274 ExamineTransition examine_transition = ExamineTransition(),
1275 StartState start_state = StartState(),
1276 FinishState finish_state = FinishState(),
1277 DiscoverInitialState discover_initial_state = DiscoverInitialState()
1280 utilities::mcrl2_unused(discover_initial_state);
1283 assert(number_of_threads>0);
1284 const std::size_t initialisation_thread_index= (number_of_threads==1?0:1);
1285 m_recursive = recursive;
1286 std::unique_ptr<todo_set> todo;
1287 discovered.
clear(initialisation_thread_index);
1289 if constexpr (Stochastic)
1292 const auto& S = s0_.states;
1293 todo = make_todo_set(S.begin(), S.end());
1294 discovered.
clear(initialisation_thread_index);
1295 std::list<std::size_t> s0_index;
1296 for (
const state& s: S)
1299 std::size_t s_index = discovered.
index(s, initialisation_thread_index);
1300 if (s_index >= discovered.
size())
1302 s_index = discovered.
insert(s, initialisation_thread_index).first;
1303 discover_state(initialisation_thread_index, s, s_index);
1305 s0_index.push_back(s_index);
1307 discover_initial_state(s0_, s0_index);
1311 todo = make_todo_set(s0);
1312 std::size_t s0_index = discovered.
insert(s0, initialisation_thread_index).first;
1313 discover_state(initialisation_thread_index, s0, s0_index);
1316 std::atomic<std::size_t> number_of_active_processes=number_of_threads;
1317 std::atomic<std::size_t> number_of_idle_processes=0;
1319 if (number_of_threads>1)
1321 std::vector<std::thread> threads;
1322 threads.reserve(number_of_threads);
1323 for(std::size_t i=1; i<=number_of_threads; ++i)
1326 threads.emplace_back([&, i](){
1327 generate_state_space_thread< StateType, SummandSequence,
1328 DiscoverState, ExamineTransition,
1329 StartState, FinishState,
1330 DiscoverInitialState >
1332 i, number_of_active_processes, number_of_idle_processes,
1333 regular_summands,confluent_summands,discovered, discover_state,
1334 examine_transition, start_state, finish_state,
1335 m_global_rewr.
clone(), m_global_sigma); } );
1339 for(std::size_t i=1; i<=number_of_threads; ++i)
1341 threads[i-1].join();
1347 assert(number_of_threads==1);
1348 const std::size_t single_thread_index=0;
1349 generate_state_space_thread< StateType, SummandSequence,
1350 DiscoverState, ExamineTransition,
1351 StartState, FinishState,
1352 DiscoverInitialState >
1353 (todo,single_thread_index,number_of_active_processes, number_of_idle_processes,
1354 regular_summands,confluent_summands,discovered, discover_state,
1355 examine_transition, start_state, finish_state,
1356 m_global_rewr, m_global_sigma);
1359 m_must_abort =
false;
1377 DiscoverState discover_state = DiscoverState(),
1378 ExamineTransition examine_transition = ExamineTransition(),
1379 StartState start_state = StartState(),
1380 FinishState finish_state = FinishState(),
1381 DiscoverInitialState discover_initial_state = DiscoverInitialState()
1385 if constexpr (Stochastic)
1387 compute_stochastic_state(s0, m_initial_distribution, m_initial_state, m_global_sigma, m_global_rewr, m_global_enumerator);
1391 compute_state(s0,m_initial_state,m_global_sigma, m_global_rewr);
1392 if (!m_confluent_summands.empty())
1394 s0 =
find_representative(s0, m_confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator);
1396 if constexpr (Timed)
1398 make_timed_state(s0, s0, data::sort_real::real_zero());
1401 generate_state_space(recursive, s0, m_regular_summands, m_confluent_summands, m_discovered, discover_state,
1402 examine_transition, start_state, finish_state, discover_initial_state);
1414 std::vector<std::pair<lps::multi_action, state_type>> result;
1415 data::add_assignments(
sigma, m_process_parameters, d0);
1421 generate_transitions(
1423 m_confluent_summands,
1437 set_process_parameter_values(process_parameter_undo,
sigma);
1447 return generate_transitions(d0, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator);
1458 return generate_transitions(d0);
1474 std::vector<std::pair<lps::multi_action, state_type>> result;
1475 data::add_assignments(
sigma, m_process_parameters, d0);
1476 generate_transitions(
1477 m_regular_summands[i],
1478 m_confluent_summands,
1490 data::remove_assignments(
sigma, m_regular_summands[i].variables);
1491 set_process_parameter_values(process_parameter_undo,
sigma);
1498 typename SummandSequence,
1508 std::unordered_set<state> gray,
1509 std::unordered_set<state>& discovered,
1510 const SummandSequence& regular_summands,
1511 const SummandSequence& confluent_summands,
1512 DiscoverState discover_state = DiscoverState(),
1513 ExamineTransition examine_transition = ExamineTransition(),
1514 TreeEdge tree_edge = TreeEdge(),
1515 BackEdge back_edge = BackEdge(),
1516 ForwardOrCrossEdge forward_or_cross_edge = ForwardOrCrossEdge(),
1517 FinishState finish_state = FinishState()
1520 using utilities::detail::contains;
1528 discovered.insert(s0);
1529 discover_state(0, s0);
1536 for (
const transition& tr: out_edges(s0, regular_summands, confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator))
1543 const auto&[a, s1] = tr;
1544 const std::size_t number_of_threads = 1;
1545 examine_transition(0, number_of_threads, s0, a, s1);
1547 if (discovered.find(s1) == discovered.end())
1549 tree_edge(s0, a, s1);
1550 if constexpr (Timed)
1555 make_timed_state(s1_at_t1, s1, t1);
1556 discovered.insert(s1_at_t1);
1560 discovered.insert(s1);
1562 generate_state_space_dfs_recursive(s1, gray, discovered, regular_summands, confluent_summands, discover_state, examine_transition, tree_edge, back_edge, forward_or_cross_edge, finish_state);
1564 else if (contains(gray, s1))
1566 back_edge(s0, a, s1);
1570 forward_or_cross_edge(s0, a, s1);
1575 finish_state(0, s0);
1588 DiscoverState discover_state = DiscoverState(),
1589 ExamineTransition examine_transition = ExamineTransition(),
1590 TreeEdge tree_edge = TreeEdge(),
1591 BackEdge back_edge = BackEdge(),
1592 ForwardOrCrossEdge forward_or_cross_edge = ForwardOrCrossEdge(),
1593 FinishState finish_state = FinishState()
1596 m_recursive = recursive;
1597 std::unordered_set<state> gray;
1598 std::unordered_set<state> discovered;
1601 compute_state(s0, m_initial_state, m_global_sigma, m_global_rewr);
1602 if (!m_confluent_summands.empty())
1604 s0 =
find_representative(s0, m_confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator);
1606 if constexpr (Timed)
1608 s0 = make_timed_state(s0, data::sort_real::real_zero());
1610 generate_state_space_dfs_recursive(s0, gray, discovered, m_regular_summands, m_confluent_summands, discover_state, examine_transition, tree_edge, back_edge, forward_or_cross_edge, finish_state);
1611 m_recursive =
false;
1617 typename SummandSequence,
1627 std::unordered_set<state>& discovered,
1628 const SummandSequence& regular_summands,
1629 const SummandSequence& confluent_summands,
1630 DiscoverState discover_state = DiscoverState(),
1631 ExamineTransition examine_transition = ExamineTransition(),
1632 TreeEdge tree_edge = TreeEdge(),
1633 BackEdge back_edge = BackEdge(),
1634 ForwardOrCrossEdge forward_or_cross_edge = ForwardOrCrossEdge(),
1635 FinishState finish_state = FinishState()
1638 using utilities::detail::contains;
1645 std::vector<std::pair<state, std::list<transition>>> todo;
1651 todo.emplace_back(s0, out_edges(s0, regular_summands, confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator));
1652 discovered.insert(s0);
1655 while (!todo.empty() && !m_must_abort)
1657 const state* s = &todo.back().first;
1658 std::list<transition>* E = &todo.back().second;
1662 const auto& a = e.
action;
1663 const auto& s1 = e.
state;
1665 examine_transition(0, 1, *s, a, s1);
1667 if (discovered.find(s1) == discovered.end())
1669 tree_edge(*s, a, s1);
1670 if constexpr (Timed)
1675 make_timed_state(s1_at_t1, s1, t1);
1676 discovered.insert(s1_at_t1);
1677 discover_state(s1_at_t1);
1681 discovered.insert(s1);
1684 todo.emplace_back(s1, out_edges(s1, regular_summands, confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator));
1685 s = &todo.back().first;
1686 E = &todo.back().second;
1690 if (std::find_if(todo.begin(), todo.end(), [&](
const std::pair<
state, std::list<transition>>& p) { return s1 == p.first; }) != todo.end())
1692 back_edge(*s, a, s1);
1696 forward_or_cross_edge(*s, a, s1);
1701 finish_state(0, *s);
1703 m_must_abort =
false;
1716 DiscoverState discover_state = DiscoverState(),
1717 ExamineTransition examine_transition = ExamineTransition(),
1718 TreeEdge tree_edge = TreeEdge(),
1719 BackEdge back_edge = BackEdge(),
1720 ForwardOrCrossEdge forward_or_cross_edge = ForwardOrCrossEdge(),
1721 FinishState finish_state = FinishState()
1724 m_recursive = recursive;
1725 std::unordered_set<state> discovered;
1728 compute_state(s0,m_initial_state,m_global_sigma, m_global_rewr);
1729 if (!m_confluent_summands.empty())
1731 s0 =
find_representative(s0, m_confluent_summands, m_global_sigma, m_global_rewr, m_global_enumerator, m_global_id_generator);
1733 if constexpr (Timed)
1735 s0 = make_timed_state(s0, data::sort_real::real_zero());
1737 generate_state_space_dfs_iterative(s0, discovered, m_regular_summands, m_confluent_summands, discover_state, examine_transition, tree_edge, back_edge, forward_or_cross_edge, finish_state);
1738 m_recursive =
false;
1744 m_must_abort =
true;
1750 return m_discovered;
1755 return m_regular_summands;
1760 return m_confluent_summands;
1765 return m_process_parameters;
1777 return process_parameter_values(m_global_sigma);
1781 data::add_assignments(
sigma, m_process_parameters, values);
1787 set_process_parameter_values(values, m_global_sigma);
This file contains an implementation of the hash function to break circular header dependencies.
A deque class in which aterms can be stored.
void push_back(const T &value)
void swap(deque &other) noexcept
mcrl2::utilities::shared_guard lock_shared()
Acquire a shared lock on this thread aterm pool.
A set that assigns each element an unique index, and protects its internal terms en masse.
std::pair< size_type, bool > insert(const Key &key, std::size_t thread_index=0)
void clear(std::size_t thread_index=0)
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.
iterator end() const
Returns an iterator pointing to the end of the term_balanced_tree.
size_type size() const
Returns the size of the term_list.
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const Term & front() const
Returns the first element of the list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
bool empty() const
Returns true if the list's size is 0.
void push_front(const Term &el)
Inserts a new element at the beginning of the current list.
A unordered_map class in which aterms can be stored.
iterator find(const Args &... args)
Standard find function in a map.
std::pair< iterator, bool > insert(const value_type &value)
An enumerator algorithm that generates solutions of a condition.
std::size_t enumerate(const EnumeratorListElement &p, MutableSubstitution &sigma, ReportSolution report_solution, Reject reject=Reject(), Accept accept=Accept()) const
Enumerates the element p. Solutions are reported using the callback function report_solution....
An element for the todo list of the enumerator that collects the substitution corresponding to the ex...
Generic substitution function.
Rewriter that operates on data expressions.
void thread_initialise()
Initialises this rewriter with thread dependent information.
rewriter clone()
Create a clone of the rewriter in which the underlying rewriter is copied, and not passed as a shared...
Component for selecting a subset of equations that are actually used in an encompassing specification...
void insert(const state &s) override
void swap(breadth_first_todo_set &other)
atermpp::deque< state > & todo_buffer()
breadth_first_todo_set(ForwardIterator first, ForwardIterator last)
breadth_first_todo_set(const state &init)
void choose_element(state &result) override
void choose_element(state &result) override
depth_first_todo_set(ForwardIterator first, ForwardIterator last)
depth_first_todo_set(const state &init)
void insert(const state &s) override
std::vector< data::variable > m_process_parameters
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())
void make_timed_state(state &result, const state &s, const data::data_expression &t) const
explorer(const Specification &lpsspec, const explorer_options &options_)
data::enumerator_algorithm m_global_enumerator
void abort() override
Abort the state space generation.
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.
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())
const state_type & make_state(const stochastic_state &s) const
void generate_state_space(bool recursive, const StateType &s0, const SummandSequence ®ular_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())
std::vector< std::pair< lps::multi_action, state > > generate_transitions(const data::data_expression_list &init, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr)
Generates outgoing transitions for a given state.
const indexed_set_for_states_type & state_map() const
Returns a mapping containing all discovered states.
bool less_equal(const data::data_expression &t0, const data::data_expression &t1, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr) const
const std::vector< data::variable > & process_parameters() const
const std::vector< explorer_summand > & confluent_summands() const
void set_process_parameter_values(const data::data_expression_list &values, data::mutable_indexed_substitution<> &sigma)
void set_process_parameter_values(const data::data_expression_list &values)
std::set< data::function_symbol > add_real_operators(std::set< data::function_symbol > s) const
data::enumerator_identifier_generator m_global_id_generator
Specification m_global_lpsspec
typename std::conditional< Stochastic, std::list< std::size_t >, std::size_t >::type state_index_type
data::data_expression_list process_parameter_values() const
Process parameter values for use in a single thread.
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())
const data::data_expression_list & initial_state() const
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...
void generate_state_space_dfs_recursive(const state &s0, std::unordered_set< state > gray, std::unordered_set< state > &discovered, const SummandSequence ®ular_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())
indexed_set_for_states_type m_discovered
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)
std::vector< explorer_summand > m_regular_summands
const explorer_options m_options
void compute_stochastic_state(stochastic_state &result, const stochastic_distribution &distribution, const DataExpressionSequence &next_state, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::enumerator_algorithm<> &enumerator) const
summand_cache_map global_cache
const data::rewriter & get_rewriter() const
data::data_expression_list m_initial_state
std::mutex m_exclusive_state_access
data::mutable_indexed_substitution m_global_sigma
data::data_expression_list process_parameter_values(data::mutable_indexed_substitution<> &sigma) const
std::vector< std::pair< lps::multi_action, state_type > > generate_transitions(const state &d0, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator)
Generates outgoing transitions for a given state.
state_type make_state(const state &s) const
lps::stochastic_distribution m_initial_distribution
std::vector< explorer_summand > m_confluent_summands
data::rewriter m_global_rewr
void generate_state_space_dfs_iterative(const state &s0, std::unordered_set< state > &discovered, const SummandSequence ®ular_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
const std::vector< explorer_summand > & regular_summands() const
void generate_state_space_thread(std::unique_ptr< todo_set > &todo, const std::size_t thread_index, std::atomic< std::size_t > &number_of_active_processes, std::atomic< std::size_t > &number_of_idle_processes, const SummandSequence ®ular_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)
std::unique_ptr< todo_set > make_todo_set(const state &init)
void compute_state(state &result, const DataExpressionSequence &v, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr) const
std::vector< std::pair< lps::multi_action, state_type > > generate_transitions(const state &d0)
Generates outgoing transitions for a given state, using the global substitution, rewriter,...
data::rewriter construct_rewriter(const Specification &lpsspec, bool remove_unused_rewrite_rules)
typename std::conditional< Stochastic, stochastic_state, state >::type state_type
std::unique_ptr< todo_set > make_todo_set(ForwardIterator first, ForwardIterator last)
std::list< transition > out_edges(const state &s)
std::vector< data::data_expression > timed_state
std::vector< std::pair< lps::multi_action, state_type > > generate_transitions(const data::data_expression_list &init, std::size_t i, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::data_expression &condition, state_type &d0, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator)
Generates outgoing transitions for a given state, reachable via the summand with index i.
std::list< transition > out_edges(const state &s, const SummandSequence ®ular_summands, const SummandSequence &confluent_summands, data::mutable_indexed_substitution<> &sigma, data::rewriter &rewr, data::enumerator_algorithm<> &enumerator, data::enumerator_identifier_generator &id_generator)
Specification preprocess(const Specification &lpsspec)
std::list< transition > out_edges(const state &s, const std::size_t summand_index)
bool is_confluent_tau(const multi_action &a)
atermpp::indexed_set< state, mcrl2::utilities::detail::GlobalThreadSafe > indexed_set_for_states_type
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())
highway_todo_set(const state &init, std::size_t N_)
std::size_t size() const override
highway_todo_set(ForwardIterator first, ForwardIterator last, std::size_t N_)
std::random_device device
void insert(const state &s) override
void choose_element(state &result) override
bool empty() const override
breadth_first_todo_set new_states
void finish_state() override
\brief A timed multi-action
bool has_time() const
Returns true if time is available.
const process::action_list & actions() const
const data::data_expression & time() const
const InitialProcessExpression & initial_process() const
Returns the initial process.
Linear process specification.
LPS summand containing a multi-action.
const stochastic_distribution & distribution() const
Returns the distribution of this summand.
\brief A stochastic distribution
const data::variable_list & variables() const
bool is_defined() const
Returns true if the distribution is defined, i.e. it contains a valid distribution....
const data::data_expression & distribution() const
const stochastic_distribution & distribution() const
Linear process specification.
virtual bool empty() const
todo_set(ForwardIterator first, ForwardIterator last)
atermpp::deque< state > todo
virtual void choose_element(state &result)
virtual ~todo_set()=default
virtual std::size_t size() const
todo_set(const state &init)
virtual void insert(const state &s)
virtual void finish_state()
Standard exception class for reporting runtime errors.
size_type index(const key_type &key, std::size_t thread_index=0) const
Returns a reference to the mapped value.
size_type size(std::size_t thread_index=0) const
The number of elements in the indexed set.
A shared lock guard for the shared_mutex.
void unlock_shared()
Unlocks the acquired shared guard explicitly. Otherwise, performed in destructor.
This file contains some functions that are present in all libraries except the data library....
Stores a static variable that indicates the number of iterations allowed during enumeration.
add your file description here.
add your file description here.
MCRL2_EXPORT bool init(rewriter_interface *i, RewriterCompilingJitty *this_rewriter)
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
add your file description here.
add your file description here.
add your file description here.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
std::size_t combine(const std::size_t hnr, const unprotected_aterm_core &term)
Auxiliary function to combine hnr with aterms.
void make_term_appl(Term &target, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Constructor an aterm in a variable based on a function symbol and an forward iterator providing the a...
std::set< data::variable > find_free_variables(const data::data_expression &x)
The main namespace for the LPS library.
const stochastic_distribution & summand_distribution(const Summand &)
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 ...
Node find_representative(Node &u0, GenerateSuccessors generate_successors)
Search for a unique representative in a graph.
std::vector< data::data_expression > make_data_expression_vector(const data::data_expression_list &v)
void check_stochastic_state(const stochastic_state &s, const data::rewriter &rewr)
std::ostream & operator<<(std::ostream &out, const action_summand &x)
bool is_stochastic(const T &x)
Returns true if the LPS object x contains a stochastic distribution in one of its attributes.
atermpp::utilities::unordered_map< atermpp::aterm, atermpp::term_list< data::data_expression_list >, detail::cache_hash, detail::cache_equality, std::allocator< std::pair< atermpp::aterm, atermpp::term_list< data::data_expression_list > > >, true > summand_cache_map
const stochastic_distribution & initial_distribution(const lps::specification &)
void make_state(state &result, ForwardTraversalIterator p, const std::size_t size, Transformer transformer)
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)
static constexpr bool GlobalThreadSafe
Enables thread safety for the whole toolset.
add your file description here.
add your file description here.
add your file description here.
bool operator()(const atermpp::aterm &key1, const cheap_cache_key &key2) const
bool operator()(const atermpp::aterm &key1, const atermpp::aterm &key2) const
std::size_t operator()(const cheap_cache_key &key) const
std::size_t operator()(const std::pair< const atermpp::aterm, std::list< atermpp::term_list< mcrl2::data::data_expression > > > &pair) const
std::size_t operator()(const atermpp::aterm &key) const
cheap_cache_key(data::mutable_indexed_substitution<> &sigma, const std::vector< data::variable > &gamma)
const std::vector< data::variable > & m_gamma
data::mutable_indexed_substitution & m_sigma
transition(lps::multi_action action_, const state_type &state_)
bool replace_constants_by_variables
data::rewrite_strategy rewrite_strategy
exploration_strategy search_strategy
std::string confluence_action
bool one_point_rule_rewrite
std::size_t number_of_threads
std::size_t highway_todo_max
lps::multi_action multi_action
data::variable_list variables
std::vector< data::variable > gamma
std::vector< data::variable > free_variables(const T &x, const data::variable_list &v)
explorer_summand(const ActionSummand &summand, std::size_t summand_index, const data::variable_list &process_parameters, caching cache_strategy_)
stochastic_distribution distribution
data::data_expression condition
summand_cache_map local_cache
atermpp::function_symbol f_gamma
void compute_key(atermpp::aterm &key, data::mutable_indexed_substitution<> &sigma) const
std::vector< data::data_expression > next_state
std::vector< data::data_expression > probabilities
std::vector< state > states
The skip operation with a variable number of arguments.
add your file description here.
add your file description here.