1
#ifndef PETRIENGINE_REDUCINGSUCCESSORGENERATOR_H_
2
#define PETRIENGINE_REDUCINGSUCCESSORGENERATOR_H_
4
#include "SuccessorGenerator.h"
5
#include "Structures/State.h"
6
#include "Structures/light_deque.h"
10
namespace PetriEngine {
12
class ReducingSuccessorGenerator : public SuccessorGenerator {
22
trans_t(uint32_t id, int8_t dir) : index(id), direction(dir) {};
23
bool operator<(const trans_t& t) const
25
return index < t.index;
28
ReducingSuccessorGenerator(const PetriNet& net);
29
ReducingSuccessorGenerator(const PetriNet& net, std::vector<std::shared_ptr<PQL::Condition> >& queries);
30
virtual ~ReducingSuccessorGenerator();
31
void prepare(const Structures::State* state);
32
bool next(Structures::State& write);
33
void presetOf(uint32_t place, bool make_closure = false);
34
void postsetOf(uint32_t place, bool make_closure = false);
35
void postPresetOf(uint32_t t, bool make_closure = false);
36
void inhibitorPostsetOf(uint32_t place);
37
bool seenPre(uint32_t place) const;
38
bool seenPost(uint32_t place) const;
39
uint32_t leastDependentEnabled();
44
void setQuery(PQL::Condition* ptr) { _queries.clear(); _queries = {ptr};}
48
inline void addToStub(uint32_t t);
50
bool *_enabled, *_stubborn;
51
std::unique_ptr<uint8_t> _places_seen;
52
std::unique_ptr<place_t[]> _places;
53
std::unique_ptr<trans_t[]> _transitions;
54
light_deque<uint32_t> _unprocessed, _ordering;
55
uint32_t *_dependency;
57
bool _netContainsInhibitorArcs;
58
std::vector<std::vector<uint32_t>> _inhibpost;
60
std::vector<PQL::Condition* > _queries;
61
void constructEnabled();
62
void constructPrePost();
63
void constructDependency();
64
void checkForInhibitor();
68
#endif /* PETRIENGINE_REDUCINGSUCCESSORGENERATOR_H_ */