Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
LexicographicModelChecking.cpp
Go to the documentation of this file.
2
9
10namespace storm {
11namespace modelchecker {
12namespace lexicographic {
13
14template<typename SparseModelType, typename ValueType>
17 CheckFormulaCallback const& formulaChecker) {
18 storm::logic::MultiObjectiveFormula const& formula = checkTask.getFormula();
19 auto const& subformulas = formula.getSubformulas();
20
21 // Ensure that the query is supported
22 STORM_LOG_THROW(model.getInitialStates().getNumberOfSetBits() == 1, storm::exceptions::NotSupportedException,
23 "Lexicographic Model checking on model with multiple initial states is not supported.");
24 STORM_LOG_THROW(formula.isLexicographic(), storm::exceptions::IllegalFunctionCallException,
25 "Invoked lexicographic model checking with a non-lexicographic formula " << formula << ".");
26 STORM_LOG_THROW(std::all_of(subformulas.begin(), subformulas.end(),
27 [](auto const& f) {
28 return f->isProbabilityOperatorFormula() && !f->asOperatorFormula().hasBound() &&
29 f->asOperatorFormula().hasOptimalityType() && storm::solver::maximize(f->asOperatorFormula().getOptimalityType());
30 }),
31 storm::exceptions::NotSupportedException,
32 "Lexicographic model checking only supports Pmax=? [...] subformulas. Got " << formula << " as input.");
33
34 // Define the helper that contains all functions
37
38 // get the product of (i) the product-automaton of all subformuale, and (ii) the model
39 auto res = lMC.getCompleteProductModel(model, formulaChecker);
40
41 std::shared_ptr<storm::transformer::DAProduct<SparseModelType>> completeProductModel = res.first;
42 std::vector<uint64_t> accCond = res.second;
43
44 // get the lexicogrpahic array for all MEC of the product-model
45 std::pair<storm::storage::MaximalEndComponentDecomposition<ValueType>, std::vector<std::vector<bool>>> result =
46 lMC.getLexArrays(completeProductModel, accCond);
48 std::vector<std::vector<bool>> mecLexArrays = result.second;
49
50 // solve the reachability query
51 // That is: solve reachability for the lexicographic highest condition, restrict the model to optimal actions, repeat
52 return lMC.lexReachability(mecs, mecLexArrays, completeProductModel, model);
53}
54
57 CheckFormulaCallback const& formulaChecker);
61} // namespace lexicographic
62} // namespace modelchecker
63} // namespace storm
std::vector< std::shared_ptr< Formula const > > const & getSubformulas() const
FormulaType const & getFormula() const
Retrieves the formula from this task.
Definition CheckTask.h:141
std::pair< std::shared_ptr< storm::transformer::DAProduct< SparseModelType > >, std::vector< uint64_t > > getCompleteProductModel(SparseModelType const &model, CheckFormulaCallback const &formulaChecker)
Returns the product of a model and the product-automaton of all sub-formulae of the multi-objective f...
std::pair< storm::storage::MaximalEndComponentDecomposition< ValueType >, std::vector< std::vector< bool > > > getLexArrays(std::shared_ptr< storm::transformer::DAProduct< productModelType > > productModel, std::vector< uint64_t > &acceptanceConditions)
Given a product of an MDP and a automaton, returns the MECs and their corresponding Lex-Arrays First:...
MDPSparseModelCheckingHelperReturnType< ValueType > lexReachability(storm::storage::MaximalEndComponentDecomposition< ValueType > const &mecs, std::vector< std::vector< bool > > const &mecLexArray, std::shared_ptr< storm::transformer::DAProduct< SparseModelType > > const &productModel, SparseModelType const &originalMdp)
Solves the reachability query for a lexicographic objective In lexicographic order,...
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:13
This class represents the decomposition of a nondeterministic model into its maximal end components.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
helper::MDPSparseModelCheckingHelperReturnType< ValueType > check(Environment const &, SparseModelType const &model, CheckTask< storm::logic::MultiObjectiveFormula, ValueType > const &checkTask, CheckFormulaCallback const &formulaChecker)
check a lexicographic LTL-formula
std::function< storm::storage::BitVector(storm::logic::Formula const &)> CheckFormulaCallback