diff --git a/src/storm/builder/ExplicitModelBuilder.cpp b/src/storm/builder/ExplicitModelBuilder.cpp index b80825d1d..9ea3a6c5b 100644 --- a/src/storm/builder/ExplicitModelBuilder.cpp +++ b/src/storm/builder/ExplicitModelBuilder.cpp @@ -41,10 +41,18 @@ namespace storm { template StateType ExplicitStateLookup::lookup(std::map const& stateDescription) const { auto cs = storm::generator::createCompressedState(this->varInfo, stateDescription, true); - STORM_LOG_THROW(stateToId.contains(cs), storm::exceptions::IllegalArgumentException, "State unknown."); + //TODO search once + if (!stateToId.contains(cs)) { + return static_cast(this->size()); + } return this->stateToId.getValue(cs); } + template + uint64_t ExplicitStateLookup::size() const { + return this->stateToId.size(); + } + template ExplicitModelBuilder::Options::Options() : explorationOrder(storm::settings::getModule().getExplorationOrder()) { // Intentionally left empty. diff --git a/src/storm/builder/ExplicitModelBuilder.h b/src/storm/builder/ExplicitModelBuilder.h index f33b37ba3..1fb451889 100644 --- a/src/storm/builder/ExplicitModelBuilder.h +++ b/src/storm/builder/ExplicitModelBuilder.h @@ -53,7 +53,16 @@ namespace storm { // intentionally left empty. } + /** + * Lookup state + * @param stateDescription A map describing the state + * @return The id of the state, or size() when no state is found + */ StateType lookup(std::map const& stateDescription) const; + /** + * How many states have been stored? + */ + uint64_t size() const; private: VariableInformation varInfo;