69 lines
6.9 KiB
69 lines
6.9 KiB
#ifndef STORM_MODELCHECKER_SPARSE_MARKOVAUTOMATON_CSL_MODELCHECKER_HELPER_H_
|
|
#define STORM_MODELCHECKER_SPARSE_MARKOVAUTOMATON_CSL_MODELCHECKER_HELPER_H_
|
|
|
|
#include "src/storage/BitVector.h"
|
|
#include "src/storage/MaximalEndComponent.h"
|
|
#include "src/solver/OptimizationDirection.h"
|
|
#include "src/solver/MinMaxLinearEquationSolver.h"
|
|
|
|
namespace storm {
|
|
|
|
namespace modelchecker {
|
|
namespace helper {
|
|
|
|
template <typename ValueType>
|
|
class SparseMarkovAutomatonCslHelper {
|
|
public:
|
|
static std::vector<ValueType> computeBoundedUntilProbabilities(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<ValueType> const& exitRateVector, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& psiStates, std::pair<double, double> const& boundsPair, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
|
|
static std::vector<ValueType> computeUntilProbabilities(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, bool qualitative, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
|
|
template <typename RewardModelType>
|
|
static std::vector<ValueType> computeReachabilityRewards(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, std::vector<ValueType> const& exitRateVector, storm::storage::BitVector const& markovianStates, RewardModelType const& rewardModel, storm::storage::BitVector const& psiStates, bool qualitative, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
|
|
|
|
static std::vector<ValueType> computeLongRunAverageProbabilities(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, std::vector<ValueType> const& exitRateVector, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& psiStates, bool qualitative, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
|
|
static std::vector<ValueType> computeTimes(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, std::vector<ValueType> const& exitRateVector, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& psiStates, bool qualitative, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
|
|
private:
|
|
static void computeBoundedReachabilityProbabilities(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<ValueType> const& exitRates, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& goalStates, storm::storage::BitVector const& markovianNonGoalStates, storm::storage::BitVector const& probabilisticNonGoalStates, std::vector<ValueType>& markovianNonGoalValues, std::vector<ValueType>& probabilisticNonGoalValues, ValueType delta, uint_fast64_t numberOfSteps, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
|
|
/*!
|
|
* Computes the long-run average value for the given maximal end component of a Markov automaton.
|
|
*
|
|
* @param minimize Sets whether the long-run average is to be minimized or maximized.
|
|
* @param transitionMatrix The transition matrix of the underlying Markov automaton.
|
|
* @param markovianStates A bit vector storing all markovian states.
|
|
* @param exitRateVector A vector with exit rates for all states. Exit rates of probabilistic states are
|
|
* assumed to be zero.
|
|
* @param goalStates A bit vector indicating which states are to be considered as goal states.
|
|
* @param mec The maximal end component to consider for computing the long-run average.
|
|
* @return The long-run average of being in a goal state for the given MEC.
|
|
*/
|
|
static ValueType computeLraForMaximalEndComponent(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<ValueType> const& exitRateVector, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& goalStates, storm::storage::MaximalEndComponent const& mec);
|
|
|
|
/*!
|
|
* Computes the expected reward that is gained from each state before entering any of the goal states.
|
|
*
|
|
* @param minimize Indicates whether minimal or maximal rewards are to be computed.
|
|
* @param transitionMatrix The transition matrix of the underlying Markov automaton.
|
|
* @param backwardTransitions The reversed transition relation of the underlying Markov automaton.
|
|
* @param exitRateVector A vector with exit rates for all states. Exit rates of probabilistic states are
|
|
* assumed to be zero.
|
|
* @param markovianStates A bit vector storing all markovian states.
|
|
* @param goalStates The goal states that define until which point rewards are gained.
|
|
* @param stateRewards A vector that defines the reward gained in each state. For probabilistic states,
|
|
* this is an instantaneous reward that is fully gained and for Markovian states the actually gained
|
|
* reward is dependent on the expected time to stay in the state, i.e. it is gouverned by the exit rate
|
|
* of the state.
|
|
* @return A vector that contains the expected reward for each state of the model.
|
|
*/
|
|
static std::vector<ValueType> computeExpectedRewards(OptimizationDirection dir, storm::storage::SparseMatrix<ValueType> const& transitionMatrix, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, std::vector<ValueType> const& exitRateVector, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& goalStates, std::vector<ValueType> const& stateRewards, storm::solver::MinMaxLinearEquationSolverFactory<ValueType> const& minMaxLinearEquationSolverFactory);
|
|
};
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif /* STORM_MODELCHECKER_SPARSE_MARKOVAUTOMATON_CSL_MODELCHECKER_HELPER_H_ */
|