Storm 1.11.0.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, bool robust) const;
41
42 mutable std::shared_ptr<storm::solver::helper::ValueIterationOperator<ValueType, TrivialRowGrouping>> viOperator;
43 mutable std::unique_ptr<std::vector<ValueType>> auxiliaryRowGroupVector;
44
45 mutable boost::optional<storm::utility::ProgressMeasurement> progressMeasurement;
46
47 // If the solver takes posession of the matrix, we store the moved matrix in this member, so it gets deleted
48 // when the solver is destructed.
49 std::unique_ptr<storm::storage::SparseMatrix<ValueType>> localA;
50
51 // A reference to the original sparse matrix given to this solver. If the solver takes posession of the matrix
52 // the reference refers to localA.
54
56
57 ValueType discountFactor;
58
60 bool trackScheduler = false;
61
63 mutable boost::optional<std::vector<uint_fast64_t>> schedulerChoices;
64};
65} // namespace helper
66} // namespace modelchecker
67} // 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.
LabParser.cpp.