Browse Source

use utility::vector::max_if to compute the maximum exit rate in an MA

tempestpy_adaptions
TimQu 7 years ago
parent
commit
76c01de25c
  1. 6
      src/storm/models/sparse/MarkovAutomaton.cpp
  2. 8
      src/storm/utility/vector.h

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

@ -93,11 +93,7 @@ namespace storm {
template <typename ValueType, typename RewardModelType> template <typename ValueType, typename RewardModelType>
ValueType MarkovAutomaton<ValueType, RewardModelType>::getMaximalExitRate() const { ValueType MarkovAutomaton<ValueType, RewardModelType>::getMaximalExitRate() const {
ValueType result = storm::utility::zero<ValueType>();
for (auto markovianState : this->markovianStates) {
result = std::max(result, this->exitRates[markovianState]);
}
return result;
return storm::utility::vector::max_if(this->exitRates, this->markovianStates);
} }
template <typename ValueType, typename RewardModelType> template <typename ValueType, typename RewardModelType>

8
src/storm/utility/vector.h

@ -563,9 +563,7 @@ namespace storm {
++it; ++it;
for (; it != ite; ++it) { for (; it != ite; ++it) {
if (values[*it] > current) {
current = values[*it];
}
current = std::max(values[*it], current);
} }
return current; return current;
} }
@ -588,9 +586,7 @@ namespace storm {
++it; ++it;
for (; it != ite; ++it) { for (; it != ite; ++it) {
if (values[*it] < current) {
current = values[*it];
}
current = std::min(values[*it], current);
} }
return current; return current;
} }

Loading…
Cancel
Save