27 : type(type), optimizationDirection(dir), rewardModelName(rewardModelName) {
30 "Got a reward model name for a non-reward formula.");
59 "Target states requested for unexpected formula type.");
60 return targetStates.value();
65 return sinkStates.value();
70 "Reward model requested for unexpected formula type.");
71 return rewardModelName.value();
75 return optimizationDirection;
79 return rewardBoundReferences;
90 rewardBounded = newValue;
93template<
typename PomdpType>
96 result.
states = std::move(inputStates);
97 for (uint64_t state : result.
states) {
111template<
typename PomdpType>
114 "Target states updated for unexpected formula type.");
118template<
typename PomdpType>
125 rewardBoundReferences = newRewardBoundReferences;
128template<
typename PomdpType>
131 auto checkResult = mc.
check(propositionalFormula);
132 storm::storage::BitVector resultBitVector(checkResult->template asExplicitQualitativeCheckResult<typename PomdpType::ValueType>().getTruthValuesVector());
133 if (formulaInverted) {
136 return resultBitVector;
139template<
typename PomdpType>
142 auto const threshold = formula.
getThresholdAs<storm::RationalNumber>();
143 STORM_LOG_THROW(threshold == 0 || threshold == 1, storm::exceptions::InvalidPropertyException,
144 "The probability threshold in '" << formula
145 <<
"' is not supported by storm-pomdp. Only thresholds of exactly 0 or 1 are supported for "
146 "qualitative analysis; use a Pmin=? or Pmax=? query for quantitative analysis.");
149 "The property does not specify an optimization direction (min/max).");
151 bool bounded =
false;
152 std::vector<storm::logic::TimeBoundReference> rewardBoundReferences;
154 std::shared_ptr<storm::logic::Formula const> targetStatesFormula, constraintsStatesFormula;
155 if (subformula.isEventuallyFormula()) {
156 targetStatesFormula = subformula.asEventuallyFormula().getSubformula().asSharedPointer();
158 }
else if (subformula.isUntilFormula()) {
162 }
else if (subformula.isBoundedUntilFormula()) {
165 "Reward-bounded POMDP properties with dimension-specific state subformulas are not supported.");
166 for (uint64_t i = 0; i < boundedUntilFormula.
getDimension(); ++i) {
168 "Reward-bounded until properties for POMDPs currently require 'true' as the left-hand side, i.e., they must be reward-bounded "
169 "reachability properties.");
174 for (uint64_t i = 0; i < boundedUntilFormula.
getDimension(); ++i) {
176 STORM_LOG_THROW(boundReference.isRewardBound() && !boundReference.hasRewardAccumulation(), storm::exceptions::NotSupportedException,
177 "For POMDPs, only plain reward bounds are supported.");
178 STORM_LOG_THROW(boundReference.hasRewardModelName(), storm::exceptions::NotSupportedException,
179 "For POMDPs, reward-bounded formulae must explicitly name a reward model for each bound.");
180 rewardBoundReferences.push_back(boundReference);
197template<
typename PomdpType>
200 "The reward threshold in '" << formula <<
"' is not supported by storm-pomdp. Use an Rmin=? or Rmax=? query instead.");
202 "The property does not specify an optimization direction (min/max).");
203 std::string rewardModelName =
"";
206 STORM_LOG_THROW(
pomdp.hasRewardModel(rewardModelName), storm::exceptions::InvalidPropertyException,
207 "Selected reward model with name '" << rewardModelName <<
"' does not exist.");
210 "Reward operator formula does not specify a reward model and the reward model is not unique.");
211 rewardModelName =
pomdp.getUniqueRewardModelName();
214 if (subformula.isDiscountedTotalRewardFormula()) {
218 std::shared_ptr<storm::logic::Formula const> targetStatesFormula;
219 if (subformula.isEventuallyFormula()) {
220 targetStatesFormula = subformula.asEventuallyFormula().getSubformula().asSharedPointer();
230template<
typename PomdpType>
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
This class represents a partially observable Markov decision process.
A bit vector that is internally represented as a vector of 64-bit values.
void complement()
Negates all bits in the bit vector.
uint64_t getNextUnsetIndex(uint64_t startingIndex) const
Retrieves the index of the bit that is the next bit set to false in the bit vector.
size_t size() const
Retrieves the number of bits this bit vector can store.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification propositional()
storm::storage::BitVector getStates(storm::logic::Formula const &propositionalFormula, bool formulaInverted, PomdpType const &pomdp)
FormulaInformation::StateSet getStateSet(PomdpType const &pomdp, storm::storage::BitVector &&inputStates)
FormulaInformation getFormulaInformation(PomdpType const &pomdp, storm::logic::ProbabilityOperatorFormula const &formula)
bool constexpr maximize(OptimizationDirection d)
bool constexpr minimize(OptimizationDirection d)
The contract of a DD backend.