~tapaal-ltl/verifypn/scc-optimise

« back to all changes in this revision

Viewing changes to PetriEngine/Simplification/LPCache.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
 
 * File:   LPFactory.h
3
 
 * Author: Peter G. Jensen
4
 
 *
5
 
 * Created on 31 May 2017, 09:26
6
 
 */
7
 
 
8
 
#ifndef LPFACTORY_H
9
 
#define LPFACTORY_H
10
 
 
11
 
#include <vector>
12
 
#include <unordered_set>
13
 
#include <memory>
14
 
#include "MurmurHash2.h"
15
 
#include "Member.h"
16
 
#include "Vector.h"
17
 
 
18
 
 
19
 
namespace PetriEngine {
20
 
    namespace Simplification {
21
 
        class LinearProgram;
22
 
 
23
 
 
24
 
        class LPCache {
25
 
        public:
26
 
            LPCache();
27
 
            virtual ~LPCache();
28
 
            Vector* createAndCache(const std::vector<int>& data)
29
 
            {
30
 
                auto res = vectors.insert(Vector(data));
31
 
                Vector& v = const_cast<Vector&>(*res.first);
32
 
                v.inc();
33
 
//                if(res.second) std::cout << "VECTORS : " << vectors.size() << std::endl;
34
 
               // assert(v.refs() > 0);
35
 
                return &v;
36
 
            }
37
 
            
38
 
            void invalidate(const Vector& vector)
39
 
            {
40
 
             //   vectors.erase(vector);
41
 
             //   assert(vector.refs() == 0);
42
 
            }
43
 
 
44
 
            
45
 
        private:
46
 
            // unordered_map does not invalidate on insert, only erase
47
 
            std::unordered_set<Vector> vectors;
48
 
        };
49
 
 
50
 
    }
51
 
}
52
 
 
53
 
#endif /* LPFACTORY_H */
54