Merge lp:~tapaal-ltl/verifypn/simple-ltl-heuristics into lp:verifypn

Proposed by Nikolaj Jensen Ulrik
Status: Merged
Approved by: Jiri Srba
Approved revision: 255
Merged at revision: 254
Proposed branch: lp:~tapaal-ltl/verifypn/simple-ltl-heuristics
Merge into: lp:verifypn
Diff against target: 171 lines (+33/-39)
6 files modified
CMakeLists.txt (+1/-1)
include/LTL/SuccessorGeneration/Heuristics.h (+0/-2)
include/PetriEngine/options.h (+6/-1)
src/LTL/LTLMain.cpp (+8/-6)
src/LTL/SuccessorGeneration/CMakeLists.txt (+1/-7)
src/VerifyPN.cpp (+17/-22)
To merge this branch: bzr merge lp:~tapaal-ltl/verifypn/simple-ltl-heuristics
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Peter Gjøl Jensen Approve
Review via email: mp+410791@code.launchpad.net

Description of the change

Kill off the complex, non-impactful LTL heuristics. These remain available on the `experimental-ltl-heuristics` branch.
Required bison version was reverted back to before the `fix-required-bison-version` branch - this might need to be revised. I tested that it compiles using bison version 3.5.1 (obtained from `apt` in Ubuntu 20.04)

To post a comment you must log in.
Revision history for this message
Peter Gjøl Jensen (peter-gjoel) wrote :

I assume the bison/flex files should also be purged?

review: Needs Information
254. By Nikolaj Jensen Ulrik

Removing dangling HeuristicParser.h

Revision history for this message
Nikolaj Jensen Ulrik (waefwerf) wrote :

> I assume the bison/flex files should also be purged?

The LTL heuristics parser files should be gone. I didn't remove the other ones (PQLQueryParser.{y,l}) since Jiri thought they might still be useful (if I understood correctly). I did find a dangling file which I just removed

Revision history for this message
Peter Gjøl Jensen (peter-gjoel) wrote :

LGTM

review: Approve
255. By Nikolaj Jensen Ulrik

