Merge lp:~verifydtapn-contributers/verifydtapn/keepDeadFlag into lp:verifydtapn

Proposed by Mathias Grund Sørensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 266
Merged at revision: 265
Proposed branch: lp:~verifydtapn-contributers/verifydtapn/keepDeadFlag
Merge into: lp:verifydtapn
Diff against target: 135 lines (+21/-7)
5 files modified
src/Core/ArgsParser.cpp (+6/-2)
src/Core/TAPN/TimedArcPetriNet.cpp (+6/-1)
src/Core/TAPN/TimedArcPetriNet.hpp (+2/-1)
src/Core/VerificationOptions.hpp (+6/-2)
src/main.cpp (+1/-1)
To merge this branch: bzr merge lp:~verifydtapn-contributers/verifydtapn/keepDeadFlag
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Jakob Taankvist Approve
Review via email: mp+114671@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jakob Taankvist (jakob-taankvist) wrote :

It's very nice we do the check in the "static part" instead of in the cut function.

review: Approve
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 'src/Core/ArgsParser.cpp'
2--- src/Core/ArgsParser.cpp 2012-07-09 13:19:22 +0000
3+++ src/Core/ArgsParser.cpp 2012-07-12 15:51:27 +0000
4@@ -14,6 +14,7 @@
5 static const std::string MAX_CONSTANT_OPTION = "global-max-constants";
6 static const std::string XML_TRACE_OPTION = "xml-trace";
7 static const std::string LEGACY = "legacy";
8+ static const std::string KEEP_DEAD = "keep-dead-tokens";
9
10 std::ostream& operator<<(std::ostream& out, const Switch& flag)
11 {
12@@ -138,7 +139,7 @@
13 parsers.push_back(boost::make_shared<SwitchWithArg>("k", KBOUND_OPTION, "Max tokens to use during exploration.",0));
14 parsers.push_back(boost::make_shared<SwitchWithArg>("o", SEARCH_OPTION, "Specify the desired search strategy.\n - 0: Breadth-First Search\n - 1: Depth-First Search\n - 2: Random Search\n - 3: Heuristic Search",3));
15 parsers.push_back(boost::make_shared<SwitchWithArg>("t", TRACE_OPTION, "Specify the desired trace option.\n - 0: none\n - 1: some",0));
16-
17+ parsers.push_back(boost::make_shared<Switch>("d",KEEP_DEAD, "Do not discard dead tokens\n(used for boundedness checking)"));
18 parsers.push_back(boost::make_shared<Switch>("g",MAX_CONSTANT_OPTION, "Use global maximum constant for \nextrapolation (as opposed to local \nconstants)."));
19 parsers.push_back(boost::make_shared<Switch>("s",LEGACY, "Legacy option (no effect)."));
20
21@@ -316,9 +317,12 @@
22 assert(map.find(MAX_CONSTANT_OPTION) != map.end());
23 bool max_constant = boost::lexical_cast<bool>(map.find(MAX_CONSTANT_OPTION)->second);
24
25+ assert(map.find(KEEP_DEAD) != map.end());
26+ bool keep_dead = boost::lexical_cast<bool>(map.find(KEEP_DEAD)->second);
27+
28 assert(map.find(XML_TRACE_OPTION) != map.end());
29 bool xml_trace = boost::lexical_cast<bool>(map.find(XML_TRACE_OPTION)->second);
30
31- return VerificationOptions(modelFile, queryFile, search, kbound, trace, xml_trace, max_constant);
32+ return VerificationOptions(modelFile, queryFile, search, kbound, trace, xml_trace, max_constant, keep_dead);
33 }
34 }
35
36=== modified file 'src/Core/TAPN/TimedArcPetriNet.cpp'
37--- src/Core/TAPN/TimedArcPetriNet.cpp 2012-07-02 06:33:02 +0000
38+++ src/Core/TAPN/TimedArcPetriNet.cpp 2012-07-12 15:51:27 +0000
39@@ -206,7 +206,7 @@
40 }
41 }
42
43- void TimedArcPetriNet::updatePlaceTypes(const AST::Query* query){
44+ void TimedArcPetriNet::updatePlaceTypes(const AST::Query* query, VerificationOptions options){
45 std::vector< int > placeNumbers;
46 boost::any context = placeNumbers;
47 DiscreteVerification::PlaceVisitor visitor;
48@@ -214,9 +214,14 @@
49 placeNumbers = boost::any_cast< std::vector< int > >(context);
50
51 for(TimedPlace::Vector::const_iterator iter = places.begin(); iter != places.end(); ++iter){
52+ if(options.GetKeepDeadTokens() && (*iter)->GetType() == Dead){
53+ (*iter)->SetType(Std);
54+ continue;
55+ }
56 for(std::vector<int>::const_iterator id_iter = placeNumbers.begin(); id_iter != placeNumbers.end(); id_iter++){
57 if((*id_iter) == (*iter)->GetIndex() && (*iter)->GetType() == Dead){
58 (*iter)->SetType(Std);
59+ break;
60 }
61 }
62 }
63
64=== modified file 'src/Core/TAPN/TimedArcPetriNet.hpp'
65--- src/Core/TAPN/TimedArcPetriNet.hpp 2012-07-02 06:33:02 +0000
66+++ src/Core/TAPN/TimedArcPetriNet.hpp 2012-07-12 15:51:27 +0000
67@@ -14,6 +14,7 @@
68 #include "Pairing.hpp"
69 #include "../QueryParser/AST.hpp"
70 #include "../../DiscreteVerification/PlaceVisitor.hpp"
71+#include "../VerificationOptions.hpp"
72
73 namespace VerifyTAPN {
74
75@@ -52,7 +53,7 @@
76 inline const bool IsPlaceUntimed(int index) const { return places[index]->IsUntimed(); }
77 bool IsNonStrict() const;
78 void calculateCausality(TimedPlace& p, std::vector< TimedPlace* >* result) const;
79- void updatePlaceTypes(const AST::Query* query);
80+ void updatePlaceTypes(const AST::Query* query, VerificationOptions options);
81 public: // modifiers
82 void Initialize(bool useGlobalMaxConstant);
83 void removeOrphantedTransitions();
84
85=== modified file 'src/Core/VerificationOptions.hpp'
86--- src/Core/VerificationOptions.hpp 2012-07-02 06:33:02 +0000
87+++ src/Core/VerificationOptions.hpp 2012-07-12 15:51:27 +0000
88@@ -19,14 +19,16 @@
89 unsigned int k_bound,
90 Trace trace,
91 bool xml_trace,
92- bool useGlobalMaxConstants
93+ bool useGlobalMaxConstants,
94+ bool keepDeadTokens
95 ) : inputFile(inputFile),
96 queryFile(queryFile),
97 searchType(searchType),
98 k_bound(k_bound),
99 trace(trace),
100 xml_trace(xml_trace),
101- useGlobalMaxConstants(useGlobalMaxConstants)
102+ useGlobalMaxConstants(useGlobalMaxConstants),
103+ keepDeadTokens(keepDeadTokens)
104 { };
105
106 public: // inspectors
107@@ -37,6 +39,7 @@
108 inline const bool XmlTrace() const { return xml_trace; };
109 inline const bool GetGlobalMaxConstantsEnabled() const { return useGlobalMaxConstants; }
110 inline const SearchType GetSearchType() const { return searchType; }
111+ inline const bool GetKeepDeadTokens() const { return keepDeadTokens; };
112 inline Factory GetFactory() const { return DEFAULT; };
113 inline void SetFactory(Factory f) { factory = f; };
114 private:
115@@ -47,6 +50,7 @@
116 Trace trace;
117 bool xml_trace;
118 bool useGlobalMaxConstants;
119+ bool keepDeadTokens;
120 Factory factory;
121 };
122
123
124=== modified file 'src/main.cpp'
125--- src/main.cpp 2012-07-02 06:49:56 +0000
126+++ src/main.cpp 2012-07-12 15:51:27 +0000
127@@ -47,7 +47,7 @@
128 tapn->removeOrphantedTransitions();
129 }
130
131- tapn->updatePlaceTypes(query);
132+ tapn->updatePlaceTypes(query, options);
133
134 return DiscreteVerification::DiscreteVerification::run(tapn, initialPlacement, query, options);
135 }

Subscribers

People subscribed via source and target branches