Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DiscountingHelper.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace storm {
9class Environment;
10namespace modelchecker {
11namespace helper {
12template<typename ValueType, bool TrivialRowGrouping = false>
13class DiscountingHelper : public SingleValueModelCheckerHelper<ValueType, storm::models::ModelRepresentation::Sparse> {
14 public:
16 DiscountingHelper(storm::storage::SparseMatrix<ValueType> const& A, ValueType discountFactor, bool trackScheduler);
17
18 bool solveWithDiscountedValueIteration(Environment const& env, std::optional<OptimizationDirection> dir, std::vector<ValueType>& x,
19 std::vector<ValueType> const& b) const;
20
25
29 bool hasScheduler() const;
30
31 void setTrackScheduler(bool trackScheduler);
32
33 bool isTrackSchedulerSet() const;
34
35 private:
36 void setUpViOperator() const;
37
38 void showProgressIterative(uint64_t iteration) const;
39
40 void extractScheduler(std::vector<ValueType>& x, std::vector<ValueType> const& b, OptimizationDirection const& dir,
41 UncertaintyResolutionMode uncertaintyResolutionMode) const;
42
43 mutable std::shared_ptr<storm::solver::helper::ValueIterationOperator<ValueType, TrivialRowGrouping>> viOperator;
44 mutable std::unique_ptr<std::vector<ValueType>> auxiliaryRowGroupVector;
45
46 mutable boost::optional<storm::utility::ProgressMeasurement> progressMeasurement;
47
48 // If the solver takes posession of the matrix, we store the moved matrix in this member, so it gets deleted
49 // when the solver is destructed.
50 std::unique_ptr<storm::storage::SparseMatrix<ValueType>> localA;
51
52 // A reference to the original sparse matrix given to this solver. If the solver takes posession of the matrix
53 // the reference refers to localA.
55
57
58 ValueType discountFactor;
59
61 bool trackScheduler = false;
62
64 mutable boost::optional<std::vector<uint_fast64_t>> schedulerChoices;
65};
66} // namespace helper
67} // namespace modelchecker
68} // namespace storm
bool hasScheduler() const
Retrieves whether the solver generated a scheduler.
storm::storage::Scheduler< ValueType > computeScheduler() const
Retrieves the generated scheduler.
bool solveWithDiscountedValueIteration(Environment const &env, std::optional< OptimizationDirection > dir, std::vector< ValueType > &x, std::vector< ValueType > const &b) const
Helper for model checking queries where we are interested in (optimizing) a single value per state.
This class defines which action is chosen in a particular state of a non-deterministic model.
Definition Scheduler.h:18
A class that holds a possibly non-square matrix in the compressed row storage format.