From 919dfeebaeeb350edfb6749edf006852fbce7a50 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Tue, 7 Aug 2018 20:53:12 -0700 Subject: [PATCH] "number of edges" and "number of commands" in jani model / prism programs --- src/storm/storage/jani/Model.cpp | 10 +++++++++- src/storm/storage/jani/Model.h | 5 +++++ src/storm/storage/prism/Program.cpp | 8 ++++++++ src/storm/storage/prism/Program.h | 7 ++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/storm/storage/jani/Model.cpp b/src/storm/storage/jani/Model.cpp index d91e0c3bc..222d31326 100644 --- a/src/storm/storage/jani/Model.cpp +++ b/src/storm/storage/jani/Model.cpp @@ -608,7 +608,15 @@ namespace storm { std::vector& Model::getConstants() { return constants; } - + + std::size_t Model::getNumberOfEdges() const { + size_t res = 0; + for (auto const& aut : getAutomata()) { + res += aut.getNumberOfEdges(); + } + return res; + } + Variable const& Model::addVariable(Variable const& variable) { if (variable.isBooleanVariable()) { return addVariable(variable.asBooleanVariable()); diff --git a/src/storm/storage/jani/Model.h b/src/storm/storage/jani/Model.h index 86555a2d4..2954b1c9f 100644 --- a/src/storm/storage/jani/Model.h +++ b/src/storm/storage/jani/Model.h @@ -287,6 +287,11 @@ namespace storm { * Retrieves the number of automata in this model. */ std::size_t getNumberOfAutomata() const; + + /*! + * Retrieves the total number of edges in this model. + */ + std::size_t getNumberOfEdges() const; /*! * Sets the system composition expression of the JANI model. diff --git a/src/storm/storage/prism/Program.cpp b/src/storm/storage/prism/Program.cpp index f12686315..45a4f5a1c 100644 --- a/src/storm/storage/prism/Program.cpp +++ b/src/storm/storage/prism/Program.cpp @@ -192,6 +192,14 @@ namespace storm { bool Program::isDeterministicModel() const { return modelType == ModelType::DTMC || modelType == ModelType::CTMC; } + + size_t Program::getNumberOfCommands() const { + size_t res = 0; + for (auto const& module : this->getModules()) { + res += module.getNumberOfCommands(); + } + return res; + } bool Program::hasUndefinedConstants() const { for (auto const& constant : this->getConstants()) { diff --git a/src/storm/storage/prism/Program.h b/src/storm/storage/prism/Program.h index 3adc3151f..40c3e4a47 100644 --- a/src/storm/storage/prism/Program.h +++ b/src/storm/storage/prism/Program.h @@ -157,7 +157,12 @@ namespace storm { * @return */ std::vector usedConstants() const; - + + /*! + * The total number of commands in the prism file. + */ + size_t getNumberOfCommands() const; + /*! * Retrieves whether a global Boolean variable with the given name exists *