Browse Source

implemented the extended filter functions of JANI for the symbolic/hybrid check results

Former-commit-id: 236ae3ea7f [formerly c2418a22c7]
Former-commit-id: 1a6a075921
tempestpy_adaptions
dehnert 8 years ago
parent
commit
0796eea632
  1. 12
      src/modelchecker/results/HybridQuantitativeCheckResult.cpp
  2. 3
      src/modelchecker/results/HybridQuantitativeCheckResult.h
  3. 15
      src/modelchecker/results/SymbolicQualitativeCheckResult.cpp
  4. 7
      src/modelchecker/results/SymbolicQualitativeCheckResult.h
  5. 6
      src/modelchecker/results/SymbolicQuantitativeCheckResult.cpp
  6. 3
      src/storage/expressions/ExpressionVisitor.h

12
src/modelchecker/results/HybridQuantitativeCheckResult.cpp

@ -57,7 +57,7 @@ namespace storm {
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
bool HybridQuantitativeCheckResult<Type, ValueType>::isResultForAllStates() const { bool HybridQuantitativeCheckResult<Type, ValueType>::isResultForAllStates() const {
return true;
return (symbolicStates || explicitStates) == reachableStates;
} }
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
@ -169,12 +169,16 @@ namespace storm {
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
ValueType HybridQuantitativeCheckResult<Type, ValueType>::sum() const { ValueType HybridQuantitativeCheckResult<Type, ValueType>::sum() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Sum not implemented for hybrid results");
ValueType sum = symbolicValues.sumAbstract(symbolicValues.getContainedMetaVariables()).getValue();
for (auto const& value : explicitValues) {
sum += value;
}
return sum;
} }
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
ValueType HybridQuantitativeCheckResult<Type, ValueType>::average() const { ValueType HybridQuantitativeCheckResult<Type, ValueType>::average() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Average not implemented for hybrid results");
return this->sum() / (symbolicStates || explicitStates).getNonZeroCount();
} }
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
@ -193,4 +197,4 @@ namespace storm {
template class HybridQuantitativeCheckResult<storm::dd::DdType::CUDD>; template class HybridQuantitativeCheckResult<storm::dd::DdType::CUDD>;
template class HybridQuantitativeCheckResult<storm::dd::DdType::Sylvan>; template class HybridQuantitativeCheckResult<storm::dd::DdType::Sylvan>;
} }
}
}

3
src/modelchecker/results/HybridQuantitativeCheckResult.h

@ -54,7 +54,6 @@ namespace storm {
virtual ValueType average() const override; virtual ValueType average() const override;
virtual void oneMinus() override; virtual void oneMinus() override;
private: private:
@ -79,4 +78,4 @@ namespace storm {
} }
} }
#endif /* STORM_MODELCHECKER_HYBRIDQUANTITATIVECHECKRESULT_H_ */
#endif /* STORM_MODELCHECKER_HYBRIDQUANTITATIVECHECKRESULT_H_ */

15
src/modelchecker/results/SymbolicQualitativeCheckResult.cpp

