Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Valuations.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5
11
12namespace storm {
13
14namespace expressions {
15template<typename T>
17}
18
19namespace storage::sparse {
20
23
29 public:
30 Valuations(ValuationClassDescription const valuationClassDescription, std::shared_ptr<storm::expressions::ExpressionManager const> const& manager = {},
31 uint64_t const numEntities = 0);
32 Valuations(ValuationsStorage&& umbValuations);
33 Valuations(Valuations const& other);
37 Valuations& operator=(Valuations const& other);
38
40 ValuationsStorage const& getStorage() const;
42
46 uint64_t getNumberOfEntities() const;
47
51 std::set<storm::expressions::Variable> getAllVariables() const;
52
56 bool entityHasVariable(uint64_t entity, storm::expressions::Variable const& variable) const;
57
58 // optional variants have no value iff either entityHasVariable(entity, variable) is false or the value is of optional type and not set.
59 bool getBooleanValue(uint64_t const entity, storm::expressions::Variable const& booleanVariable) const;
60 std::optional<bool> getOptionalBooleanValue(uint64_t const entity, storm::expressions::Variable const& booleanVariable) const;
61 int64_t getInt64Value(uint64_t const entity, storm::expressions::Variable const& integerVariable) const;
62 std::optional<int64_t> getOptionalInt64Value(uint64_t const entity, storm::expressions::Variable const& integerVariable) const;
63 double getDoubleValue(uint64_t const entity, storm::expressions::Variable const& doubleVariable) const;
64 std::optional<double> getOptionalDoubleValue(uint64_t const entity, storm::expressions::Variable const& doubleVariable) const;
65 storm::RationalNumber getRationalValue(uint64_t const entity, storm::expressions::Variable const& rationalVariable) const;
66 std::optional<storm::RationalNumber> getOptionalRationalValue(uint64_t const entity, storm::expressions::Variable const& rationalVariable) const;
67 std::string getStringValue(uint64_t const entity, storm::expressions::Variable const& stringVariable) const;
68 std::optional<std::string> getOptionalStringValue(uint64_t const entity, storm::expressions::Variable const& stringVariable) const;
69
76 template<typename RationalValueType>
78
83
87 std::vector<int64_t> getInt64Values(storm::expressions::Variable const& integerVariable) const;
88
92 std::vector<double> getDoubleValues(storm::expressions::Variable const& doubleVariable) const;
93
97 std::vector<storm::RationalNumber> getRationalValues(storm::expressions::Variable const& rationalVariable) const;
98
102 std::vector<std::string> getStringValues(storm::expressions::Variable const& stringVariable) const;
103
110 std::string toString(uint64_t const entity, bool const pretty = true,
111 std::optional<std::set<storm::expressions::Variable>> const& selectedVariables = {}) const;
112
118 template<typename JsonRationalType = storm::RationalNumber>
119 storm::json<JsonRationalType> toJson(uint64_t const entity, std::optional<std::set<storm::expressions::Variable>> const& selectedVariables = {}) const;
120
124 Valuations selectEntities(storm::storage::BitVector const& selectedEntities) const;
125
130 Valuations selectEntities(std::vector<uint64_t> const& selectedEntities) const;
131
132 std::size_t hash() const;
133
134 private:
135 std::unique_ptr<ValuationsStorage> umbValuations;
136};
137
138} // namespace storage::sparse
139} // namespace storm
This class is responsible for managing a set of typed variables and all expressions using these varia...
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
storm::RationalNumber getRationalValue(uint64_t const entity, storm::expressions::Variable const &rationalVariable) const
bool entityHasVariable(uint64_t entity, storm::expressions::Variable const &variable) const
Returns true iff the variable is relevant for the given entity.
void setValuesInEvaluator(uint64_t entity, storm::expressions::ExpressionEvaluator< RationalValueType > &evaluator) const
Reads the variable values for the given entity and sets them into the given expression evaluator.
double getDoubleValue(uint64_t const entity, storm::expressions::Variable const &doubleVariable) const
std::optional< bool > getOptionalBooleanValue(uint64_t const entity, storm::expressions::Variable const &booleanVariable) const
storm::storage::BitVector getBooleanValues(storm::expressions::Variable const &booleanVariable) const
Returns a vector of size getNumberOfEntities() such that the i'th entry is the value of the given var...
std::string toString(uint64_t const entity, bool const pretty=true, std::optional< std::set< storm::expressions::Variable > > const &selectedVariables={}) const
Returns a string representation of the valuation.
Valuations & operator=(Valuations &&other)
std::vector< int64_t > getInt64Values(storm::expressions::Variable const &integerVariable) const
Returns a vector of size getNumberOfEntities() such that the i'th entry is the value of the given var...
std::string getStringValue(uint64_t const entity, storm::expressions::Variable const &stringVariable) const
std::vector< std::string > getStringValues(storm::expressions::Variable const &stringVariable) const
Returns a vector of size getNumberOfEntities() such that the i'th entry is the value of the given var...
std::vector< storm::RationalNumber > getRationalValues(storm::expressions::Variable const &rationalVariable) const
Returns a vector of size getNumberOfEntities() such that the i'th entry is the value of the given var...
storm::json< JsonRationalType > toJson(uint64_t const entity, std::optional< std::set< storm::expressions::Variable > > const &selectedVariables={}) const
Returns a JSON representation of this valuation.
std::optional< storm::RationalNumber > getOptionalRationalValue(uint64_t const entity, storm::expressions::Variable const &rationalVariable) const
std::vector< double > getDoubleValues(storm::expressions::Variable const &doubleVariable) const
Returns a vector of size getNumberOfEntities() such that the i'th entry is the value of the given var...
Valuations(ValuationClassDescription const valuationClassDescription, std::shared_ptr< storm::expressions::ExpressionManager const > const &manager={}, uint64_t const numEntities=0)
std::set< storm::expressions::Variable > getAllVariables() const
storm::expressions::ExpressionManager const & getManager() const
std::optional< double > getOptionalDoubleValue(uint64_t const entity, storm::expressions::Variable const &doubleVariable) const
bool getBooleanValue(uint64_t const entity, storm::expressions::Variable const &booleanVariable) const
int64_t getInt64Value(uint64_t const entity, storm::expressions::Variable const &integerVariable) const
Valuations selectEntities(storm::storage::BitVector const &selectedEntities) const
Derive new valuations from this by selecting the given entities.
ValuationsStorage const & getStorage() const
std::optional< int64_t > getOptionalInt64Value(uint64_t const entity, storm::expressions::Variable const &integerVariable) const
std::optional< std::string > getOptionalStringValue(uint64_t const entity, storm::expressions::Variable const &stringVariable) const
Stores valuations of variables for a set of entities (e.g.
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
Definition JsonForward.h:11
Describes the layout of a class of valuations (e.g.