~tapaal-ltl/verifypn/scc-optimise

« back to all changes in this revision

Viewing changes to src/CTL/SearchStrategy/RDFSSearch.cpp

  • 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:   Encoder.h
 
3
 * Author: Peter G. Jensen
 
4
 * 
 
5
 * Created on March 7, 2018, 1:52 PM
 
6
 */
 
7
 
 
8
#include "CTL/SearchStrategy/RDFSSearch.h"
 
9
#include "CTL/DependencyGraph/Configuration.h"
 
10
 
 
11
#include <algorithm>
 
12
#include <random>
 
13
 
 
14
namespace SearchStrategy {
 
15
size_t RDFSSearch::Wsize() const {
 
16
    return W.size();
 
17
}
 
18
 
 
19
DependencyGraph::Edge* RDFSSearch::popFromW() {
 
20
    auto e = W.back();
 
21
    W.pop_back();
 
22
    last_parent = W.size();
 
23
    return e;
 
24
}
 
25
 
 
26
void RDFSSearch::pushToW(DependencyGraph::Edge* edge) {
 
27
    last_parent = std::min(W.size(), last_parent);
 
28
    W.push_back(edge);
 
29
}
 
30
 
 
31
auto rng = std::default_random_engine {};
 
32
void RDFSSearch::flush() {
 
33
    last_parent = std::min(last_parent, W.size());
 
34
    std::shuffle(W.begin() + last_parent, W.end(), rng);
 
35
    last_parent = W.size();
 
36
}
 
37
 
 
38
}