10 changed files with 312 additions and 89 deletions
			
			
		- 
					14src/storm/shields/PostSafetyShield.cpp
- 
					13src/storm/shields/PreSafetyShield.cpp
- 
					74src/storm/storage/PostScheduler.cpp
- 
					22src/storm/storage/PostScheduler.h
- 
					63src/storm/storage/PostSchedulerChoice.cpp
- 
					46src/storm/storage/PostSchedulerChoice.h
- 
					43src/storm/storage/PreScheduler.cpp
- 
					28src/storm/storage/PreScheduler.h
- 
					56src/storm/storage/PreSchedulerChoice.cpp
- 
					42src/storm/storage/PreSchedulerChoice.h
| @ -0,0 +1,63 @@ | |||
| #include "storm/storage/PostSchedulerChoice.h"
 | |||
| 
 | |||
| #include "storm/utility/constants.h"
 | |||
| #include "storm/utility/macros.h"
 | |||
| 
 | |||
| #include "storm/exceptions/InvalidOperationException.h"
 | |||
| #include "storm/adapters/RationalFunctionAdapter.h"
 | |||
| #include "storm/adapters/RationalNumberAdapter.h"
 | |||
| 
 | |||
| namespace storm { | |||
|     namespace storage { | |||
| 
 | |||
|         template <typename ValueType> | |||
|         PostSchedulerChoice<ValueType>::PostSchedulerChoice() { | |||
|             // Intentionally left empty
 | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         void PostSchedulerChoice<ValueType>::addChoice(uint_fast64_t oldChoiceIndex, uint_fast64_t newChoiceIndex) { | |||
|             choiceMap.emplace_back(oldChoiceIndex, newChoiceIndex); | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         std::vector<std::tuple<uint_fast64_t, uint_fast64_t>> const& PostSchedulerChoice<ValueType>::getChoiceMap() const { | |||
|             return choiceMap; | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         std::tuple<uint_fast64_t, uint_fast64_t> const& PostSchedulerChoice<ValueType>::getChoice(uint_fast64_t choiceIndex) const { | |||
|             return choiceMap.at(choiceIndex); | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         bool PostSchedulerChoice<ValueType>::isEmpty() const { | |||
|             return choiceMap.size() == 0; | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         std::ostream& operator<<(std::ostream& out, PostSchedulerChoice<ValueType> const& schedulerChoice) { | |||
|             if (!schedulerChoice.isEmpty()) { | |||
|                 bool firstChoice = true; | |||
|                 for(auto const& choice : schedulerChoice.getChoiceMap()) { | |||
|                     if(firstChoice) firstChoice = false; | |||
|                     else out << ", "; | |||
|                     out << std::get<0>(choice) << " -> " << std::get<1>(choice); | |||
|                 } | |||
|             } else { | |||
|               out << "undefined"; | |||
|             } | |||
|             return out; | |||
|         } | |||
| 
 | |||
|         template class PostSchedulerChoice<double>; | |||
|         template std::ostream& operator<<(std::ostream& out, PostSchedulerChoice<double> const& schedulerChoice); | |||
|         template class PostSchedulerChoice<float>; | |||
|         template std::ostream& operator<<(std::ostream& out, PostSchedulerChoice<float> const& schedulerChoice); | |||
|         template class PostSchedulerChoice<storm::RationalNumber>; | |||
|         template std::ostream& operator<<(std::ostream& out, PostSchedulerChoice<storm::RationalNumber> const& schedulerChoice); | |||
|         template class PostSchedulerChoice<storm::RationalFunction>; | |||
|         template std::ostream& operator<<(std::ostream& out, PostSchedulerChoice<storm::RationalFunction> const& schedulerChoice); | |||
| 
 | |||
|     } | |||
| } | |||
| @ -0,0 +1,46 @@ | |||
| #pragma once | |||
| 
 | |||
| #include "storm/utility/constants.h" | |||
| 
 | |||
| namespace storm { | |||
|     namespace storage { | |||
| 
 | |||
|         template <typename ValueType> | |||
|         class PostSchedulerChoice { | |||
| 
 | |||
|         public: | |||
| 
 | |||
|             /*! | |||
|              * Creates an undefined scheduler choice | |||
|              */ | |||
|             PostSchedulerChoice(); | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             void addChoice(uint_fast64_t oldChoiceIndex, uint_fast64_t newChoiceIndex); | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             bool isEmpty() const; | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             std::vector<std::tuple<uint_fast64_t, uint_fast64_t>> const& getChoiceMap() const; | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             std::tuple<uint_fast64_t, uint_fast64_t> const& getChoice(uint_fast64_t choiceIndex) const; | |||
| 
 | |||
|         private: | |||
|             //std::vector<std::tuple<uint_fast64_t, storm::storage::Distribution<ValueType, uint_fast64_t>>> choiceMap; | |||
|             std::vector<std::tuple<uint_fast64_t, uint_fast64_t>> choiceMap; | |||
|         }; | |||
| 
 | |||
|         template<typename ValueType> | |||
|         std::ostream& operator<<(std::ostream& out, PostSchedulerChoice<ValueType> const& schedulerChoice); | |||
|     } | |||
| } | |||
| @ -0,0 +1,56 @@ | |||
| #include "storm/storage/PreSchedulerChoice.h"
 | |||
| 
 | |||
| #include "storm/utility/constants.h"
 | |||
| #include "storm/utility/macros.h"
 | |||
| 
 | |||
| #include "storm/exceptions/InvalidOperationException.h"
 | |||
| #include "storm/adapters/RationalFunctionAdapter.h"
 | |||
| #include "storm/adapters/RationalNumberAdapter.h"
 | |||
| 
 | |||
| namespace storm { | |||
|     namespace storage { | |||
| 
 | |||
|         template <typename ValueType> | |||
|         PreSchedulerChoice<ValueType>::PreSchedulerChoice() { | |||
|             // Intentionally left empty
 | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         void PreSchedulerChoice<ValueType>::addChoice(uint_fast64_t choiceIndex, ValueType probToSatisfy) { | |||
|             choiceMap.emplace_back(probToSatisfy, choiceIndex); | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         std::vector<std::tuple<ValueType, uint_fast64_t>> const& PreSchedulerChoice<ValueType>::getChoiceMap() const { | |||
|             return choiceMap; | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         bool PreSchedulerChoice<ValueType>::isEmpty() const { | |||
|             return choiceMap.size() == 0; | |||
|         } | |||
| 
 | |||
|         template <typename ValueType> | |||
|         std::ostream& operator<<(std::ostream& out, PreSchedulerChoice<ValueType> const& schedulerChoice) { | |||
|             out << schedulerChoice.getChoiceMap().size(); | |||
|             if (!schedulerChoice.isEmpty()) { | |||
|                 for(auto const& choice : schedulerChoice.getChoiceMap()) { | |||
|                     out << std::get<0>(choice) << ": " << std::get<1>(choice); | |||
|                 } | |||
|             } else { | |||
|               out << "undefined"; | |||
|             } | |||
|             return out; | |||
|         } | |||
| 
 | |||
|         template class PreSchedulerChoice<double>; | |||
|         template std::ostream& operator<<(std::ostream& out, PreSchedulerChoice<double> const& schedulerChoice); | |||
|         template class PreSchedulerChoice<float>; | |||
|         template std::ostream& operator<<(std::ostream& out, PreSchedulerChoice<float> const& schedulerChoice); | |||
|         template class PreSchedulerChoice<storm::RationalNumber>; | |||
|         template std::ostream& operator<<(std::ostream& out, PreSchedulerChoice<storm::RationalNumber> const& schedulerChoice); | |||
|         template class PreSchedulerChoice<storm::RationalFunction>; | |||
|         template std::ostream& operator<<(std::ostream& out, PreSchedulerChoice<storm::RationalFunction> const& schedulerChoice); | |||
| 
 | |||
|     } | |||
| } | |||
| @ -0,0 +1,42 @@ | |||
| #pragma once | |||
| 
 | |||
| #include "storm/utility/constants.h" | |||
| 
 | |||
| namespace storm { | |||
|     namespace storage { | |||
| 
 | |||
|         template <typename ValueType> | |||
|         class PreSchedulerChoice { | |||
| 
 | |||
|         public: | |||
| 
 | |||
|             /*! | |||
|              * Creates an undefined scheduler choice | |||
|              */ | |||
|             PreSchedulerChoice(); | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             void addChoice(uint_fast64_t choiceIndex, ValueType probToSatisfy); | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             bool isEmpty() const; | |||
| 
 | |||
|             /* | |||
|              * | |||
|              */ | |||
|             std::vector<std::tuple<ValueType, uint_fast64_t>> const& getChoiceMap() const; | |||
| 
 | |||
|         private: | |||
|             // For now we only consider shields with deterministic choices. | |||
|             //std::map<ValueType, storm::storage::Distribution<ValueType, uint_fast64_t>> choiceMap; | |||
|             std::vector<std::tuple<ValueType, uint_fast64_t>> choiceMap; | |||
|         }; | |||
| 
 | |||
|         template<typename ValueType> | |||
|         std::ostream& operator<<(std::ostream& out, PreSchedulerChoice<ValueType> const& schedulerChoice); | |||
|     } | |||
| } | |||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue