mCRL2
Loading...
Searching...
No Matches
exploration_strategy.h
Go to the documentation of this file.
1// Author(s): Muck van Weerdenburg
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
10#ifndef MCRL2_LPS_EXPLORATION_STRATEGY_H
11#define MCRL2_LPS_EXPLORATION_STRATEGY_H
12
13#include <string>
15
16namespace mcrl2
17{
18namespace lps
19{
20
28 };
29
30inline
32{
33 if (s=="b" || s=="breadth")
34 {
35 return es_breadth;
36 }
37 if (s=="d" || s=="depth")
38 {
39 return es_depth;
40 }
41 if (s=="r" || s=="random")
42 {
43 return es_random;
44 }
45 if (s=="p" || s=="prioritized")
46 {
48 }
49 if (s=="q" || s=="rprioritized")
50 {
52 }
53 if (s=="h" || s == "highway")
54 {
55 return es_highway;
56 }
57 return es_none;
58}
59
60inline
62{
63 switch (es)
64 {
65 case es_breadth:
66 return "breadth";
67 case es_depth:
68 return "depth";
69 case es_random:
70 return "random";
72 return "prioritized";
74 return "rprioritized";
75 case es_highway:
76 return "highway";
77 default:
78 throw mcrl2::runtime_error("unknown exploration strategy");
79 }
80}
81
82inline
83std::istream& operator>>(std::istream& is, exploration_strategy& strat)
84{
85 try
86 {
87 std::string s;
88 is >> s;
90 }
92 {
93 is.setstate(std::ios_base::failbit);
94 }
95 return is;
96}
97
98inline
99std::ostream& operator<<(std::ostream& os, const exploration_strategy strat)
100{
101 os << print_exploration_strategy(strat);
102 return os;
103}
104
105inline std::string description(const exploration_strategy strat)
106{
107 switch (strat)
108 {
109 case es_breadth:
110 return "breadth-first search";
111 case es_depth:
112 return "depth-first search";
113 case es_random:
114 return "random simulation. Out of all next states one is chosen at random independently of whether this state has already been observed. Consequently, random simulation only terminates when a deadlocked state is encountered.";
116 return "prioritize single actions on its first argument being of sort Nat where only those actions with the lowest value for this parameter are selected. E.g. if there are actions a(3) and b(4), a(3) remains and b(4) is skipped. Actions without a first parameter of sort Nat and multactions with more than one action are always chosen (option is experimental)";
118 return "prioritize actions on its first argument being of sort Nat (see option --prioritized), and randomly select one of these to obtain a prioritized random simulation (option is experimental)";
119 case es_highway:
120 return "highway search. Only part of the state space is explored, by restricting the size of the todo list. N.B. The implementation deviates slightly from the published version.";
121 default:
122 throw mcrl2::runtime_error("unknown exploration_strategy");
123 }
124}
125
126} // namespace lps
127} // namespace mcrl2
128
129#endif // MCRL2_LPS_EXPLORATION_STRATEGY_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
Exception classes for use in libraries and tools.
exploration_strategy parse_exploration_strategy(const std::string &s)
std::ostream & operator<<(std::ostream &out, const action_summand &x)
std::string description(const exploration_strategy strat)
std::string print_exploration_strategy(const exploration_strategy es)
std::istream & operator>>(std::istream &is, exploration_strategy &strat)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72