~tapaal-ltl/verifypn/answer-for-gui

213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
1
/*
2
 *  Copyright Peter G. Jensen, all rights reserved.
3
 */
4
5
/* 
6
 * File:   Solver.h
7
 * Author: Peter G. Jensen <root@petergjoel.dk>
8
 *
9
 * Created on April 3, 2020, 8:08 PM
10
 */
11
12
#ifndef SOLVER_H
13
#define SOLVER_H
14
15
#include "TARAutomata.h"
16
#include "range.h"
17
#include "PetriEngine/PQL/PQL.h"
213.1.92 by Peter G. Jensen
adding both forward and backwards
18
#include "TraceSet.h"
230.2.1 by Nikolaj Jensen Ulrik
Refactor stubborn set implementation out of ReducingSuccessorGenerator
19
#include "PetriEngine/SuccessorGenerator.h"
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
20
21
#include <utility>
22
#include <cinttypes>
23
24
namespace PetriEngine {
25
    namespace Reachability {
26
        using namespace PQL;
27
        class Solver {
28
        public:
213.1.90 by Peter G. Jensen
fixing indexing
29
            using inter_t = std::pair<prvector_t, size_t>;
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
30
            using interpolant_t = std::vector<inter_t>;
31
            Solver(PetriNet& net, MarkVal* initial, Condition* query, std::vector<bool>& inq);
213.1.92 by Peter G. Jensen
adding both forward and backwards
32
            bool check(trace_t& trace, TraceSet& interpolants);
213.1.108 by Peter G. Jensen
first try of edge skipping
33
            const std::vector<bool>& in_query() const { return _inq; }
213.1.110 by Peter G. Jensen
should fix upperbounds and deadlock
34
            Condition* query() const { return _query; }
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
35
        private:
213.1.104 by Peter G. Jensen
added retry when interpolant computed becomes invalid
36
            int64_t findFailure(trace_t& trace, bool to_end);
213.1.91 by Peter G. Jensen
trying with backwards reasoning
37
            interpolant_t findFree(trace_t& trace);
213.1.104 by Peter G. Jensen
added retry when interpolant computed becomes invalid
38
            bool computeHoare(trace_t& trace, interpolant_t& ranges, int64_t fail);
213.1.107 by Peter G. Jensen
adding all traces (with minor cache)
39
            bool computeTerminal(state_t& end, inter_t& last);
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
40
            PetriNet& _net;
41
            MarkVal* _initial;
42
            Condition* _query;
43
            std::vector<bool> _inq;
213.1.106 by Peter G. Jensen
added missing hoare computation
44
            std::vector<bool> _dirty;
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
45
            std::unique_ptr<int64_t[]> _m;
213.1.84 by Peter G. Jensen
added copy-out of marking at fail-point
46
            std::unique_ptr<int64_t[]> _failm;
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
47
            std::unique_ptr<MarkVal[]> _mark;
213.1.79 by Peter G. Jensen
added priority on places
48
            std::unique_ptr<uint64_t[]> _use_count;
213.1.72 by Peter G. Jensen
refactored implementation into meaningfull components
49
#ifndef NDEBUG
50
            SuccessorGenerator _gen;
51
#endif
52
        };
53
    }
54
}
55
56
#endif /* SOLVER_H */
57