~verifypn-cpn/verifypn/partitioning

« back to all changes in this revision

Viewing changes to include/PetriEngine/Stubborn/StubbornSet.h

  • Committer: tpede16 at aau
  • Date: 2021-04-14 11:51:52 UTC
  • mfrom: (227.5.10 verifypn)
  • Revision ID: tpede16@student.aau.dk-20210414115152-n99btrgc9mmqc02d
Merge with random-fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
            }
51
51
        }
52
52
 
53
 
        virtual void prepare(const Structures::State *marking) = 0;
54
 
 
55
 
        uint32_t next();
 
53
        StubbornSet(const PetriEngine::PetriNet &net, const PQL::Condition_ptr &query)
 
54
                : StubbornSet(net) {
 
55
            _queries.push_back(query.get());
 
56
        }
 
57
 
 
58
        virtual bool prepare(const Structures::State *marking) = 0;
 
59
 
 
60
        virtual uint32_t next();
56
61
 
57
62
        virtual ~StubbornSet() = default;
58
63
 
62
67
            return _parent->marking();
63
68
        }
64
69
 
65
 
        uint32_t _current;
 
70
        uint32_t _current = 0;
66
71
 
67
72
        void presetOf(uint32_t place, bool make_closure = false);
68
73
 
87
92
            _queries = {ptr};
88
93
        }
89
94
 
 
95
        [[nodiscard]] size_t nenabled() const { return _nenabled; }
 
96
 
 
97
        [[nodiscard]] bool *enabled() const { return _enabled.get(); };
 
98
        [[nodiscard]] bool *stubborn() const { return _stubborn.get(); };
 
99
 
90
100
    protected:
91
101
        const PetriEngine::PetriNet &_net;
92
102
        const Structures::State *_parent;
108
118
            }
109
119
        };
110
120
 
111
 
        size_t _tid = 0;
112
 
 
113
121
        const std::vector<TransPtr> &transitions() { return _net._transitions; }
114
122
 
115
123
        const std::vector<Invariant> &invariants() { return _net._invariants; }
118
126
 
119
127
        bool checkPreset(uint32_t t);
120
128
 
121
 
        inline void addToStub(uint32_t t);
 
129
        virtual void addToStub(uint32_t t);
122
130
 
123
131
        void closure();
124
132
 
125
133
        std::unique_ptr<bool[]> _enabled, _stubborn;
 
134
        size_t _nenabled;
 
135
 
 
136
    protected:
126
137
        std::unique_ptr<uint8_t[]> _places_seen;
127
138
        std::unique_ptr<place_t[]> _places;
128
139
        std::unique_ptr<trans_t[]> _transitions;