Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
JaniLocalEliminator.h
Go to the documentation of this file.
1#pragma once
2
3#include <queue>
4#include "boost/variant.hpp"
7
8// This class implements "location elimination", a technique that can be applied to Jani models to reduce the size of the resulting DTMCs. The basic idea is
9// to alternate between unfolding a variable into the location space and eliminating certain locations of the model in a way that preserves reachability
10// properties.
11// The technique is described in more detail in "Out of Control: Reducing Probabilistic Models by Control-State Elimination" by T. Winkler et al
12// (https://arxiv.org/pdf/2011.00983.pdf)
13//
14// This class keeps track of the model and some additional state, while the actual actions (such as unfolding a variable or eliminating a location) are
15// each performed in a separate class (e.g. UnfoldAction or EliminateAction).
16
17namespace storm {
18namespace jani {
20 private:
21 class AutomatonInfo {
22 public:
23 explicit AutomatonInfo();
24 std::set<uint64_t> potentiallyPartOfProp;
25 bool hasSink;
26 uint64_t sinkIndex;
27 };
28
29 public:
30 class Session {
31 public:
32 explicit Session(Model model, Property property, bool flatten = true);
33 Model &getModel();
34 void setModel(const Model &model);
36 bool getFinished() const;
37 void setFinished(bool finished);
38
39 AutomatonInfo &getAutomatonInfo(const std::string &name);
40 void buildAutomataInfo();
41 void flatten_automata();
42 void addMissingGuards(const std::string &automatonName);
43
44 expressions::Expression getNewGuard(const Edge &edge, const EdgeDestination &dest, const Edge &outgoing);
46 OrderedAssignments executeInSequence(const EdgeDestination &first, const EdgeDestination &then, std::set<std::string> &rewardVariables);
47 bool isEliminable(const std::string &automatonName, std::string const &locationName);
48 bool hasLoops(const std::string &automatonName, std::string const &locationName);
49 bool hasNamedActions(const std::string &automatonName, std::string const &locationName);
50 bool isPossiblyInitial(const std::string &automatonName, std::string const &locationName);
51 bool isPartOfProp(const std::string &automatonName, std::string const &locationName);
52 bool isPartOfProp(const std::string &automatonName, uint64_t locationIndex);
53 bool computeIsPartOfProp(const std::string &automatonName, const std::string &locationName);
54 bool computeIsPartOfProp(const std::string &automatonName, uint64_t locationIndex);
55 bool computeIsPartOfProp(const std::map<expressions::Variable, expressions::Expression> &substitutionMap);
56 void setPartOfProp(const std::string &automatonName, const std::string &locationName, bool isPartOfProp);
57 void setPartOfProp(const std::string &automatonName, uint64_t locationIndex, bool isPartOfProp);
58 void clearIsPartOfProp(const std::string &automatonName);
59 bool isVariablePartOfProperty(const std::string &expressionVariableName);
60
62 std::set<std::string> rewardModels;
63
64 private:
65 Model model;
66 Property property;
67 bool finished;
68
69 std::map<std::string, AutomatonInfo> automataInfo;
70 std::set<uint_fast64_t> expressionVarsInProperty;
71 };
72
73 public:
74 class Action {
75 public:
76 virtual ~Action() = default;
77 virtual std::string getDescription() = 0;
78 virtual void doAction(Session &session) = 0;
79 };
80
82 public:
84 std::unique_ptr<Action> getNextAction();
85 void addAction(std::unique_ptr<Action> action);
86
87 private:
88 std::queue<std::unique_ptr<Action>> actionQueue;
89 };
90
92 explicit JaniLocalEliminator(Model const &original, storm::jani::Property &property, bool addMissingGuards = false);
93 explicit JaniLocalEliminator(Model const &original, std::vector<storm::jani::Property> &properties, bool addMissingGuards = false);
94 static Model eliminateAutomatically(const Model &model, std::vector<jani::Property> properties, uint64_t locationHeuristic, uint64_t edgesHeuristic);
95 void eliminate(bool flatten = true);
96 Model const &getResult();
97
98 private:
99 Model const &original;
100 Model newModel;
101 Property property;
102 bool addMissingGuards;
103
104 void setProperty(storm::jani::Property &property);
105};
106} // namespace jani
107} // namespace storm
virtual void doAction(Session &session)=0
virtual std::string getDescription()=0
bool computeIsPartOfProp(const std::string &automatonName, const std::string &locationName)
expressions::Expression getNewGuard(const Edge &edge, const EdgeDestination &dest, const Edge &outgoing)
bool hasLoops(const std::string &automatonName, std::string const &locationName)
void setPartOfProp(const std::string &automatonName, const std::string &locationName, bool isPartOfProp)
expressions::Expression getProbability(const EdgeDestination &first, const EdgeDestination &then)
bool hasNamedActions(const std::string &automatonName, std::string const &locationName)
bool isPartOfProp(const std::string &automatonName, std::string const &locationName)
bool isPossiblyInitial(const std::string &automatonName, std::string const &locationName)
bool isVariablePartOfProperty(const std::string &expressionVariableName)
void addMissingGuards(const std::string &automatonName)
AutomatonInfo & getAutomatonInfo(const std::string &name)
void clearIsPartOfProp(const std::string &automatonName)
bool isEliminable(const std::string &automatonName, std::string const &locationName)
OrderedAssignments executeInSequence(const EdgeDestination &first, const EdgeDestination &then, std::set< std::string > &rewardVariables)
static Model eliminateAutomatically(const Model &model, std::vector< jani::Property > properties, uint64_t locationHeuristic, uint64_t edgesHeuristic)
LabParser.cpp.
Definition cli.cpp:18