You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.6 KiB

  1. #ifndef STORM_GENERATOR_COMPRESSEDSTATE_H_
  2. #define STORM_GENERATOR_COMPRESSEDSTATE_H_
  3. #include "storm/storage/BitVector.h"
  4. #include <map>
  5. #include <unordered_map>
  6. namespace storm {
  7. namespace expressions {
  8. template<typename ValueType> class ExpressionEvaluator;
  9. class ExpressionManager;
  10. class SimpleValuation;
  11. class Variable;
  12. class Expression;
  13. }
  14. namespace generator {
  15. typedef storm::storage::BitVector CompressedState;
  16. struct VariableInformation;
  17. /*!
  18. * Unpacks the compressed state into the evaluator.
  19. *
  20. * @param state The state to unpack.
  21. * @param variableInformation The information about how the variables are packed within the state.
  22. * @param evaluator The evaluator into which to load the state.
  23. */
  24. template<typename ValueType>
  25. void unpackStateIntoEvaluator(CompressedState const& state, VariableInformation const& variableInformation, storm::expressions::ExpressionEvaluator<ValueType>& evaluator);
  26. /*!
  27. * Converts the compressed state into an explicit representation in the form of a valuation.
  28. *
  29. * @param state The state to unpack.
  30. * @param variableInformation The information about how the variables are packed within the state.
  31. * @param manager The manager responsible for the variables.
  32. * @return A valuation that corresponds to the compressed state.
  33. */
  34. storm::expressions::SimpleValuation unpackStateIntoValuation(CompressedState const& state, VariableInformation const& variableInformation, storm::expressions::ExpressionManager const& manager);
  35. /*!
  36. * Appends the values of the given variables in the given state to the corresponding result vectors.
  37. * locationValues are inserted before integerValues (relevant if both, locationValues and integerValues actually refer to the same vector)
  38. * @param state The state
  39. * @param variableInformation The variables
  40. * @param locationValues
  41. * @param booleanValues
  42. * @param integerValues
  43. */
  44. void extractVariableValues(CompressedState const& state, VariableInformation const& variableInformation, std::vector<int64_t>& locationValues, std::vector<bool>& booleanValues, std::vector<int64_t>& integerValues);
  45. /*!
  46. * Returns a (human readable) string representation of the variable valuation encoded by the given state
  47. */
  48. std::string toString(CompressedState const& state, VariableInformation const& variableInformation);
  49. /*!
  50. *
  51. * @param variableInformation
  52. * @return
  53. */
  54. storm::storage::BitVector computeObservabilityMask(VariableInformation const& variableInformation);
  55. /*!
  56. *
  57. * @param state
  58. * @param observabilityMap
  59. * @param mask
  60. * @return
  61. */
  62. uint32_t unpackStateToObservabilityClass(CompressedState const& state, storm::storage::BitVector const& observationVector, std::unordered_map<storm::storage::BitVector,uint32_t>& observabilityMap, storm::storage::BitVector const& mask);
  63. /*!
  64. *
  65. * @param varInfo
  66. * @param roundTo64Bit
  67. * @return
  68. */
  69. CompressedState createOutOfBoundsState(VariableInformation const& varInfo, bool roundTo64Bit = true);
  70. CompressedState createCompressedState(VariableInformation const& varInfo, std::map<storm::expressions::Variable, storm::expressions::Expression> const& stateDescription, bool checkOutOfBounds);
  71. }
  72. }
  73. #endif /* STORM_GENERATOR_COMPRESSEDSTATE_H_ */