Storm 2.0.0.3
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PermissiveSchedulers.cpp
Go to the documentation of this file.
1
3
11#include "storm/utility/graph.h"
14
15namespace storm {
16namespace ps {
17
18template<typename RM>
19boost::optional<SubMDPPermissiveScheduler<RM>> computePermissiveSchedulerViaMILP(storm::Environment const& env,
23 STORM_LOG_ASSERT(safeProp.getSubformula().isEventuallyFormula(), "No eventually formula.");
24 auto backwardTransitions = mdp.getBackwardTransitions();
26 ->template asExplicitQualitativeCheckResult<double>()
27 .getTruthValuesVector();
28 goalstates = storm::utility::graph::performProb1A(mdp, backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
29 storm::storage::BitVector sinkstates =
30 storm::utility::graph::performProb0A(backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
31
32 auto solver = storm::utility::solver::getLpSolver<double>(env, "PermissiveSchedulers");
34 STORM_LOG_THROW(!storm::logic::isStrict(safeProp.getComparisonType()), storm::exceptions::NotImplementedException, "Strict bounds are not supported.");
36 // comp.dumpLpToFile("milpdump.lp");
37 std::cout << "Found Solution: " << (comp.foundSolution() ? "yes" : "no") << '\n';
38 if (comp.foundSolution()) {
39 return boost::optional<SubMDPPermissiveScheduler<RM>>(comp.getScheduler());
40 } else {
41 return boost::optional<SubMDPPermissiveScheduler<RM>>();
42 }
43}
44
45template<typename RM>
46boost::optional<SubMDPPermissiveScheduler<RM>> computePermissiveSchedulerViaSMT(storm::Environment const& env,
50 STORM_LOG_ASSERT(safeProp.getSubformula().isEventuallyFormula(), "No eventually formula.");
51 auto backwardTransitions = mdp.getBackwardTransitions();
53 ->template asExplicitQualitativeCheckResult<double>()
54 .getTruthValuesVector();
55 goalstates = storm::utility::graph::performProb1A(mdp, backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
56 storm::storage::BitVector sinkstates =
57 storm::utility::graph::performProb0A(backwardTransitions, storm::storage::BitVector(goalstates.size(), true), goalstates);
58
59 std::shared_ptr<storm::expressions::ExpressionManager> expressionManager = std::make_shared<storm::expressions::ExpressionManager>();
60 auto solver = storm::utility::solver::getSmtSolver(env, *expressionManager);
62 STORM_LOG_THROW(!storm::logic::isStrict(safeProp.getComparisonType()), storm::exceptions::NotImplementedException, "Strict bounds are not supported.");
64 if (comp.foundSolution()) {
65 return boost::optional<SubMDPPermissiveScheduler<RM>>(comp.getScheduler());
66 } else {
67 return boost::optional<SubMDPPermissiveScheduler<RM>>();
68 }
69 return boost::none;
70}
71
72template boost::optional<SubMDPPermissiveScheduler<>> computePermissiveSchedulerViaMILP(storm::Environment const& env,
75template boost::optional<SubMDPPermissiveScheduler<>> computePermissiveSchedulerViaSMT(storm::Environment const& env,
78
79} // namespace ps
80} // namespace storm
EventuallyFormula & asEventuallyFormula()
Definition Formula.cpp:371
virtual bool isEventuallyFormula() const
Definition Formula.cpp:102
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:16
storm::storage::SparseMatrix< ValueType > getBackwardTransitions() const
Retrieves the backward transition relation of the model, i.e.
Definition Model.cpp:186
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:9
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:39
bool isLowerBound(ComparisonType t)
bool isStrict(ComparisonType t)
boost::optional< SubMDPPermissiveScheduler< RM > > computePermissiveSchedulerViaSMT(storm::Environment const &env, storm::models::sparse::Mdp< double, RM > const &mdp, storm::logic::ProbabilityOperatorFormula const &safeProp)
boost::optional< SubMDPPermissiveScheduler< RM > > computePermissiveSchedulerViaMILP(storm::Environment const &env, 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:1019
storm::storage::BitVector performProb0A(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Definition graph.cpp:732
std::unique_ptr< storm::solver::SmtSolver > getSmtSolver(storm::expressions::ExpressionManager &manager)
Creates a new SMT solver instance.
Definition solver.cpp:215
std::unique_ptr< storm::solver::LpSolver< ValueType > > getLpSolver(storm::Environment const &env, std::string const &name, storm::solver::LpSolverTypeSelection solvType)
Definition solver.cpp:146
The contract of a DD backend.