~tapaal-ltl/verifypn/scc-optimise

« back to all changes in this revision

Viewing changes to PetriEngine/Colored/Multiset.h

  • Committer: srba.jiri at gmail
  • Date: 2020-09-11 14:23:39 UTC
  • mfrom: (213.1.151 interval_tar)
  • Revision ID: srba.jiri@gmail.com-20200911142339-bq9328s1gppw24uj
merged in lp:~verifypn-maintainers/verifypn/interval_tar doing 
- Implements TAR w/o z3, but using a simple integer inference engine for Hoare logic.
 - Replaces LP-Solve with GLPK, reduces computation-time and memory overhead
 - Implements new global properties, translated into CTL formulae.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * To change this license header, choose License Headers in Project Properties.
3
 
 * To change this template file, choose Tools | Templates
4
 
 * and open the template in the editor.
5
 
 */
6
 
 
7
 
/* 
8
 
 * File:   Multiset.h
9
 
 * Author: andreas
10
 
 *
11
 
 * Created on February 20, 2018, 10:37 AM
12
 
 */
13
 
 
14
 
#ifndef MULTISET_H
15
 
#define MULTISET_H
16
 
 
17
 
#include <vector>
18
 
#include <utility>
19
 
 
20
 
#include "Colors.h"
21
 
 
22
 
 
23
 
namespace PetriEngine {
24
 
    namespace Colored {
25
 
        class Multiset {
26
 
        private:
27
 
            class Iterator {
28
 
            private:
29
 
                Multiset* ms;
30
 
                size_t index;
31
 
 
32
 
            public:
33
 
                Iterator(Multiset* ms, size_t index)
34
 
                        : ms(ms), index(index) {}
35
 
 
36
 
                bool operator==(Iterator& other);
37
 
                bool operator!=(Iterator& other);
38
 
                Iterator& operator++();
39
 
                std::pair<const Color*,uint32_t&> operator++(int);
40
 
                std::pair<const Color*,uint32_t&> operator*();
41
 
            };
42
 
 
43
 
            typedef std::vector<std::pair<uint32_t,uint32_t>> Internal;
44
 
            
45
 
        public:
46
 
            Multiset();
47
 
            Multiset(const Multiset& orig);
48
 
            Multiset(std::pair<const Color*,uint32_t> color);
49
 
            Multiset(std::vector<std::pair<const Color*,uint32_t>>& colors);
50
 
            virtual ~Multiset();
51
 
            
52
 
            Multiset operator+ (const Multiset& other) const;
53
 
            Multiset operator- (const Multiset& other) const;
54
 
            Multiset operator* (uint32_t scalar) const;
55
 
            void operator+= (const Multiset& other);
56
 
            void operator-= (const Multiset& other);
57
 
            void operator*= (uint32_t scalar);
58
 
            uint32_t operator[] (const Color* color) const;
59
 
            uint32_t& operator[] (const Color* color);
60
 
            
61
 
            bool empty() const;
62
 
            void clean();
63
 
 
64
 
            size_t distinctSize() const {
65
 
                return _set.size();
66
 
            }
67
 
 
68
 
            size_t size() const;
69
 
            
70
 
            Iterator begin();
71
 
            Iterator end();
72
 
 
73
 
            std::string toString() const;
74
 
            
75
 
        private:
76
 
            Internal _set;
77
 
            ColorType* type;
78
 
        };
79
 
    }
80
 
}
81
 
 
82
 
#endif /* MULTISET_H */
83