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
=== modified file 'PetriEngine/Reducer.cpp'
--- PetriEngine/Reducer.cpp 2018-05-17 18:59:24 +0000
+++ PetriEngine/Reducer.cpp 2019-03-28 13:54:47 +0000
@@ -972,6 +972,15 @@
972 972
973 if((numberofplaces - _removedPlaces) > 1)973 if((numberofplaces - _removedPlaces) > 1)
974 {974 {
975 if(reconstructTrace)
976 {
977 for(auto t : place.consumers)
978 {
979 std::string tname = getTransitionName(t);
980 const ArcIter arc = getInArc(p, getTransition(t));
981 _extraconsume[tname].emplace_back(getPlaceName(p), arc->weight);
982 }
983 }
975 skipPlace(p);984 skipPlace(p);
976 continueReductions = true;985 continueReductions = true;
977 }986 }
@@ -1066,6 +1075,8 @@
1066 1075
1067 bool Reducer::ReducebyRuleH(uint32_t* placeInQuery)1076 bool Reducer::ReducebyRuleH(uint32_t* placeInQuery)
1068 {1077 {
1078 if(reconstructTrace)
1079 return false; // we don't know where in the loop the tokens are needed
1069 bool continueReductions = false;1080 bool continueReductions = false;
1070 for(uint32_t t1 = 0; t1 < parent->numberOfTransitions(); ++t1)1081 for(uint32_t t1 = 0; t1 < parent->numberOfTransitions(); ++t1)
1071 {1082 {
@@ -1164,6 +1175,8 @@
1164 _timer = std::chrono::high_resolution_clock::now();1175 _timer = std::chrono::high_resolution_clock::now();
1165 assert(consistent());1176 assert(consistent());
1166 this->reconstructTrace = reconstructTrace;1177 this->reconstructTrace = reconstructTrace;
1178 if(reconstructTrace && enablereduction >= 1 && enablereduction <= 2)
1179 std::cout << "Rule H disabled when a trace is requested." << std::endl;
1167 if (enablereduction == 1) { // in the aggressive reduction all four rules are used as long as they remove something1180 if (enablereduction == 1) { // in the aggressive reduction all four rules are used as long as they remove something
1168 bool changed = false;1181 bool changed = false;
1169 do1182 do

Subscribers

People subscribed via source and target branches