15namespace transformer {
17template<
typename SparseModelType>
23template<
typename SparseModelType>
29 STORM_LOG_DEBUG(
"Can not simplify when Until-formula has non-propositional subformula(s). Formula: " << formula);
36 std::pair<storm::storage::BitVector, storm::storage::BitVector> statesWithProbability01 =
40 this->originalModel.getTransitionMatrix(), this->originalModel.getInitialStates() & ~statesWithProbability01.first, ~statesWithProbability01.first,
41 statesWithProbability01.second);
47 goalStateMerger.
mergeTargetAndSinkStates(maybeStates, statesWithProbability01.second, statesWithProbability01.first);
48 this->simplifiedModel = mergerResult.
model;
51 statesWithProbability01.second.set(mergerResult.
targetState.get(),
true);
53 std::string targetLabel =
"target";
54 while (this->simplifiedModel->hasLabel(targetLabel)) {
55 targetLabel =
"_" + targetLabel;
57 this->simplifiedModel->getStateLabeling().addLabel(targetLabel, std::move(statesWithProbability01.second));
60 auto labelFormula = std::make_shared<storm::logic::AtomicLabelFormula const>(targetLabel);
62 this->simplifiedFormula = std::make_shared<storm::logic::ProbabilityOperatorFormula const>(eventuallyFormula, formula.
getOperatorInformation());
70 considerForElimination.
set(*mergerResult.
sinkState,
false);
72 this->simplifiedModel = this->eliminateConstantDeterministicStates(*this->simplifiedModel, considerForElimination);
77template<
typename SparseModelType>
80 "Lower step bounds are not supported.");
82 "Expected a bounded until formula with an upper bound.");
84 storm::exceptions::UnexpectedException,
"Expected a bounded until formula with integral bounds.");
88 STORM_LOG_THROW(upperStepBound > 0, storm::exceptions::UnexpectedException,
"Expected a strict upper bound that is greater than zero.");
96 STORM_LOG_DEBUG(
"Can not simplify when Until-formula has non-propositional subformula(s). Formula: " << formula);
100 ->asExplicitQualitativeCheckResult()
101 .getTruthValuesVector());
103 ->asExplicitQualitativeCheckResult()
104 .getTruthValuesVector());
112 probGreater0States, psiStates,
true, upperStepBound);
120 this->simplifiedModel = mergerResult.
model;
125 std::string targetLabel =
"target";
126 while (this->simplifiedModel->hasLabel(targetLabel)) {
127 targetLabel =
"_" + targetLabel;
129 this->simplifiedModel->getStateLabeling().addLabel(targetLabel, std::move(psiStates));
132 auto labelFormula = std::make_shared<storm::logic::AtomicLabelFormula const>(targetLabel);
133 auto boundedUntilFormula =
138 this->simplifiedFormula = std::make_shared<storm::logic::ProbabilityOperatorFormula const>(boundedUntilFormula, formula.
getOperatorInformation());
143template<
typename SparseModelType>
145 typename SparseModelType::RewardModelType
const& originalRewardModel =
151 STORM_LOG_DEBUG(
"Can not simplify when reachability reward formula has non-propositional subformula(s). Formula: " << formula);
158 originalRewardModel.getStatesWithZeroReward(this->originalModel.getTransitionMatrix()), targetStates);
160 this->originalModel.getBackwardTransitions(),
storm::storage::BitVector(this->originalModel.getNumberOfStates(),
true), targetStates);
164 this->originalModel.getTransitionMatrix(), this->originalModel.getInitialStates() & statesWithProb1, statesWithProb1, targetStates);
168 std::vector<std::string> rewardModelNameAsVector(
172 goalStateMerger.mergeTargetAndSinkStates(maybeStates, targetStates, infinityStates, rewardModelNameAsVector);
173 this->simplifiedModel = mergerResult.
model;
178 std::string targetLabel =
"target";
179 while (this->simplifiedModel->hasLabel(targetLabel)) {
180 targetLabel =
"_" + targetLabel;
182 this->simplifiedModel->getStateLabeling().addLabel(targetLabel, std::move(targetStates));
185 auto labelFormula = std::make_shared<storm::logic::AtomicLabelFormula const>(targetLabel);
187 this->simplifiedFormula =
188 std::make_shared<storm::logic::RewardOperatorFormula const>(eventuallyFormula, rewardModelNameAsVector.front(), formula.
getOperatorInformation());
196 considerForElimination.
set(*mergerResult.
sinkState,
false);
198 this->simplifiedModel = this->eliminateConstantDeterministicStates(*this->simplifiedModel, considerForElimination, rewardModelNameAsVector.front());
203template<
typename SparseModelType>
206 storm::exceptions::UnexpectedException,
"Expected a cumulative reward formula with integral bound.");
208 typename SparseModelType::RewardModelType
const& originalRewardModel =
213 STORM_LOG_THROW(stepBound > 0, storm::exceptions::UnexpectedException,
"Expected a strict upper bound that is greater than zero.");
220 ~originalRewardModel.getStatesWithZeroReward(this->originalModel.getTransitionMatrix()),
true, stepBound);
225 std::vector<std::string> rewardModelNameAsVector(
229 goalStateMerger.mergeTargetAndSinkStates(maybeStates, noStates, zeroRewardStates, rewardModelNameAsVector);
230 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(uint_fast64_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...