Browse Source

Fixed imprecision in comparison for MA

main
Matthias Volk 6 years ago
parent
commit
15dadf1bc3
  1. 6
      src/storm/models/sparse/MarkovAutomaton.cpp

6
src/storm/models/sparse/MarkovAutomaton.cpp

@ -5,6 +5,7 @@
#include "storm/solver/stateelimination/StateEliminator.h" #include "storm/solver/stateelimination/StateEliminator.h"
#include "storm/storage/FlexibleSparseMatrix.h" #include "storm/storage/FlexibleSparseMatrix.h"
#include "storm/utility/constants.h" #include "storm/utility/constants.h"
#include "storm/utility/ConstantsComparator.h"
#include "storm/utility/vector.h" #include "storm/utility/vector.h"
#include "storm/utility/macros.h" #include "storm/utility/macros.h"
#include "storm/utility/graph.h" #include "storm/utility/graph.h"
@ -137,6 +138,7 @@ namespace storm {
this->exitRates.reserve(this->getNumberOfStates()); this->exitRates.reserve(this->getNumberOfStates());
} }
storm::utility::ConstantsComparator<ValueType> comparator;
for (uint_fast64_t state = 0; state< this->getNumberOfStates(); ++state) { for (uint_fast64_t state = 0; state< this->getNumberOfStates(); ++state) {
uint_fast64_t row = this->getTransitionMatrix().getRowGroupIndices()[state]; uint_fast64_t row = this->getTransitionMatrix().getRowGroupIndices()[state];
if (this->markovianStates.get(state)) { if (this->markovianStates.get(state)) {
@ -151,13 +153,13 @@ namespace storm {
++row; ++row;
} else { } else {
if (assertRates) { if (assertRates) {
STORM_LOG_THROW(storm::utility::isZero<ValueType>(this->exitRates[state]), storm::exceptions::InvalidArgumentException, "The specified exit rate for (non-Markovian) choice should be 0.");
STORM_LOG_THROW(comparator.isZero(this->exitRates[state]), storm::exceptions::InvalidArgumentException, "The specified exit rate for (non-Markovian) choice should be 0.");
} else { } else {
this->exitRates.push_back(storm::utility::zero<ValueType>()); this->exitRates.push_back(storm::utility::zero<ValueType>());
} }
} }
for (; row < this->getTransitionMatrix().getRowGroupIndices()[state+1]; ++row) { for (; row < this->getTransitionMatrix().getRowGroupIndices()[state+1]; ++row) {
STORM_LOG_THROW(storm::utility::isOne(this->getTransitionMatrix().getRowSum(row)), storm::exceptions::InvalidArgumentException, "Entries of transition matrix do not sum up to one for (non-Markovian) choice " << row << " of state " << state << " (sum is " << this->getTransitionMatrix().getRowSum(row) << ").");
STORM_LOG_THROW(comparator.isOne(this->getTransitionMatrix().getRowSum(row)), storm::exceptions::InvalidArgumentException, "Entries of transition matrix do not sum up to one for (non-Markovian) choice " << row << " of state " << state << " (sum is " << this->getTransitionMatrix().getRowSum(row) << ").");
} }
} }
} }

Loading…
Cancel
Save