Storm 1.12.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PermissiveSchedulers.cpp
Go to the documentation of this file.
1
3
10#include "storm/utility/graph.h"
13
14namespace storm {
15namespace ps {
16
17template<typename RM>
18boost::optional<SubMDPPermissiveScheduler<RM>> computePermissiveSchedulerViaMILP(storm::models::sparse::Mdp<double, RM> const& mdp,
21 STORM_LOG_ASSERT(safeProp.getSubformula().isEventuallyFormula(), "No eventually formula.");
22 auto backwardTransitions = mdp.getBackwardTransitions();
24 ->template asExplicitQualitativeCheckResult<double>()
25 .getTruthValuesVector();
26 goalstates = storm::utility::graph::performProb1A(mdp, backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
27 storm::storage::BitVector sinkstates =
28 storm::utility::graph::performProb0A(backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
29
30 auto solver = storm::utility::solver::getLpSolver<double>("Gurobi", storm::solver::LpSolverTypeSelection::Gurobi);
32 STORM_LOG_THROW(!storm::logic::isStrict(safeProp.getComparisonType()), storm::exceptions::NotImplementedException, "Strict bounds are not supported");
34 // comp.dumpLpToFile("milpdump.lp");
35 std::cout << "Found Solution: " << (comp.foundSolution() ? "yes" : "no") << '\n';
36 if (comp.foundSolution()) {
37 return boost::optional<SubMDPPermissiveScheduler<RM>>(comp.getScheduler());
38 } else {
39 return boost::optional<SubMDPPermissiveScheduler<RM>>();
40 }
41}
42
43template<typename RM>
44boost::optional<SubMDPPermissiveScheduler<RM>> computePermissiveSchedulerViaSMT(storm::models::sparse::Mdp<double, RM> const& mdp,
47 STORM_LOG_ASSERT(safeProp.getSubformula().isEventuallyFormula(), "No eventually formula.");
48 auto backwardTransitions = mdp.getBackwardTransitions();
50 ->template asExplicitQualitativeCheckResult<double>()
51 .getTruthValuesVector();
52 goalstates = storm::utility::graph::performProb1A(mdp, backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
53 storm::storage::BitVector sinkstates =
54 storm::utility::graph::performProb0A(backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
55
56 std::shared_ptr<storm::expressions::ExpressionManager> expressionManager = std::make_shared<storm::expressions::ExpressionManager>();
57 auto solver = storm::utility::solver::getSmtSolver(*expressionManager);
59 STORM_LOG_THROW(!storm::logic::isStrict(safeProp.getComparisonType()), storm::exceptions::NotImplementedException, "Strict bounds are not supported");
61 if (comp.foundSolution()) {
62 return boost::optional<SubMDPPermissiveScheduler<RM>>(comp.getScheduler());
63 } else {
64 return boost::optional<SubMDPPermissiveScheduler<RM>>();
65 }
66 return boost::none;
67}
68
69template boost::optional<SubMDPPermissiveScheduler<>> computePermissiveSchedulerViaMILP(storm::models::sparse::Mdp<double> const& mdp,
71template boost::optional<SubMDPPermissiveScheduler<>> computePermissiveSchedulerViaSMT(storm::models::sparse::Mdp<double> const& mdp,
73
74} // namespace ps
75} // namespace storm
EventuallyFormula & asEventuallyFormula()
Definition Formula.cpp:341
virtual bool isEventuallyFormula() const
Definition Formula.cpp:88
ComparisonType getComparisonType() const
ValueType getThresholdAs() const
Formula const & getSubformula() const
Formula const & getSubformula() const
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:13
storm::storage::SparseMatrix< ValueType > getBackwardTransitions() const
Retrieves the backward transition relation of the model, i.e.
Definition Model.cpp:158
SubMDPPermissiveScheduler< RM > getScheduler() const override
void calculatePermissiveScheduler(bool lowerBound, double boundary) override
SubMDPPermissiveScheduler< RM > getScheduler() const override
void calculatePermissiveScheduler(bool lowerBound, double boundary) override
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
size_t size() const
Retrieves the number of bits this bit vector can store.
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
bool isLowerBound(ComparisonType t)
bool isStrict(ComparisonType t)
boost::optional< SubMDPPermissiveScheduler< RM > > computePermissiveSchedulerViaSMT(storm::models::sparse::Mdp< double, RM > const &mdp, storm::logic::ProbabilityOperatorFormula const &safeProp)
boost::optional< SubMDPPermissiveScheduler< RM > > computePermissiveSchedulerViaMILP(storm::models::sparse::Mdp< double, RM > const &mdp, storm::logic::ProbabilityOperatorFormula const &safeProp)
storm::storage::BitVector performProb1A(storm::models::sparse::NondeterministicModel< T, RM > const &model, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 1 of satisfying phi until psi under all possible re...
Definition graph.cpp:981
storm::storage::BitVector performProb0A(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Definition graph.cpp:733
std::unique_ptr< storm::solver::SmtSolver > getSmtSolver(storm::expressions::ExpressionManager &manager)
Definition solver.cpp:154