Browse Source

bugfix

main
dehnert 7 years ago
parent
commit
eaf01ab443
  1. 32
      src/storm/abstraction/ValidBlockAbstractor.cpp
  2. 2
      src/storm/abstraction/ValidBlockAbstractor.h
  3. 2
      src/storm/abstraction/prism/CommandAbstractor.cpp

32
src/storm/abstraction/ValidBlockAbstractor.cpp

@ -5,6 +5,7 @@
#include "storm/storage/dd/DdManager.h"
#include "storm/utility/solver.h"
#include "storm/utility/Stopwatch.h"
namespace storm {
namespace abstraction {
@ -68,25 +69,39 @@ namespace storm {
template <storm::dd::DdType DdType>
void ValidBlockAbstractor<DdType>::recomputeValidBlocks() {
storm::dd::Bdd<DdType> newValidBlocks = abstractionInformation.get().getDdManager().getBddOne();
for (uint64_t blockIndex = 0; blockIndex < localExpressionInformation.getNumberOfBlocks(); ++blockIndex) {
std::set<uint64_t> const& predicateBlock = localExpressionInformation.getExpressionBlock(blockIndex);
// If the size of the block changed, we need to add the appropriate variables and recompute the solution.
if (relevantVariablesAndPredicates[blockIndex].size() < predicateBlock.size()) {
recomputeValidBlockForPredicateBlock(blockIndex);
recomputeValidBlocksForPredicateBlock(blockIndex);
}
newValidBlocks &= validBlocksForPredicateBlocks[blockIndex];
}
validBlocks = newValidBlocks;
// Now compute the conjunction of all blocks.
std::vector<storm::dd::Bdd<DdType>> blocks = validBlocksForPredicateBlocks;
std::vector<storm::dd::Bdd<DdType>> newBlocks;
while (blocks.size() > 1) {
storm::utility::Stopwatch conj(true);
for (uint64_t blockIndex = 0; blockIndex < blocks.size(); ++blockIndex) {
if (blockIndex < localExpressionInformation.getNumberOfBlocks() - 1) {
newBlocks.emplace_back(blocks[blockIndex] && blocks[blockIndex + 1]);
} else {
newBlocks.emplace_back(blocks[blockIndex]);
}
}
conj.stop();
std::swap(blocks, newBlocks);
}
validBlocks = blocks.front();
}
template <storm::dd::DdType DdType>
void ValidBlockAbstractor<DdType>::recomputeValidBlockForPredicateBlock(uint64_t blockIndex) {
void ValidBlockAbstractor<DdType>::recomputeValidBlocksForPredicateBlock(uint64_t blockIndex) {
std::set<uint64_t> const& predicateBlock = localExpressionInformation.getExpressionBlock(blockIndex);
std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> newVariables = this->getAbstractionInformation().declareNewVariables(relevantVariablesAndPredicates[blockIndex], predicateBlock);
for (auto const& element : newVariables) {
smtSolvers[blockIndex]->add(storm::expressions::iff(element.first, this->getAbstractionInformation().getPredicateByIndex(element.second)));
@ -121,7 +136,8 @@ namespace storm {
template <storm::dd::DdType DdType>
storm::dd::Bdd<DdType> ValidBlockAbstractor<DdType>::getSourceStateBdd(storm::solver::SmtSolver::ModelReference const& model, uint64_t blockIndex) const {
storm::dd::Bdd<DdType> result = this->getAbstractionInformation().getDdManager().getBddOne();
for (auto const& variableIndexPair : relevantVariablesAndPredicates[blockIndex]) {
for (auto variableIndexPairIt = relevantVariablesAndPredicates[blockIndex].rbegin(), variableIndexPairIte = relevantVariablesAndPredicates[blockIndex].rend(); variableIndexPairIt != variableIndexPairIte; ++variableIndexPairIt) {
auto const& variableIndexPair = *variableIndexPairIt;
if (model.getBooleanValue(variableIndexPair.first)) {
result &= this->getAbstractionInformation().encodePredicateAsSource(variableIndexPair.second);
} else {

2
src/storm/abstraction/ValidBlockAbstractor.h

@ -44,7 +44,7 @@ namespace storm {
/*!
* Recomputed the valid blocks for the given predicate block.
*/
void recomputeValidBlockForPredicateBlock(uint64_t blockIndex);
void recomputeValidBlocksForPredicateBlock(uint64_t blockIndex);
/*!
* Retrieves the abstraction information object.

2
src/storm/abstraction/prism/CommandAbstractor.cpp

@ -344,7 +344,7 @@ namespace storm {
// We now compute how many variables we need to encode the choices. We add one to the maximal number of
// choices to account for a possible transition to a bottom state.
uint_fast64_t numberOfVariablesNeeded = static_cast<uint_fast64_t>(std::ceil(std::log2(maximalNumberOfChoices + (blockCounter == 0 ? 1 : 0))));
uint_fast64_t numberOfVariablesNeeded = maximalNumberOfChoices > 1 ? static_cast<uint_fast64_t>(std::ceil(std::log2(maximalNumberOfChoices + (blockCounter == 0 ? 1 : 0)))) : 0;
// Finally, build overall result.
storm::dd::Bdd<DdType> resultBdd = this->getAbstractionInformation().getDdManager().getBddZero();

Loading…
Cancel
Save