Browse Source

fixed an allocation issue, performance is now roughly the same as before but memory consumption is reduced

Former-commit-id: ff44804975
tempestpy_adaptions
dehnert 9 years ago
parent
commit
fff7b2d5db
  1. 16
      src/builder/ExplicitPrismModelBuilder.cpp
  2. 6
      src/builder/ExplicitPrismModelBuilder.h
  3. 4
      src/utility/storm.h

16
src/builder/ExplicitPrismModelBuilder.cpp

@ -67,7 +67,12 @@ namespace storm {
}
template <typename ValueType, typename RewardModelType, typename StateType>
ExplicitPrismModelBuilder<ValueType, RewardModelType, StateType>::InternalStateInformation::InternalStateInformation(uint64_t bitsPerState) : stateStorage(bitsPerState, 10000000), bitsPerState(bitsPerState), numberOfStates() {
ExplicitPrismModelBuilder<ValueType, RewardModelType, StateType>::InternalStateInformation::InternalStateInformation() : stateStorage(64, 10), initialStateIndices(), bitsPerState(64), numberOfStates() {
// Intentionally left empty.
}
template <typename ValueType, typename RewardModelType, typename StateType>
ExplicitPrismModelBuilder<ValueType, RewardModelType, StateType>::InternalStateInformation::InternalStateInformation(uint64_t bitsPerState) : stateStorage(bitsPerState, 10000000), initialStateIndices(), bitsPerState(bitsPerState), numberOfStates() {
// Intentionally left empty.
}
@ -349,7 +354,7 @@ namespace storm {
StateType currentIndex = internalStateInformation.stateStorage.getValue(currentState);
statesToExplore.pop_front();
STORM_LOG_TRACE("Exploring state with id " << index << ".");
STORM_LOG_TRACE("Exploring state with id " << currentIndex << ".");
storm::generator::StateBehavior<ValueType, StateType> behavior = generator.expand(currentState, stateToIdCallback);
@ -423,7 +428,6 @@ namespace storm {
++choiceRewardIt;
++builderIt;
}
++currentRow;
}
}
@ -435,11 +439,7 @@ namespace storm {
template <typename ValueType, typename RewardModelType, typename StateType>
typename ExplicitPrismModelBuilder<ValueType, RewardModelType, StateType>::ModelComponents ExplicitPrismModelBuilder<ValueType, RewardModelType, StateType>::buildModelComponents(std::vector<std::reference_wrapper<storm::prism::RewardModel const>> const& selectedRewardModels) {
ModelComponents modelComponents;
// Create the structure for storing the reachable state space.
uint64_t bitsPerState = ((variableInformation.getTotalBitOffset() / 64) + 1) * 64;
InternalStateInformation internalStateInformation(bitsPerState);
// Determine whether we have to combine different choices to one or whether this model can have more than
// one choice per state.
bool deterministicModel = program.isDeterministicModel();

6
src/builder/ExplicitPrismModelBuilder.h

@ -45,7 +45,11 @@ namespace storm {
public:
// A structure holding information about the reachable state space while building it.
struct InternalStateInformation {
InternalStateInformation(uint64_t bitsPerState = 64);
// Builds an empty state information.
InternalStateInformation();
// Creates a state information structure for storing states of the given bit width.
InternalStateInformation(uint64_t bitsPerState);
// This member stores all the states and maps them to their unique indices.
storm::storage::BitVectorHashMap<StateType> stateStorage;

4
src/utility/storm.h

@ -106,8 +106,8 @@ namespace storm {
options.buildCommandLabels = true;
}
storm::builder::ExplicitPrismModelBuilder<ValueType> builder;
result.model = builder.translateProgram(program, options);
storm::builder::ExplicitPrismModelBuilder<ValueType> builder(program, options);
result.model = builder.translate();
translatedProgram = builder.getTranslatedProgram();
} else if (settings.getEngine() == storm::settings::modules::GeneralSettings::Engine::Dd || settings.getEngine() == storm::settings::modules::GeneralSettings::Engine::Hybrid) {
typename storm::builder::DdPrismModelBuilder<LibraryType>::Options options;

Loading…
Cancel
Save