Browse Source

Fix TODO

tempestpy_adaptions
Jip Spel 6 years ago
parent
commit
728dc9e8a4
  1. 32
      src/storm-pars/analysis/Lattice.cpp
  2. 7
      src/storm-pars/analysis/Lattice.h

32
src/storm-pars/analysis/Lattice.cpp

@ -3,6 +3,7 @@
//
#include <iostream>
#include <fstream>
#include "Lattice.h"
namespace storm {
namespace analysis {
@ -100,36 +101,37 @@ namespace storm {
addBetween(state, top, bottom);
}
void Lattice::addRelation(storm::analysis::Lattice::Node *above, storm::analysis::Lattice::Node *between,
storm::analysis::Lattice::Node *below) {
above->below.insert(between);
between->above.insert(above);
between->below.insert(below);
below->above.insert(between);
}
void Lattice::addRelationNodes(storm::analysis::Lattice::Node *above, storm::analysis::Lattice::Node * below) {
if (above != below) {
above->below.insert(below);
below->above.insert(above);
}
}
int Lattice::compare(uint_fast64_t state1, uint_fast64_t state2) {
Node *node1 = getNode(state1);
Node *node2 = getNode(state2);
// TODO: Wat als above(node1, node2) en above(node2, node1), dan moeten ze samengevoegd?
return compare(node1, node2);
}
int Lattice::compare(Node* node1, Node* node2) {
if (node1 != nullptr && node2 != nullptr) {
if (node1 == node2) {
return SAME;
}
std::set<Node*>* seen1 = new std::set<Node*>({});
if (above(node1, node2, seen1)) {
bool isAbove = above(node1, node2, new std::set<Node*>({}));
bool isBelow = above(node2, node1, new std::set<Node*>({}));
if (isAbove && isBelow) {
return SAME;
}
if (isAbove) {
return ABOVE;
}
std::set<Node*>* seen2 = new std::set<Node*>({});
if (above(node2, node1, seen2)) {
if (isBelow) {
return BELOW;
}
}
@ -137,6 +139,7 @@ namespace storm {
return UNKNOWN;
}
Lattice::Node *Lattice::getNode(uint_fast64_t stateNumber) {
return nodes.at(stateNumber);
}
@ -153,7 +156,6 @@ namespace storm {
return nodes;
}
storm::storage::BitVector Lattice::getAddedStates() {
return addedStates;
}
@ -216,7 +218,6 @@ namespace storm {
}
void Lattice::toDotFile(std::ostream &out) {
// TODO: op de een of andere manier ontstaan er nodes die nergens eindigen/beginnen
out << "digraph \"Lattice\" {" << std::endl;
// print all nodes
@ -255,7 +256,6 @@ namespace storm {
out << "}" << std::endl;
}
bool Lattice::above(Node *node1, Node *node2, std::set<Node *>* seenNodes) {
bool result = !node1->below.empty() && std::find(node1->below.begin(), node1->below.end(), node2) != node1->below.end();
for (auto itr = node1->below.begin(); !result && node1->below.end() != itr; ++itr) {

7
src/storm-pars/analysis/Lattice.h

@ -55,13 +55,10 @@ namespace storm {
void add(uint_fast64_t state);
/*!
* Adds a new relation to the lattice
* Adds a new relation between two nodes to the lattice
* @param above The node closest to the top Node of the Lattice.
* @param between The node between above and below.
* @param below The node closest to the bottom Node of the Lattice.
*/
void addRelation(Node* above, Node* between, Node* below);
void addRelationNodes(storm::analysis::Lattice::Node *above, storm::analysis::Lattice::Node * below);
/*!
@ -137,6 +134,8 @@ namespace storm {
* @return
*/
bool above(Node * node1, Node * node2, std::set<Node*>* seenNodes);
int compare(Node* node1, Node* node2);
};
}
}

Loading…
Cancel
Save