@ -1,4 +1,4 @@
# include "storm/modelchecker/multiobjective/pcaa/Sparse MaPcaaWeightVectorChecker.h"
# include "storm/modelchecker/multiobjective/pcaa/Standard MaPcaaWeightVectorChecker.h"
# include <cmath>
@ -23,13 +23,13 @@ namespace storm {
template < class SparseMaModelType >
Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : Sparse MaPcaaWeightVectorChecker ( SparseMultiObjectivePreprocessorResult < SparseMaModelType > const & preprocessorResult ) :
Sparse PcaaWeightVectorChecker < SparseMaModelType > ( preprocessorResult ) {
Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : Standard MaPcaaWeightVectorChecker ( SparseMultiObjectivePreprocessorResult < SparseMaModelType > const & preprocessorResult ) :
Standard PcaaWeightVectorChecker < SparseMaModelType > ( preprocessorResult ) {
this - > initialize ( preprocessorResult ) ;
}
template < class SparseMaModelType >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : initializeModelTypeSpecificData ( SparseMaModelType const & model ) {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : initializeModelTypeSpecificData ( SparseMaModelType const & model ) {
markovianStates = model . getMarkovianStates ( ) ;
exitRates = model . getExitRates ( ) ;
@ -59,7 +59,7 @@ namespace storm {
template < class SparseMaModelType >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : boundedPhase ( Environment const & env , std : : vector < ValueType > const & weightVector , std : : vector < ValueType > & weightedRewardVector ) {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : boundedPhase ( Environment const & env , std : : vector < ValueType > const & weightVector , std : : vector < ValueType > & weightedRewardVector ) {
// Split the preprocessed model into transitions from/to probabilistic/Markovian states.
SubModel MS = createSubModel ( true , weightedRewardVector ) ;
@ -116,7 +116,7 @@ namespace storm {
}
template < class SparseMaModelType >
typename Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : SubModel Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : createSubModel ( bool createMS , std : : vector < ValueType > const & weightedRewardVector ) const {
typename Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : SubModel Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : createSubModel ( bool createMS , std : : vector < ValueType > const & weightedRewardVector ) const {
SubModel result ;
storm : : storage : : BitVector probabilisticStates = ~ markovianStates ;
@ -157,7 +157,7 @@ namespace storm {
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
VT Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : getDigitizationConstant ( std : : vector < ValueType > const & weightVector ) const {
VT Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : getDigitizationConstant ( std : : vector < ValueType > const & weightVector ) const {
STORM_LOG_DEBUG ( " Retrieving digitization constant " ) ;
// We need to find a delta such that for each objective it holds that lowerbound/delta , upperbound/delta are natural numbers and
// sum_{obj_i} (
@ -228,13 +228,13 @@ namespace storm {
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < ! storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
VT Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : getDigitizationConstant ( std : : vector < ValueType > const & weightVector ) const {
VT Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : getDigitizationConstant ( std : : vector < ValueType > const & weightVector ) const {
STORM_LOG_THROW ( false , storm : : exceptions : : InvalidOperationException , " Computing bounded probabilities of MAs is unsupported for this value type. " ) ;
}
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : digitize ( SubModel & MS , VT const & digitizationConstant ) const {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : digitize ( SubModel & MS , VT const & digitizationConstant ) const {
std : : vector < VT > rateVector ( MS . getNumberOfChoices ( ) ) ;
storm : : utility : : vector : : selectVectorValues ( rateVector , MS . states , exitRates ) ;
for ( uint_fast64_t row = 0 ; row < rateVector . size ( ) ; + + row ) {
@ -257,13 +257,13 @@ namespace storm {
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < ! storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : digitize ( SubModel & subModel , VT const & digitizationConstant ) const {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : digitize ( SubModel & subModel , VT const & digitizationConstant ) const {
STORM_LOG_THROW ( false , storm : : exceptions : : InvalidOperationException , " Computing bounded probabilities of MAs is unsupported for this value type. " ) ;
}
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : digitizeTimeBounds ( TimeBoundMap & upperTimeBounds , VT const & digitizationConstant ) {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : digitizeTimeBounds ( TimeBoundMap & upperTimeBounds , VT const & digitizationConstant ) {
VT const maxRate = storm : : utility : : vector : : max_if ( exitRates , markovianStates ) ;
for ( uint_fast64_t objIndex = 0 ; objIndex < this - > objectives . size ( ) ; + + objIndex ) {
@ -291,12 +291,12 @@ namespace storm {
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < ! storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : digitizeTimeBounds ( TimeBoundMap & upperTimeBounds , VT const & digitizationConstant ) {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : digitizeTimeBounds ( TimeBoundMap & upperTimeBounds , VT const & digitizationConstant ) {
STORM_LOG_THROW ( false , storm : : exceptions : : InvalidOperationException , " Computing bounded probabilities of MAs is unsupported for this value type. " ) ;
}
template < class SparseMaModelType >
std : : unique_ptr < typename Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : MinMaxSolverData > Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : initMinMaxSolver ( Environment const & env , SubModel const & PS , std : : vector < ValueType > const & weightVector ) const {
std : : unique_ptr < typename Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : MinMaxSolverData > Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : initMinMaxSolver ( Environment const & env , SubModel const & PS , std : : vector < ValueType > const & weightVector ) const {
std : : unique_ptr < MinMaxSolverData > result ( new MinMaxSolverData ( ) ) ;
storm : : solver : : GeneralMinMaxLinearEquationSolverFactory < ValueType > minMaxSolverFactory ;
result - > solver = minMaxSolverFactory . create ( env , PS . toPS ) ;
@ -325,7 +325,7 @@ namespace storm {
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
std : : unique_ptr < typename Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : LinEqSolverData > Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : initLinEqSolver ( Environment const & env , SubModel const & PS ) const {
std : : unique_ptr < typename Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : LinEqSolverData > Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : initLinEqSolver ( Environment const & env , SubModel const & PS ) const {
std : : unique_ptr < LinEqSolverData > result ( new LinEqSolverData ( ) ) ;
result - > env = std : : make_unique < Environment > ( ) ;
// Unless the solver / method was explicitly specified, we switch it to Native / Power.
@ -342,12 +342,12 @@ namespace storm {
template < class SparseMaModelType >
template < typename VT , typename std : : enable_if < ! storm : : NumberTraits < VT > : : SupportsExponential , int > : : type >
std : : unique_ptr < typename Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : LinEqSolverData > Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : initLinEqSolver ( Environment const & env , SubModel const & PS ) const {
std : : unique_ptr < typename Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : LinEqSolverData > Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : initLinEqSolver ( Environment const & env , SubModel const & PS ) const {
STORM_LOG_THROW ( false , storm : : exceptions : : InvalidOperationException , " Computing bounded probabilities of MAs is unsupported for this value type. " ) ;
}
template < class SparseMaModelType >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : updateDataToCurrentEpoch ( SubModel & MS , SubModel & PS , MinMaxSolverData & minMax , storm : : storage : : BitVector & consideredObjectives , uint_fast64_t const & currentEpoch , std : : vector < ValueType > const & weightVector , TimeBoundMap : : iterator & upperTimeBoundIt , TimeBoundMap const & upperTimeBounds ) {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : updateDataToCurrentEpoch ( SubModel & MS , SubModel & PS , MinMaxSolverData & minMax , storm : : storage : : BitVector & consideredObjectives , uint_fast64_t const & currentEpoch , std : : vector < ValueType > const & weightVector , TimeBoundMap : : iterator & upperTimeBoundIt , TimeBoundMap const & upperTimeBounds ) {
if ( upperTimeBoundIt ! = upperTimeBounds . end ( ) & & currentEpoch = = upperTimeBoundIt - > first ) {
consideredObjectives | = upperTimeBoundIt - > second ;
@ -366,7 +366,7 @@ namespace storm {
}
template < class SparseMaModelType >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : performPSStep ( Environment const & env , SubModel & PS , SubModel const & MS , MinMaxSolverData & minMax , LinEqSolverData & linEq , std : : vector < uint_fast64_t > & optimalChoicesAtCurrentEpoch , storm : : storage : : BitVector const & consideredObjectives , std : : vector < ValueType > const & weightVector ) const {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : performPSStep ( Environment const & env , SubModel & PS , SubModel const & MS , MinMaxSolverData & minMax , LinEqSolverData & linEq , std : : vector < uint_fast64_t > & optimalChoicesAtCurrentEpoch , storm : : storage : : BitVector const & consideredObjectives , std : : vector < ValueType > const & weightVector ) const {
// compute a choice vector for the probabilistic states that is optimal w.r.t. the weighted reward vector
minMax . solver - > solveEquations ( env , PS . weightedSolutionVector , minMax . b ) ;
auto const & newChoices = minMax . solver - > getSchedulerChoices ( ) ;
@ -415,7 +415,7 @@ namespace storm {
}
template < class SparseMaModelType >
void Sparse MaPcaaWeightVectorChecker < SparseMaModelType > : : performMSStep ( Environment const & env , SubModel & MS , SubModel const & PS , storm : : storage : : BitVector const & consideredObjectives , std : : vector < ValueType > const & weightVector ) const {
void Standard MaPcaaWeightVectorChecker < SparseMaModelType > : : performMSStep ( Environment const & env , SubModel & MS , SubModel const & PS , storm : : storage : : BitVector const & consideredObjectives , std : : vector < ValueType > const & weightVector ) const {
MS . toMS . multiplyWithVector ( MS . weightedSolutionVector , MS . auxChoiceValues ) ;
storm : : utility : : vector : : addVectors ( MS . weightedRewardVector , MS . auxChoiceValues , MS . weightedSolutionVector ) ;
@ -438,17 +438,17 @@ namespace storm {
}
template class Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > ;
template double Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : getDigitizationConstant < double > ( std : : vector < double > const & direction ) const ;
template void Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : digitize < double > ( Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : SubModel & subModel , double const & digitizationConstant ) const ;
template void Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : digitizeTimeBounds < double > ( Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : TimeBoundMap & upperTimeBounds , double const & digitizationConstant ) ;
template std : : unique_ptr < typename Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : LinEqSolverData > Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : initLinEqSolver < double > ( Environment const & env , Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : SubModel const & PS ) const ;
template class Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > ;
template double Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : getDigitizationConstant < double > ( std : : vector < double > const & direction ) const ;
template void Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : digitize < double > ( Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : SubModel & subModel , double const & digitizationConstant ) const ;
template void Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : digitizeTimeBounds < double > ( Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : TimeBoundMap & upperTimeBounds , double const & digitizationConstant ) ;
template std : : unique_ptr < typename Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : LinEqSolverData > Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : initLinEqSolver < double > ( Environment const & env , Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > : : SubModel const & PS ) const ;
# ifdef STORM_HAVE_CARL
template class Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > ;
template storm : : RationalNumber Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : getDigitizationConstant < storm : : RationalNumber > ( std : : vector < storm : : RationalNumber > const & direction ) const ;
template void Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : digitize < storm : : RationalNumber > ( Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : SubModel & subModel , storm : : RationalNumber const & digitizationConstant ) const ;
template void Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : digitizeTimeBounds < storm : : RationalNumber > ( Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : TimeBoundMap & upperTimeBounds , storm : : RationalNumber const & digitizationConstant ) ;
template std : : unique_ptr < typename Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : LinEqSolverData > Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : initLinEqSolver < storm : : RationalNumber > ( Environment const & env , Sparse MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : SubModel const & PS ) const ;
template class Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > ;
template storm : : RationalNumber Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : getDigitizationConstant < storm : : RationalNumber > ( std : : vector < storm : : RationalNumber > const & direction ) const ;
template void Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : digitize < storm : : RationalNumber > ( Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : SubModel & subModel , storm : : RationalNumber const & digitizationConstant ) const ;
template void Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : digitizeTimeBounds < storm : : RationalNumber > ( Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : TimeBoundMap & upperTimeBounds , storm : : RationalNumber const & digitizationConstant ) ;
template std : : unique_ptr < typename Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : LinEqSolverData > Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : initLinEqSolver < storm : : RationalNumber > ( Environment const & env , Standard MaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < storm : : RationalNumber > > : : SubModel const & PS ) const ;
# endif
}