Browse Source

remove constant from model, e.g. for constants that do not appear in the model

tempestpy_adaptions
Sebastian Junges 6 years ago
parent
commit
98f1468479
  1. 16
      src/storm/storage/jani/Model.cpp
  2. 5
      src/storm/storage/jani/Model.h

16
src/storm/storage/jani/Model.cpp

@ -637,6 +637,22 @@ namespace storm {
bool Model::hasConstant(std::string const& name) const {
return constantToIndex.find(name) != constantToIndex.end();
}
void Model::removeConstant(std::string const& name) {
auto pos = constantToIndex.find(name);
if (pos != constantToIndex.end()) {
uint64_t index = pos->second;
constants.erase(constants.begin() + index);
constantToIndex.erase(pos);
for (auto& entry : constantToIndex) {
if(entry.second > index) {
entry.second--;
}
}
}
}
Constant const& Model::getConstant(std::string const& name) const {
auto it = constantToIndex.find(name);

5
src/storm/storage/jani/Model.h

@ -169,6 +169,11 @@ namespace storm {
* Retrieves whether the model has a constant with the given name.
*/
bool hasConstant(std::string const& name) const;
/*!
* Removes (without checks) a constant from the model.
*/
void removeConstant(std::string const& name);
/*!
* Retrieves the constants of the model.

Loading…
Cancel
Save