5
#include "CTL/DependencyGraph/Configuration.h"
7
bool SearchStrategy::DFSSearch::empty() const
9
return W.empty() && N.empty() && D.empty();
12
void SearchStrategy::DFSSearch::pushNegation(DependencyGraph::Edge* edge)
17
bool hasCZero = false;
19
for (DependencyGraph::Configuration *c : edge->targets) {
20
if (c->assignment == DependencyGraph::Assignment::CZERO) {
24
if (c->assignment != DependencyGraph::Assignment::ONE) {
29
if(allOne || hasCZero)
36
possibleTrivial = true;
40
void SearchStrategy::DFSSearch::pushEdge(DependencyGraph::Edge *edge)
42
if(edge->status > 0 || edge->source->isDone()) return;
43
if(edge->processed && edge->is_negated)
53
void SearchStrategy::DFSSearch::pushDependency(DependencyGraph::Edge* edge)
55
if(edge->source->isDone()) return;
61
DependencyGraph::Edge* SearchStrategy::DFSSearch::popEdge(bool saturate)
63
if(saturate && D.empty()) return nullptr;
65
if (W.empty() && D.empty()) {
69
auto edge = D.empty() ? W.back() : D.back();
76
assert(edge->refcnt >= 0);
82
uint32_t SearchStrategy::DFSSearch::maxDistance() const
85
for(DependencyGraph::Edge* e : N)
87
if(!e->source->isDone())
88
m = std::max(m, e->source->getDistance());
93
bool SearchStrategy::DFSSearch::available() const
95
return !W.empty() || !D.empty();
98
void SearchStrategy::DFSSearch::releaseNegationEdges(uint32_t dist)
100
for(auto it = N.begin(); it != N.end(); ++it)
103
if((*it)->source->getDistance() >= dist || (*it)->source->isDone())
106
assert(W.front()->weight >= W.back()->weight);
108
if(N.empty() || it == N.end()) break;
113
bool SearchStrategy::DFSSearch::trivialNegation()
115
for(auto it = N.begin(); it != N.end(); ++it)
118
bool hasCZero = false;
120
for (DependencyGraph::Configuration *c : e->targets) {
121
if (c->assignment == DependencyGraph::Assignment::CZERO) {
125
if (c->assignment != DependencyGraph::Assignment::ONE) {
130
if(allOne || hasCZero)
134
if(N.empty() || it == N.end()) break;
137
possibleTrivial = false;