Merge lp:~verifypn-cpn/verifypn/rulef-tracefix into lp:verifypn

Proposed by Peter Gjøl Jensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 218
Merged at revision: 216
Proposed branch: lp:~verifypn-cpn/verifypn/rulef-tracefix
Merge into: lp:verifypn
Diff against target: 37 lines (+13/-0)
1 file modified
PetriEngine/Reducer.cpp (+13/-0)
To merge this branch: bzr merge lp:~verifypn-cpn/verifypn/rulef-tracefix
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+364949@code.launchpad.net

Commit message

Fixed the attached bug.

Description of the change

Disabeling rule H if a trace is requested.
Adding missing "extraconsume" on transition when ruleF is applied.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

If rule H is disabled because trace is selected, we should at least print this information
to stdout.

review: Needs Fixing
217. By Peter Gjøl Jensen

added warning of disabled rule

218. By Peter Gjøl Jensen

switched to cout to avoid confusing the GUI

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 'PetriEngine/Reducer.cpp'
2--- PetriEngine/Reducer.cpp 2018-05-17 18:59:24 +0000
3+++ PetriEngine/Reducer.cpp 2019-03-28 13:54:47 +0000
4@@ -972,6 +972,15 @@
5
6 if((numberofplaces - _removedPlaces) > 1)
7 {
8+ if(reconstructTrace)
9+ {
10+ for(auto t : place.consumers)
11+ {
12+ std::string tname = getTransitionName(t);
13+ const ArcIter arc = getInArc(p, getTransition(t));
14+ _extraconsume[tname].emplace_back(getPlaceName(p), arc->weight);
15+ }
16+ }
17 skipPlace(p);
18 continueReductions = true;
19 }
20@@ -1066,6 +1075,8 @@
21
22 bool Reducer::ReducebyRuleH(uint32_t* placeInQuery)
23 {
24+ if(reconstructTrace)
25+ return false; // we don't know where in the loop the tokens are needed
26 bool continueReductions = false;
27 for(uint32_t t1 = 0; t1 < parent->numberOfTransitions(); ++t1)
28 {
29@@ -1164,6 +1175,8 @@
30 _timer = std::chrono::high_resolution_clock::now();
31 assert(consistent());
32 this->reconstructTrace = reconstructTrace;
33+ if(reconstructTrace && enablereduction >= 1 && enablereduction <= 2)
34+ std::cout << "Rule H disabled when a trace is requested." << std::endl;
35 if (enablereduction == 1) { // in the aggressive reduction all four rules are used as long as they remove something
36 bool changed = false;
37 do

Subscribers

People subscribed via source and target branches