14namespace transformer {
16template<
typename SparseModelType>
22template<
typename SparseModelType>
28 STORM_LOG_DEBUG(
"Can not simplify when Until-formula has non-propositional subformula(s). Formula: " << formula);
35 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
39 this->originalModel.getTransitionMatrix(), this->originalModel.getInitialStates() & ~statesWithProbability01.first, ~statesWithProbability01.first,
40 statesWithProbability01.second);
46 goalStateMerger.
mergeTargetAndSinkStates(maybeStates, statesWithProbability01.second, statesWithProbability01.first);
47 this->simplifiedModel = mergerResult.
model;
50 statesWithProbability01.second.set(mergerResult.
targetState.get(),
true);
52 std::string targetLabel =
"target";
53 while (this->simplifiedModel->hasLabel(targetLabel)) {
54 targetLabel =
"_" + targetLabel;
56 this->simplifiedModel->getStateLabeling().addLabel(targetLabel, std::move(statesWithProbability01.second));
59 auto labelFormula = std::make_shared<storm::logic::AtomicLabelFormula const>(targetLabel);
61 this->simplifiedFormula = std::make_shared<storm::logic::ProbabilityOperatorFormula const>(eventuallyFormula, formula.
getOperatorInformation());
69 considerForElimination.
set(*mergerResult.
sinkState,
false);
71 this->simplifiedModel = this->eliminateConstantDeterministicStates(*this->simplifiedModel, considerForElimination);
76template<
typename SparseModelType>
79 "Lower step bounds are not supported.");
81 "Expected a bounded until formula with an upper bound.");
83 storm::exceptions::UnexpectedException,
"Expected a bounded until formula with integral bounds.");
87 STORM_LOG_THROW(upperStepBound > 0, storm::exceptions::UnexpectedException,
"Expected a strict upper bound that is greater than zero.");
95 STORM_LOG_DEBUG(
"Can not simplify when Until-formula has non-propositional subformula(s). Formula: " << formula);
99 ->asExplicitQualitativeCheckResult()
100 .getTruthValuesVector());
102 ->asExplicitQualitativeCheckResult()
103 .getTruthValuesVector());
111 probGreater0States, psiStates,
true, upperStepBound);
119 this->simplifiedModel = mergerResult.
model;
124 std::string targetLabel =
"target";
125 while (this->simplifiedModel->hasLabel(targetLabel)) {
126 targetLabel =
"_" + targetLabel;
128 this->simplifiedModel->getStateLabeling().addLabel(targetLabel, std::move(psiStates));
131 auto labelFormula = std::make_shared<storm::logic::AtomicLabelFormula const>(targetLabel);
132 auto boundedUntilFormula =
137 this->simplifiedFormula = std::make_shared<storm::logic::ProbabilityOperatorFormula const>(boundedUntilFormula, formula.
getOperatorInformation());
142template<
typename SparseModelType>
144 typename SparseModelType::RewardModelType
const& originalRewardModel =
150 STORM_LOG_DEBUG(
"Can not simplify when reachability reward formula has non-propositional subformula(s). Formula: " << formula);
157 originalRewardModel.getStatesWithZeroReward(this->originalModel.getTransitionMatrix()), targetStates);
159 this->originalModel.getBackwardTransitions(),
storm::storage::BitVector(this->originalModel.getNumberOfStates(),
true), targetStates);
163 this->originalModel.getTransitionMatrix(), this->originalModel.getInitialStates() & statesWithProb1, statesWithProb1, targetStates);
167 std::vector<std::string> rewardModelNameAsVector(
171 goalStateMerger.mergeTargetAndSinkStates(maybeStates, targetStates, infinityStates, rewardModelNameAsVector);
172 this->simplifiedModel = mergerResult.
model;
177 std::string targetLabel =
"target";
178 while (this->simplifiedModel->hasLabel(targetLabel)) {
179 targetLabel =
"_" + targetLabel;
181 this->simplifiedModel->getStateLabeling().addLabel(targetLabel, std::move(targetStates));
184 auto labelFormula = std::make_shared<storm::logic::AtomicLabelFormula const>(targetLabel);
186 this->simplifiedFormula =
187 std::make_shared<storm::logic::RewardOperatorFormula const>(eventuallyFormula, rewardModelNameAsVector.front(), formula.
getOperatorInformation());
195 considerForElimination.
set(*mergerResult.
sinkState,
false);
197 this->simplifiedModel = this->eliminateConstantDeterministicStates(*this->simplifiedModel, considerForElimination, rewardModelNameAsVector.front());
202template<
typename SparseModelType>
205 storm::exceptions::UnexpectedException,
"Expected a cumulative reward formula with integral bound.");
207 typename SparseModelType::RewardModelType
const& originalRewardModel =
212 STORM_LOG_THROW(stepBound > 0, storm::exceptions::UnexpectedException,
"Expected a strict upper bound that is greater than zero.");
219 ~originalRewardModel.getStatesWithZeroReward(this->originalModel.getTransitionMatrix()),
true, stepBound);
224 std::vector<std::string> rewardModelNameAsVector(
228 goalStateMerger.mergeTargetAndSinkStates(maybeStates, noStates, zeroRewardStates, rewardModelNameAsVector);
229 this->simplifiedModel = mergerResult.
model;
virtual bool isIntegerLiteralExpression() const
int_fast64_t evaluateAsInt(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of variables given by the valuation and returns the resu...
BaseExpression const & getBaseExpression() const
Retrieves the base expression underlying this expression object.
std::shared_ptr< Formula > clone(Formula const &f) const
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
virtual bool canHandle(CheckTask< storm::logic::Formula, SolutionType > const &checkTask) const override
Determines whether the model checker can handle the given verification task.
A bit vector that is internally represented as a vector of 64-bit values.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_THROW(cond, exception, message)
std::pair< storm::storage::BitVector, storm::storage::BitVector > performProb01(storm::models::sparse::DeterministicModel< T > const &model, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 or 1, respectively, of satisfying phi until psi i...
storm::storage::BitVector getReachableStates(storm::storage::SparseMatrix< T > const &transitionMatrix, storm::storage::BitVector const &initialStates, storm::storage::BitVector const &constraintStates, storm::storage::BitVector const &targetStates, bool useStepBound, uint_fast64_t maximalSteps, boost::optional< storm::storage::BitVector > const &choiceFilter)
Performs a forward depth-first search through the underlying graph structure to identify the states t...
storm::storage::BitVector performProbGreater0(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Performs a backward depth-first search trough the underlying graph structure of the given model to de...
storm::storage::BitVector performProb1(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &, storm::storage::BitVector const &psiStates, storm::storage::BitVector const &statesWithProbabilityGreater0)
Computes the set of states of the given model for which all paths lead to the given set of target sta...