Browse Source

convenience operation on prism programs

tempestpy_adaptions
Sebastian Junges 4 years ago
parent
commit
f45b56e725
  1. 10
      src/storm/storage/prism/Module.cpp
  2. 5
      src/storm/storage/prism/Module.h
  3. 8
      src/storm/storage/prism/Program.cpp
  4. 5
      src/storm/storage/prism/Program.h

10
src/storm/storage/prism/Module.cpp

@ -115,6 +115,16 @@ namespace storm {
return this->actionIndicesToCommandIndexMap.find(actionIndex) != this->actionIndicesToCommandIndexMap.end();
}
uint64_t Module::getNumberOfUnlabeledCommands() const {
uint64_t result = 0;
for (auto const& cmd : commands) {
if(!cmd.isLabeled()) {
result++;
}
}
return result;
}
bool Module::isRenamedFromModule() const {
return this->renamedFromModule != "";
}

5
src/storm/storage/prism/Module.h

@ -264,6 +264,11 @@ namespace storm {
*/
void createMissingInitialValues();
/*
* Gets the number of commands without a label
*/
uint64_t getNumberOfUnlabeledCommands() const;
/*!
* Returns true, if an invariant was specified (only relevant for PTA models)
*/

8
src/storm/storage/prism/Program.cpp

@ -509,6 +509,14 @@ namespace storm {
return actionToIndexMap;
}
uint64_t Program::getNumberOfUnlabeledCommands() const {
uint64_t result = 0;
for (auto const& m : modules) {
result += m.getNumberOfUnlabeledCommands();
}
return result;
}
bool Program::hasInitialConstruct() const {
return static_cast<bool>(initialConstruct);
}

5
src/storm/storage/prism/Program.h

@ -463,6 +463,11 @@ namespace storm {
*/
std::pair<uint_fast64_t, uint_fast64_t> getModuleCommandIndexByGlobalCommandIndex(uint_fast64_t globalCommandIndex) const;
/*
* Get total number of unlabeled commands
*/
uint64_t getNumberOfUnlabeledCommands() const;
/*!
* Retrieves whether the program has reward models.
*

Loading…
Cancel
Save