making the --ltl-heur help string more clear

Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2021-10-17 18:18:35 +0000
3+++ CMakeLists.txt 2021-10-27 20:06:36 +0000
4@@ -62,7 +62,7 @@
5 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
6
7 find_package(FLEX 2.6.4 REQUIRED)
8-find_package(BISON 3.7.0 REQUIRED)
9+find_package(BISON 3.0.5 REQUIRED)
10
11 if (VERIFYPN_GetDependencies)
12 # setup for external imports
13
14=== removed file 'include/LTL/SuccessorGeneration/ComposedHeuristic.h'
15=== removed file 'include/LTL/SuccessorGeneration/HeuristicParser.h'
16=== modified file 'include/LTL/SuccessorGeneration/Heuristics.h'
17--- include/LTL/SuccessorGeneration/Heuristics.h 2021-06-22 11:41:45 +0000
18+++ include/LTL/SuccessorGeneration/Heuristics.h 2021-10-27 20:06:36 +0000
19@@ -21,8 +21,6 @@
20 #include "DistanceHeuristic.h"
21 #include "RandomHeuristic.h"
22 #include "AutomatonHeuristic.h"
23-#include "ComposedHeuristic.h"
24-#include "WeightedComposedHeuristic.h"
25 #include "FireCountHeuristic.h"
26 #include "LogFireCountHeuristic.h"
27
28
29=== removed file 'include/LTL/SuccessorGeneration/WeightedComposedHeuristic.h'
30=== modified file 'include/PetriEngine/options.h'
31--- include/PetriEngine/options.h 2021-08-06 09:43:25 +0000
32+++ include/PetriEngine/options.h 2021-10-27 20:06:36 +0000
33@@ -43,6 +43,11 @@
34 High = 3
35 };
36
37+enum class LTLHeuristic {
38+ Distance,
39+ Automaton,
40+ FireCount,
41+};
42 struct options_t {
43 // bool outputtrace = false;
44 int kbound = 0;
45@@ -83,7 +88,7 @@
46 APCompression ltl_compress_aps = APCompression::None;
47 LTLPartialOrder ltl_por = LTLPartialOrder::VisibleReach;
48 BuchiOptimization buchiOptimization = BuchiOptimization::Low;
49- const char* ltlHeuristic = "aut";
50+ LTLHeuristic ltlHeuristic = LTLHeuristic::Automaton;
51
52 bool replay_trace = false;
53 std::string replay_file;
54
55=== modified file 'src/LTL/LTLMain.cpp'
56--- src/LTL/LTLMain.cpp 2021-10-03 09:38:47 +0000
57+++ src/LTL/LTLMain.cpp 2021-10-27 20:06:36 +0000
58@@ -22,7 +22,7 @@
59
60 #include "LTL/SuccessorGeneration/Spoolers.h"
61 #include "LTL/SuccessorGeneration/Heuristics.h"
62-#include "LTL/SuccessorGeneration/HeuristicParser.h"
63+//#include "LTL/SuccessorGeneration/HeuristicParser.h"
64
65 #include <utility>
66
67@@ -97,12 +97,14 @@
68 if (options.strategy != Reachability::Strategy::HEUR && options.strategy != Reachability::Strategy::DEFAULT) {
69 return nullptr;
70 }
71- auto heur = ParseHeuristic(net, automaton, negated_formula, options.ltlHeuristic);
72- if (heur == nullptr) {
73- std::cerr << "Invalid heuristic specification, terminating.\n";
74- exit(1);
75+ switch(options.ltlHeuristic) {
76+ case LTLHeuristic::Distance:
77+ return std::make_unique<AutomatonHeuristic>(net, automaton);
78+ case LTLHeuristic::Automaton:
79+ return std::make_unique<DistanceHeuristic>(net, negated_formula);
80+ case LTLHeuristic::FireCount:
81+ return std::make_unique<LogFireCountHeuristic>(net, 5000);
82 }
83- else return heur;
84 }
85
86 bool LTLMain(const PetriNet *net,
87
88=== modified file 'src/LTL/SuccessorGeneration/CMakeLists.txt'
89--- src/LTL/SuccessorGeneration/CMakeLists.txt 2021-08-11 09:06:51 +0000
90+++ src/LTL/SuccessorGeneration/CMakeLists.txt 2021-10-27 20:06:36 +0000
91@@ -1,12 +1,6 @@
92 set(CMAKE_INCLUDE_CURRENT_DIR ON)
93
94-flex_target(heur_lexer "${CMAKE_CURRENT_SOURCE_DIR}/HeuristicLexer.l"
95- "${CMAKE_CURRENT_SOURCE_DIR}/HeuristicLexer.lexer.cpp")
96-
97-bison_target(heur_parser "${CMAKE_CURRENT_SOURCE_DIR}/HeuristicParser.y"
98- "${CMAKE_CURRENT_SOURCE_DIR}/HeuristicParser.parser.cpp")
99-
100-add_library(LTLSuccessorGeneration ${BISON_heur_parser_OUTPUTS} ${FLEX_heur_lexer_OUTPUTS} ${HEADER_FILES} ResumingSuccessorGenerator.cpp AutomatonHeuristic.cpp)
101+add_library(LTLSuccessorGeneration ${HEADER_FILES} ResumingSuccessorGenerator.cpp AutomatonHeuristic.cpp)
102
103 target_link_libraries(LTLSuccessorGeneration bddx spot)
104
105
106=== removed file 'src/LTL/SuccessorGeneration/HeuristicLexer.l'
107=== removed file 'src/LTL/SuccessorGeneration/HeuristicParser.y'
108=== modified file 'src/VerifyPN.cpp'
109--- src/VerifyPN.cpp 2021-10-25 14:55:51 +0000
110+++ src/VerifyPN.cpp 2021-10-27 20:06:36 +0000
111@@ -479,10 +479,17 @@
112 std::cerr << "Missing argument to --ltl-heur\n";
113 return ErrorCode;
114 }
115- else {
116- options.ltlHeuristic = argv[i + 1];
117+ if (strcmp(argv[i + 1], "aut") == 0) {
118+ options.ltlHeuristic = LTLHeuristic::Automaton;
119+ } else if (strcmp(argv[i + 1], "dist") == 0) {
120+ options.ltlHeuristic = LTLHeuristic::Distance;
121+ } else if (strcmp(argv[i + 1], "fire-count") == 0) {
122+ options.ltlHeuristic = LTLHeuristic::FireCount;
123+ } else {
124+ continue;
125 }
126- ++i;
127+
128+ ++i;
129 }
130 else if (strcmp(argv[i], "-noweak") == 0) {
131 options.ltluseweak = false;
132@@ -538,9 +545,13 @@
133 " classic otherwise.\n"
134 " - automaton apply fully Büchi-guided stubborn set method.\n"
135 " - none disable stubborn reductions (equivalent to -p).\n"
136- " --ltl-heur <spec> Select distance metric for LTL heuristic search\n"
137- " Use --ltl-heur-help to see specification grammar.\n"
138- " Defaults to 'aut'.\n"
139+ " --ltl-heur <type> Select search heuristic for best-first search in LTL engine\n"
140+ " Defaults to aut"
141+ " - dist Formula-driven heuristic, guiding toward states that satisfy\n"
142+ " the atomic propositions mentioned in the LTL formula.\n"
143+ " - aut Automaton-driven heuristic. Guides search toward states\n"
144+ " that satisfy progressing formulae in the automaton.\n"
145+ " - fire-count Prioritises transitions that were fired less often.\n"
146 " -a, --siphon-trap <timeout> Siphon-Trap analysis timeout in seconds (default 0)\n"
147 " --siphon-depth <place count> Search depth of siphon (default 0, which counts all places)\n"
148 " -n, --no-statistics Do not display any statistics (default is to display it)\n"
149@@ -629,22 +640,6 @@
150 printf("GNU GPLv3 or later <http://gnu.org/licenses/gpl.html>\n");
151 return SuccessCode;
152 }
153- else if (strcmp(argv[i], "--ltl-heur-help") == 0) {
154- printf("Heuristics for LTL model checking are specified using the following grammar:\n"
155- " heurexp : {'aut' | 'automaton'}\n"
156- " | {'dist' | 'distance'}\n"
157- " | {'fc' | 'firecount' | 'fire-count'} <threshold>?\n"
158- " | '(' heurexp ')'\n"
159- " | 'sum' <weight>? heurexp <weight?> heurexp\n"
160- " | 'sum' '(' <weight>? heurexp ',' <weight>? heurexp ')'\n"
161- "Example strings:\n"
162- " - aut - use the automaton heuristic for verification.\n"
163- " - sum dist fc 1000 - use the sum of distance heuristic and fire count heuristic with threshold 1000.\n"
164- "Weight for sum and threshold for fire count are optional and integral.\n"
165- "Sum weights default to 1 (thus plain sum), and default fire count threshold is 5000.\n"
166- );
167- return SuccessCode;
168- }
169 else if (options.modelfile == NULL) {
170 options.modelfile = argv[i];
171 } else if (options.queryfile == NULL) {

Subscribers

People subscribed via source and target branches