@ -74,12 +74,12 @@ namespace storm {
updateDataToCurrentEpoch ( MS , PS , * minMax , consideredObjectives , currentEpoch , weightVector , lowerTimeBoundIt , lowerTimeBounds , upperTimeBoundIt , upperTimeBounds ) ;
// Compute the values that can be obtained at probabilistic states in the current time epoch
performPSStep ( PS , MS , * minMax , * linEq , optimalChoicesAtCurrentEpoch , consideredObjectives ) ;
performPSStep ( PS , MS , * minMax , * linEq , optimalChoicesAtCurrentEpoch , consideredObjectives , weightVector ) ;
// Compute values that can be obtained at Markovian states after letting one (digitized) time unit pass.
// Only perform such a step if there is time left.
if ( currentEpoch > 0 ) {
performMSStep ( MS , PS , consideredObjectives ) ;
performMSStep ( MS , PS , consideredObjectives , weightVector ) ;
- - currentEpoch ;
} else {
break ;
@ -354,10 +354,19 @@ namespace storm {
}
template < class SparseMaModelType >
void SparseMaPcaaWeightVectorChecker < SparseMaModelType > : : performPSStep ( SubModel & PS , SubModel const & MS , MinMaxSolverData & minMax , LinEqSolverData & linEq , std : : vector < uint_fast64_t > & optimalChoicesAtCurrentEpoch , storm : : storage : : BitVector const & consideredObjectives ) const {
void SparseMaPcaaWeightVectorChecker < SparseMaModelType > : : performPSStep ( 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 ( PS . weightedSolutionVector , minMax . b ) ;
auto newScheduler = minMax . solver - > getScheduler ( ) ;
if ( consideredObjectives . getNumberOfSetBits ( ) = = 1 & & ! storm : : utility : : isZero ( weightVector [ * consideredObjectives . begin ( ) ] ) ) {
// In this case there is no need to perform the computation on the individual objectives
optimalChoicesAtCurrentEpoch = newScheduler - > getChoices ( ) ;
auto objIndex = * consideredObjectives . begin ( ) ;
PS . objectiveSolutionVectors [ objIndex ] = PS . weightedSolutionVector ;
if ( ! storm : : utility : : isOne ( weightVector [ objIndex ] ) ) {
storm : : utility : : vector : : scaleVectorInPlace ( PS . objectiveSolutionVectors [ objIndex ] , storm : : utility : : one < ValueType > ( ) / weightVector [ objIndex ] ) ;
}
} else {
// check whether the linEqSolver needs to be updated, i.e., whether the scheduler has changed
if ( linEq . solver = = nullptr | | newScheduler - > getChoices ( ) ! = optimalChoicesAtCurrentEpoch ) {
optimalChoicesAtCurrentEpoch = newScheduler - > getChoices ( ) ;
@ -389,15 +398,23 @@ namespace storm {
linEq . solver - > solveEquations ( PS . objectiveSolutionVectors [ objIndex ] , linEq . b ) ;
}
}
}
template < class SparseMaModelType >
void SparseMaPcaaWeightVectorChecker < SparseMaModelType > : : performMSStep ( SubModel & MS , SubModel const & PS , storm : : storage : : BitVector const & consideredObjectives ) const {
void SparseMaPcaaWeightVectorChecker < SparseMaModelType > : : performMSStep ( 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 ) ;
MS . toPS . multiplyWithVector ( PS . weightedSolutionVector , MS . auxChoiceValues ) ;
storm : : utility : : vector : : addVectors ( MS . weightedSolutionVector , MS . auxChoiceValues , MS . weightedSolutionVector ) ;
if ( consideredObjectives . getNumberOfSetBits ( ) = = 1 & & ! storm : : utility : : isZero ( weightVector [ * consideredObjectives . begin ( ) ] ) ) {
// In this case there is no need to perform the computation on the individual objectives
auto objIndex = * consideredObjectives . begin ( ) ;
MS . objectiveSolutionVectors [ objIndex ] = MS . weightedSolutionVector ;
if ( ! storm : : utility : : isOne ( weightVector [ objIndex ] ) ) {
storm : : utility : : vector : : scaleVectorInPlace ( MS . objectiveSolutionVectors [ objIndex ] , storm : : utility : : one < ValueType > ( ) / weightVector [ objIndex ] ) ;
}
} else {
for ( auto objIndex : consideredObjectives ) {
MS . toMS . multiplyWithVector ( MS . objectiveSolutionVectors [ objIndex ] , MS . auxChoiceValues ) ;
storm : : utility : : vector : : addVectors ( MS . objectiveRewardVectors [ objIndex ] , MS . auxChoiceValues , MS . objectiveSolutionVectors [ objIndex ] ) ;
@ -405,6 +422,7 @@ namespace storm {
storm : : utility : : vector : : addVectors ( MS . objectiveSolutionVectors [ objIndex ] , MS . auxChoiceValues , MS . objectiveSolutionVectors [ objIndex ] ) ;
}
}
}
template class SparseMaPcaaWeightVectorChecker < storm : : models : : sparse : : MarkovAutomaton < double > > ;