~tapaal-red/verifypn/rule-l

« back to all changes in this revision

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

  • Committer: Peter G. Jensen
  • Date: 2020-03-02 21:03:24 UTC
  • mto: (213.1.38 verifypn_cmake)
  • mto: This revision was merged to the branch mainline in revision 225.
  • Revision ID: peter.gjoel@gmail.com-20200302210324-mmaia5l9vthz8oxx
adding rebuild structure

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:51 PM
 
6
 */
 
7
 
 
8
#include "CTL/SearchStrategy/HeuristicSearch.h"
 
9
#include "CTL/DependencyGraph/Edge.h"
 
10
#include "CTL/SearchStrategy/SearchStrategy.h"
 
11
#include "CTL/DependencyGraph/Configuration.h"
 
12
 
 
13
namespace SearchStrategy {
 
14
 
 
15
    size_t HeuristicSearch::Wsize() const {
 
16
        return W.size();
 
17
    }
 
18
 
 
19
    void HeuristicSearch::pushToW(DependencyGraph::Edge* edge) {
 
20
        W.push_back(edge);
 
21
    }
 
22
 
 
23
    DependencyGraph::Edge* HeuristicSearch::popFromW() {
 
24
        auto it = std::max_element(W.begin(), W.end(), [](auto a, auto b){
 
25
            return a->targets.size() < b->targets.size();
 
26
        });
 
27
        auto edge = *it;
 
28
        W.erase(it);
 
29
        return edge;
 
30
    }  
 
31
}