Browse Source

fixed the case where an expression occurred twice in the formulas

Former-commit-id: 5054ebcae4
tempestpy_adaptions
TimQu 9 years ago
parent
commit
cf299a6344
  1. 11
      src/generator/NextStateGenerator.cpp

11
src/generator/NextStateGenerator.cpp

@ -250,10 +250,6 @@ namespace storm {
template<typename ValueType, typename StateType> template<typename ValueType, typename StateType>
storm::models::sparse::StateLabeling NextStateGenerator<ValueType, StateType>::label(storm::storage::BitVectorHashMap<StateType> const& states, std::vector<StateType> const& initialStateIndices, std::vector<StateType> const& deadlockStateIndices, std::vector<std::pair<std::string, storm::expressions::Expression>> labelsAndExpressions) { storm::models::sparse::StateLabeling NextStateGenerator<ValueType, StateType>::label(storm::storage::BitVectorHashMap<StateType> const& states, std::vector<StateType> const& initialStateIndices, std::vector<StateType> const& deadlockStateIndices, std::vector<std::pair<std::string, storm::expressions::Expression>> labelsAndExpressions) {
// Make the labels unique.
std::sort(labelsAndExpressions.begin(), labelsAndExpressions.end(), [] (std::pair<std::string, storm::expressions::Expression> const& a, std::pair<std::string, storm::expressions::Expression> const& b) { return a.first < b.first; } );
auto it = std::unique(labelsAndExpressions.begin(), labelsAndExpressions.end(), [] (std::pair<std::string, storm::expressions::Expression> const& a, std::pair<std::string, storm::expressions::Expression> const& b) { return a.first == b.first; } );
labelsAndExpressions.resize(std::distance(labelsAndExpressions.begin(), it));
for (auto const& expression : this->options.getExpressionLabels()) { for (auto const& expression : this->options.getExpressionLabels()) {
std::stringstream stream; std::stringstream stream;
@ -261,6 +257,11 @@ namespace storm {
labelsAndExpressions.push_back(std::make_pair(stream.str(), expression)); labelsAndExpressions.push_back(std::make_pair(stream.str(), expression));
} }
// Make the labels unique.
std::sort(labelsAndExpressions.begin(), labelsAndExpressions.end(), [] (std::pair<std::string, storm::expressions::Expression> const& a, std::pair<std::string, storm::expressions::Expression> const& b) { return a.first < b.first; } );
auto it = std::unique(labelsAndExpressions.begin(), labelsAndExpressions.end(), [] (std::pair<std::string, storm::expressions::Expression> const& a, std::pair<std::string, storm::expressions::Expression> const& b) { return a.first == b.first; } );
labelsAndExpressions.resize(std::distance(labelsAndExpressions.begin(), it));
// Prepare result. // Prepare result.
storm::models::sparse::StateLabeling result(states.size()); storm::models::sparse::StateLabeling result(states.size());
@ -306,4 +307,4 @@ namespace storm {
template class NextStateGenerator<storm::RationalFunction>; template class NextStateGenerator<storm::RationalFunction>;
} }
}
}
Loading…
Cancel
Save