Browse Source

transformation preserve canonicity, and this is now set explicitly. (Opt-out rather than opt-in might be more convenient, but also more dangerous...)

tempestpy_adaptions
Sebastian Junges 5 years ago
parent
commit
4942e362db
  1. 2
      src/storm-pomdp/transformer/BinaryPomdpTransformer.cpp
  2. 5
      src/storm-pomdp/transformer/GlobalPOMDPSelfLoopEliminator.cpp
  3. 8
      src/storm-pomdp/transformer/GlobalPomdpMecChoiceEliminator.cpp
  4. 1
      src/storm-pomdp/transformer/GlobalPomdpMecChoiceEliminator.h
  5. 3
      src/storm-pomdp/transformer/KnownProbabilityTransformer.cpp
  6. 4
      src/storm/models/sparse/Pomdp.cpp
  7. 2
      src/storm/models/sparse/Pomdp.h

2
src/storm-pomdp/transformer/BinaryPomdpTransformer.cpp

@ -25,7 +25,7 @@ namespace storm {
components.transitionMatrix = std::move(data.simpleMatrix);
components.observabilityClasses = std::move(data.simpleObservations);
return std::make_shared<storm::models::sparse::Pomdp<ValueType>>(std::move(components));
return std::make_shared<storm::models::sparse::Pomdp<ValueType>>(std::move(components), true);
}
struct BinaryPomdpTransformerRowGroup {

5
src/storm-pomdp/transformer/GlobalPOMDPSelfLoopEliminator.cpp

@ -72,8 +72,9 @@ namespace storm {
// std::cout << "selection: " << filter << std::endl;
ChoiceSelector<ValueType> cs(pomdp);
return cs.transform(filter)->template as<storm::models::sparse::Pomdp<ValueType>>();
auto res = cs.transform(filter)->template as<storm::models::sparse::Pomdp<ValueType>>();
res->setIsCanonic();
return res;
}
template class GlobalPOMDPSelfLoopEliminator<storm::RationalNumber>;

8
src/storm-pomdp/transformer/GlobalPomdpMecChoiceEliminator.cpp

@ -84,7 +84,9 @@ namespace storm {
}
ChoiceSelector<ValueType> cs(pomdp);
return cs.transform(choiceFilter)->template as<storm::models::sparse::Pomdp<ValueType>>();
auto res = cs.transform(choiceFilter)->template as<storm::models::sparse::Pomdp<ValueType>>();
res->setIsCanonic();
return res;
}
template<typename ValueType>
@ -122,7 +124,9 @@ namespace storm {
}
ChoiceSelector<ValueType> cs(pomdp);
return cs.transform(choiceFilter)->template as<storm::models::sparse::Pomdp<ValueType>>();
auto res = cs.transform(choiceFilter)->template as<storm::models::sparse::Pomdp<ValueType>>();
res->setIsCanonic();
return res;
}
template<typename ValueType>

1
src/storm-pomdp/transformer/GlobalPomdpMecChoiceEliminator.h

@ -13,6 +13,7 @@ namespace storm {
class GlobalPomdpMecChoiceEliminator {
public:
/* Notice that this eliminator is only correct for memoryless, strictly randomising policies */
GlobalPomdpMecChoiceEliminator(storm::models::sparse::Pomdp<ValueType> const& pomdp);
// Note: this only preserves probabilities for memoryless pomdps

3
src/storm-pomdp/transformer/KnownProbabilityTransformer.cpp

@ -109,10 +109,9 @@ namespace storm {
storm::storage::sparse::ModelComponents<ValueType> components(newTransitionMatrix, newLabeling);
components.observabilityClasses = newObservations;
auto newPomdp = storm::models::sparse::Pomdp<ValueType>(components);
auto newPomdp = storm::models::sparse::Pomdp<ValueType>(components, true);
newPomdp.printModelInformationToStream(std::cout);
return std::make_shared<storm::models::sparse::Pomdp<ValueType>>(newPomdp);
}

4
src/storm/models/sparse/Pomdp.cpp

@ -99,6 +99,10 @@ namespace storm {
return canonicFlag;
}
template<typename ValueType, typename RewardModelType>
void Pomdp<ValueType, RewardModelType>::setIsCanonic(bool newValue) {
this->canonicFlag = newValue;
}
template class Pomdp<double>;

2
src/storm/models/sparse/Pomdp.h

@ -70,6 +70,8 @@ namespace storm {
bool isCanonic() const;
void setIsCanonic(bool newValue = true);
protected:
/*!
* Return a string that is additonally added to the state information in the dot stream.

Loading…
Cancel
Save