@ -8,7 +8,7 @@
namespace storm { namespace storm {
namespace modelchecker { namespace modelchecker {
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
SymbolicQualitativeCheckResult<Type>::SymbolicQualitativeCheckResult(storm::dd::Bdd<Type> const& reachableStates, storm::dd::Bdd<Type> const& truthValues) : reachableStates(reachableStates), truthValues(truthValues) {
SymbolicQualitativeCheckResult<Type>::SymbolicQualitativeCheckResult(storm::dd::Bdd<Type> const& reachableStates, storm::dd::Bdd<Type> const& truthValues) : reachableStates(reachableStates), states(reachableStates), truthValues(truthValues) {
// Intentionally left empty. // Intentionally left empty.
} }
@ -19,7 +19,7 @@ namespace storm {
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
bool SymbolicQualitativeCheckResult<Type>::isResultForAllStates() const { bool SymbolicQualitativeCheckResult<Type>::isResultForAllStates() const {
return true;
return reachableStates == states;
} }
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
@ -48,22 +48,22 @@ namespace storm {
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
storm::dd::Bdd<Type> const& SymbolicQualitativeCheckResult<Type>::getTruthValuesVector() const { storm::dd::Bdd<Type> const& SymbolicQualitativeCheckResult<Type>::getTruthValuesVector() const {
return truthValues;
return this->truthValues;
} }
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
bool SymbolicQualitativeCheckResult<Type>::existsTrue() const { bool SymbolicQualitativeCheckResult<Type>::existsTrue() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Exists not implemented for symbolic results");
return !this->truthValues.isZero();
} }
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
bool SymbolicQualitativeCheckResult<Type>::forallTrue() const { bool SymbolicQualitativeCheckResult<Type>::forallTrue() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Forall not implemented for symbolic results");
return this->truthValues == this->states;
} }
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
uint64_t SymbolicQualitativeCheckResult<Type>::count() const { uint64_t SymbolicQualitativeCheckResult<Type>::count() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Count not implemented for symbolic results");
return this->truthValues.getNonZeroCount();
} }
template <storm::dd::DdType Type> template <storm::dd::DdType Type>
@ -80,9 +80,10 @@ namespace storm {
void SymbolicQualitativeCheckResult<Type>::filter(QualitativeCheckResult const& filter) { void SymbolicQualitativeCheckResult<Type>::filter(QualitativeCheckResult const& filter) {
STORM_LOG_THROW(filter.isSymbolicQualitativeCheckResult(), storm::exceptions::InvalidOperationException, "Cannot filter symbolic check result with non-symbolic filter."); STORM_LOG_THROW(filter.isSymbolicQualitativeCheckResult(), storm::exceptions::InvalidOperationException, "Cannot filter symbolic check result with non-symbolic filter.");
this->truthValues &= filter.asSymbolicQualitativeCheckResult<Type>().getTruthValuesVector(); this->truthValues &= filter.asSymbolicQualitativeCheckResult<Type>().getTruthValuesVector();
this->states &= filter.asSymbolicQualitativeCheckResult<Type>().getTruthValuesVector();
} }
template class SymbolicQualitativeCheckResult<storm::dd::DdType::CUDD>; template class SymbolicQualitativeCheckResult<storm::dd::DdType::CUDD>;
template class SymbolicQualitativeCheckResult<storm::dd::DdType::Sylvan>; template class SymbolicQualitativeCheckResult<storm::dd::DdType::Sylvan>;
} }
}
}

7
src/modelchecker/results/SymbolicQualitativeCheckResult.h

@ -45,11 +45,14 @@ namespace storm {
private: private:
// The set of all reachable states. // The set of all reachable states.
storm::dd::Bdd<Type> reachableStates; storm::dd::Bdd<Type> reachableStates;
// The set of states for which this check result contains values.
storm::dd::Bdd<Type> states;
// The values of the qualitative check result. // The values of the qualitative check result.
storm::dd::Bdd<Type> truthValues; storm::dd::Bdd<Type> truthValues;
}; };
} }
} }
#endif /* STORM_MODELCHECKER_SYMBOLICQUALITATIVECHECKRESULT_H_ */
#endif /* STORM_MODELCHECKER_SYMBOLICQUALITATIVECHECKRESULT_H_ */

6
src/modelchecker/results/SymbolicQuantitativeCheckResult.cpp

@ -93,12 +93,12 @@ namespace storm {
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
ValueType SymbolicQuantitativeCheckResult<Type, ValueType>::average() const { ValueType SymbolicQuantitativeCheckResult<Type, ValueType>::average() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Average not implemented for symbolic results");
return this->sum() / this->states.getNonZeroCount();
} }
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
ValueType SymbolicQuantitativeCheckResult<Type, ValueType>::sum() const { ValueType SymbolicQuantitativeCheckResult<Type, ValueType>::sum() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Sum not implemented for symbolic results");
return this->values.sumAbstract(this->values.getContainedMetaVariables()).getValue();
} }
template<storm::dd::DdType Type, typename ValueType> template<storm::dd::DdType Type, typename ValueType>
@ -111,4 +111,4 @@ namespace storm {
template class SymbolicQuantitativeCheckResult<storm::dd::DdType::CUDD>; template class SymbolicQuantitativeCheckResult<storm::dd::DdType::CUDD>;
template class SymbolicQuantitativeCheckResult<storm::dd::DdType::Sylvan>; template class SymbolicQuantitativeCheckResult<storm::dd::DdType::Sylvan>;
} }
}
}

3
src/storage/expressions/ExpressionVisitor.h

@ -2,6 +2,7 @@
#define STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_ #define STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_
#include <boost/any.hpp> #include <boost/any.hpp>
#include <boost/none.hpp>
namespace storm { namespace storm {
namespace expressions { namespace expressions {
@ -33,4 +34,4 @@ namespace storm {
} }
} }
#endif /* STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_ */
#endif /* STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_ */
Loading…
Cancel
Save