Browse Source

Ignore self loops in lattice creation when there are several outgoing transitions

tempestpy_adaptions
Jip Spel 6 years ago
parent
commit
88c6b4d66b
  1. 3
      src/storm-pars/analysis/Lattice.cpp
  2. 6
      src/storm-pars/analysis/LatticeExtender.cpp

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

@ -82,7 +82,8 @@ namespace storm {
void Lattice::addBetween(uint_fast64_t state, Node *above, Node *below) { void Lattice::addBetween(uint_fast64_t state, Node *above, Node *below) {
assert(!addedStates[state]); assert(!addedStates[state]);
assert(compare(above, below) == ABOVE);
auto res = compare(above, below);
assert(res == ABOVE || res == UNKNOWN);
Node *newNode = new Node(); Node *newNode = new Node();
newNode->states = storm::storage::BitVector(numberOfStates); newNode->states = storm::storage::BitVector(numberOfStates);
newNode->states.set(state); newNode->states.set(state);

6
src/storm-pars/analysis/LatticeExtender.cpp

@ -94,9 +94,12 @@ namespace storm {
auto row = matrix.getRow(i); auto row = matrix.getRow(i);
for (auto rowItr = row.begin(); rowItr != row.end(); ++rowItr) { for (auto rowItr = row.begin(); rowItr != row.end(); ++rowItr) {
// ignore self-loops when there are more transitions
if (i != rowItr->getColumn() || row.getNumberOfEntries() == 1) {
stateMap[i].set(rowItr->getColumn(), true); stateMap[i].set(rowItr->getColumn(), true);
} }
} }
}
// Create the Lattice // Create the Lattice
storm::analysis::Lattice *lattice = new storm::analysis::Lattice(topStates, bottomStates, numberOfStates); storm::analysis::Lattice *lattice = new storm::analysis::Lattice(topStates, bottomStates, numberOfStates);
@ -154,8 +157,11 @@ namespace storm {
// Check if current state has not been added yet, and all successors have // Check if current state has not been added yet, and all successors have
bool check = !seenStates[stateNumber]; bool check = !seenStates[stateNumber];
for (auto succIndex = successors.getNextSetIndex(0); check && succIndex != numberOfStates; succIndex = successors.getNextSetIndex(++succIndex)) { for (auto succIndex = successors.getNextSetIndex(0); check && succIndex != numberOfStates; succIndex = successors.getNextSetIndex(++succIndex)) {
if (succIndex != stateNumber) {
check &= seenStates[succIndex]; check &= seenStates[succIndex];
} }
// if the stateNumber equals succIndex we have a self-loop
}
if (check && successors.getNumberOfSetBits() == 1) { if (check && successors.getNumberOfSetBits() == 1) {
// As there is only one successor the current state and its successor must be at the same nodes. // As there is only one successor the current state and its successor must be at the same nodes.

Loading…
Cancel
Save