18template<
typename ValueType,
bool Nondeterministic>
28template<
typename ValueType,
bool Nondeterministic>
31 std::vector<ValueType>
const& exitRates)
40template<
typename ValueType,
bool Nondeterministic>
42 std::vector<ValueType>
const& exitRates)
51template<
typename ValueType,
bool Nondeterministic>
57template<
typename ValueType,
bool Nondeterministic>
61 "Long Run Component Decomposition was provided but it was already computed or provided before.");
65template<
typename ValueType,
bool Nondeterministic>
73template<
typename ValueType,
bool Nondeterministic>
78 stateRewardsGetter = [&rewardModel](uint64_t stateIndex) {
return rewardModel.
getStateReward(stateIndex); };
85 actionRewardsGetter = [&](uint64_t globalChoiceIndex) {
89 actionRewardsGetter = [&](uint64_t globalChoiceIndex) {
return rewardModel.
getStateActionReward(globalChoiceIndex); };
95 return computeLongRunAverageValues(env, stateRewardsGetter, actionRewardsGetter);
98template<
typename ValueType,
bool Nondeterministic>
100 std::vector<ValueType>
const* stateValues,
101 std::vector<ValueType>
const* actionValues) {
104 stateValuesGetter = [&stateValues](uint64_t stateIndex) {
return (*stateValues)[stateIndex]; };
110 actionValuesGetter = [&actionValues](uint64_t globalChoiceIndex) {
return (*actionValues)[globalChoiceIndex]; };
118template<
typename ValueType,
bool Nondeterministic>
127 auto underlyingSolverEnvironment = env;
131 underlyingSolverEnvironment.solver().minMax().setPrecision(newPrecision);
134 underlyingSolverEnvironment.solver().lra().setPrecision(newPrecision);
151 std::string
const componentString = (Nondeterministic ? std::string(
"Maximal end") : std::string(
"Bottom strongly connected")) +
157 std::vector<ValueType> componentLraValues;
160 componentLraValues.push_back(
computeLraForComponent(underlyingSolverEnvironment, stateRewardsGetter, actionRewardsGetter, c));
169template<
typename ValueType,
bool Nondeterministic>
175template<
typename ValueType,
bool Nondeterministic>
179 std::make_unique<storm::storage::SparseMatrix<ValueType>>(this->
_transitionMatrix.transpose(
true,
false));
SolverEnvironment & solver()
storm::RationalNumber const & getPrecision() const
bool const & getRelativeTerminationCriterion() const
LongRunAverageSolverEnvironment & lra()
bool isForceSoundness() const
bool isProduceSchedulerSet() const
bool isContinuousTime() const
virtual ValueType computeLraForComponent(Environment const &env, ValueGetter const &stateValuesGetter, ValueGetter const &actionValuesGetter, LongRunComponentType const &component)=0
void provideBackwardTransitions(storm::storage::SparseMatrix< ValueType > const &backwardsTransitions)
Provides backward transitions that can be used during the computation.
std::vector< ValueType > computeLongRunAverageRewards(Environment const &env, storm::models::sparse::StandardRewardModel< ValueType > const &rewardModel)
Computes the long run average rewards, i.e., the average reward collected per time unit.
std::function< ValueType(uint64_t)> ValueGetter
void provideLongRunComponentDecomposition(storm::storage::Decomposition< LongRunComponentType > const &decomposition)
Provides the decomposition into long run components (BSCCs/MECs) that can be used during the computat...
virtual void createDecomposition()=0
SparseInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitionMatrix)
Initializes the helper for a discrete time (i.e.
storm::storage::SparseMatrix< ValueType > const * _backwardTransitions
storm::storage::SparseMatrix< ValueType > const & _transitionMatrix
virtual std::vector< ValueType > buildAndSolveSsp(Environment const &env, std::vector< ValueType > const &mecLraValues)=0
storm::storage::Decomposition< LongRunComponentType > const * _longRunComponentDecomposition
void createBackwardTransitions()
std::vector< ValueType > computeLongRunAverageProbabilities(Environment const &env, storm::storage::BitVector const &psiStates)
Computes the long run average probabilities, i.e., the fraction of the time we are in a psiState.
std::vector< ValueType > const * _exitRates
std::vector< ValueType > computeLongRunAverageValues(Environment const &env, std::vector< ValueType > const *stateValues=nullptr, std::vector< ValueType > const *actionValues=nullptr)
Computes the long run average value given the provided state and action-based rewards.
boost::optional< std::vector< uint64_t > > _producedOptimalChoices
std::unique_ptr< storm::storage::SparseMatrix< ValueType > > _computedBackwardTransitions
storm::storage::BitVector const * _markovianStates
bool hasTransitionRewards() const
Retrieves whether the reward model has transition rewards.
ValueType getStateActionAndTransitionReward(uint_fast64_t choiceIndex, storm::storage::SparseMatrix< MatrixValueType > const &transitionMatrix) const
ValueType const & getStateReward(uint_fast64_t state) const
ValueType const & getStateActionReward(uint_fast64_t choiceIndex) const
Retrieves the state-action reward for the given choice.
bool hasStateRewards() const
Retrieves whether the reward model has state rewards.
bool hasStateActionRewards() const
Retrieves whether the reward model has state-action rewards.
A bit vector that is internally represented as a vector of 64-bit values.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
This class represents the decomposition of a model into blocks which are of the template type.
A class that holds a possibly non-square matrix in the compressed row storage format.
A class that provides convenience operations to display run times.
bool updateProgress(uint64_t count)
Updates the progress to the current count and prints it if the delay passed.
void setMaxCount(uint64_t maxCount)
Sets the maximal possible count.
void startNewMeasurement(uint64_t startCount)
Starts a new measurement, dropping all progress information collected so far.
#define STORM_LOG_INFO(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
TargetType convertNumber(SourceType const &number)