Пример #1
0
bool StateConstraints::isInMaxTrap(const PetriNet& net,
								   size_t place,
								   const BitField& places,
								   const MarkVal* resultMarking) const{
	if(!places.test(place))
		return false;
	/*
		0 if M(p_i) = 1
		0 if there is (p_i , t) ∈ F such that x_j = 0
			for every p_j ∈ t•
		1 otherwise
	*/
	if(resultMarking[place] > 0)
		return false;

	for(unsigned int t = 0; t < net.numberOfTransitions(); t++){
		if(net.inArc(place, t) > 0){
			bool exclude = true;
			for(unsigned int j = 0; j < net.numberOfPlaces(); j++){
				if(net.outArc(t, j) > 0){
					exclude &= !places.test(j);
				}
			}
			if(exclude)
				return false;
		}
	}
	return true;
}
Пример #2
0
bool StateConstraints::isMarked(const BitField& places, const MarkVal* marking) const{
	for(size_t p = 0; p < places.size(); p++)
		if(places.test(p) && marking[p] > 0)
			return true;
	return false;
}