Open cdondrup opened 8 years ago
Was a bit too quick with my solution but replacing this:
template<typename PnpPlaceClass, typename PnpTransitionClass>
bool PnpPlanTemplate<PnpPlaceClass, PnpTransitionClass>::isInFailState() const
{
bool noFailMarking = true;
std::set<PnpPlace*>::iterator p_iter=PetriNet<PnpPlaceClass, PnpTransitionClass>::places.begin();
for(;p_iter!=PetriNet<PnpPlaceClass, PnpTransitionClass>::places.end();p_iter++) {
PnpPlace* p = *p_iter;
if (p->failMarking == -1) continue;
else {
noFailMarking = false;
if (p->currentMarking!=(size_t)p->failMarking) return false;
}
}
if (noFailMarking) return false;
else return true;
}
with this
template<typename PnpPlaceClass, typename PnpTransitionClass>
bool PnpPlanTemplate<PnpPlaceClass, PnpTransitionClass>::isInFailState() const
{
std::set<PnpPlace*>::iterator p_iter=PetriNet<PnpPlaceClass, PnpTransitionClass>::places.begin();
for(;p_iter!=PetriNet<PnpPlaceClass, PnpTransitionClass>::places.end();p_iter++) {
PnpPlace* p = *p_iter;
if (p->currentMarking) return p->failMarking == 1 ? true : false;
}
return false;
}
in pnp_plan.hpp fixes the problem for me. The same could be done for the goal. Again, I am not sure why the check was there in the first place and what implications it would have to remove it so I leave it to you if this should be changed or not.
Hi,
Assuming I create a linear plan where multiple sensing actions can end in a place called
fail
this should terminate the plan execution. However, this line of code prevents this. If I have two fail states in my plan, This will always returnfalse
because thep->currentMarking
can only be1
for one of thefail
places which means the other triggers theif
. Just replacing this line with abreak;
fixes the problem. Is there a specific reason why this check is in there? Otherwise, when applying the execution rule it would have to be ensured that everyfail_plan
creates an arc to the one and onlyfail
place which currently is not the case.The same is true for the goal because it has a similar check, therefore, there can only be one goal state.