Browse Source

bugfix in flattening of modules

tempestpy_adaptions
dehnert 8 years ago
parent
commit
c27580defc
  1. 21
      src/storm/abstraction/prism/AbstractProgram.cpp
  2. 8
      src/storm/storage/prism/Program.cpp

21
src/storm/abstraction/prism/AbstractProgram.cpp

@ -24,6 +24,8 @@ namespace storm {
namespace abstraction { namespace abstraction {
namespace prism { namespace prism {
#undef LOCAL_DEBUG
template <storm::dd::DdType DdType, typename ValueType> template <storm::dd::DdType DdType, typename ValueType>
AbstractProgram<DdType, ValueType>::AbstractProgram(storm::prism::Program const& program, AbstractProgram<DdType, ValueType>::AbstractProgram(storm::prism::Program const& program,
std::vector<storm::expressions::Expression> const& initialPredicates, std::vector<storm::expressions::Expression> const& initialPredicates,
@ -180,14 +182,30 @@ namespace storm {
#ifdef LOCAL_DEBUG #ifdef LOCAL_DEBUG
std::cout << "command index " << commandIndex << std::endl; std::cout << "command index " << commandIndex << std::endl;
std::cout << program.get() << std::endl; std::cout << program.get() << std::endl;
for (auto stateValue : pivotState.template toAdd<ValueType>()) {
std::stringstream stateName;
stateName << "\tpl1_";
for (auto const& var : currentGame->getRowVariables()) {
std::cout << "var " << var.getName() << std::endl;
if (stateValue.first.getBooleanValue(var)) {
stateName << "1";
} else {
stateName << "0";
}
}
std::cout << "pivot is " << stateName.str() << std::endl;
}
#endif #endif
storm::abstraction::prism::AbstractCommand<DdType, ValueType>& abstractCommand = modules.front().getCommands()[commandIndex]; storm::abstraction::prism::AbstractCommand<DdType, ValueType>& abstractCommand = modules.front().getCommands()[commandIndex];
storm::prism::Command const& concreteCommand = abstractCommand.getConcreteCommand(); storm::prism::Command const& concreteCommand = abstractCommand.getConcreteCommand();
#ifdef LOCAL_DEBUG #ifdef LOCAL_DEBUG
player1Choice.template toAdd<ValueType>().exportToDot("pl1choice_ref.dot"); player1Choice.template toAdd<ValueType>().exportToDot("pl1choice_ref.dot");
std::cout << concreteCommand << std::endl; std::cout << concreteCommand << std::endl;
(currentGame->getTransitionMatrix() * player1Choice.template toAdd<ValueType>()).exportToDot("cuttrans.dot");
#endif #endif
// Check whether there are bottom states in the game and whether one of the choices actually picks the // Check whether there are bottom states in the game and whether one of the choices actually picks the
// bottom state as the successor. // bottom state as the successor.
bool buttomStateSuccessor = false; bool buttomStateSuccessor = false;
@ -249,7 +267,6 @@ namespace storm {
for (uint_fast64_t predicateIndex = 0; predicateIndex < lowerIt->second.size(); ++predicateIndex) { for (uint_fast64_t predicateIndex = 0; predicateIndex < lowerIt->second.size(); ++predicateIndex) {
if (lowerIt->second.get(predicateIndex) != upperIt->second.get(predicateIndex)) { if (lowerIt->second.get(predicateIndex) != upperIt->second.get(predicateIndex)) {
// Now we know the point of the deviation (command, update, predicate). // Now we know the point of the deviation (command, update, predicate).
std::cout << "pred: " << abstractionInformation.getPredicateByIndex(predicateIndex) << " and update " << concreteCommand.getUpdate(updateIndex) << std::endl;
newPredicate = abstractionInformation.getPredicateByIndex(predicateIndex).substitute(concreteCommand.getUpdate(updateIndex).getAsVariableToExpressionMap()).simplify(); newPredicate = abstractionInformation.getPredicateByIndex(predicateIndex).substitute(concreteCommand.getUpdate(updateIndex).getAsVariableToExpressionMap()).simplify();
break; break;
} }

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

@ -1504,12 +1504,12 @@ namespace storm {
if (seenIt == seenCommandCombinations.end()) { if (seenIt == seenCommandCombinations.end()) {
newCommands.push_back(synchronizeCommands(nextCommandIndex, actionIndex, nextUpdateIndex, indexToActionMap.find(actionIndex)->second, commandCombination)); newCommands.push_back(synchronizeCommands(nextCommandIndex, actionIndex, nextUpdateIndex, indexToActionMap.find(actionIndex)->second, commandCombination));
seenCommandCombinations.insert(commandCombinationIndices); seenCommandCombinations.insert(commandCombinationIndices);
// Move the counters appropriately.
++nextCommandIndex;
nextUpdateIndex += newCommands.back().getNumberOfUpdates();
} }
// Move the counters appropriately.
++nextCommandIndex;
nextUpdateIndex += newCommands.back().getNumberOfUpdates();
movedAtLeastOneIterator = false; movedAtLeastOneIterator = false;
for (uint_fast64_t index = 0; index < iterators.size(); ++index) { for (uint_fast64_t index = 0; index < iterators.size(); ++index) {
++iterators[index]; ++iterators[index];

Loading…
Cancel
Save