sjunges
8 years ago
4 changed files with 45 additions and 42 deletions
-
4src/modelchecker/reachability/SparseDtmcEliminationModelChecker.cpp
-
33src/solver/stateelimination/LongRunAverageEliminator.cpp
-
38src/solver/stateelimination/MultiValueStateEliminator.cpp
-
12src/solver/stateelimination/MultiValueStateEliminator.h
@ -1,33 +0,0 @@ |
|||||
#include "src/solver/stateelimination/LongRunAverageEliminator.h"
|
|
||||
|
|
||||
#include "src/utility/constants.h"
|
|
||||
|
|
||||
namespace storm { |
|
||||
namespace solver { |
|
||||
namespace stateelimination { |
|
||||
|
|
||||
template<typename ValueType> |
|
||||
LongRunAverageEliminator<ValueType>::LongRunAverageEliminator(storm::storage::FlexibleSparseMatrix<ValueType>& transitionMatrix, storm::storage::FlexibleSparseMatrix<ValueType>& backwardTransitions, PriorityQueuePointer priorityQueue, std::vector<ValueType>& stateValues, std::vector<ValueType>& averageTimeInStates) : PrioritizedStateEliminator<ValueType>(transitionMatrix, backwardTransitions, priorityQueue, stateValues), averageTimeInStates(averageTimeInStates) { |
|
||||
} |
|
||||
|
|
||||
template<typename ValueType> |
|
||||
void LongRunAverageEliminator<ValueType>::updateValue(storm::storage::sparse::state_type const& state, ValueType const& loopProbability) { |
|
||||
this->stateValues[state] = storm::utility::simplify(loopProbability * this->stateValues[state]); |
|
||||
averageTimeInStates[state] = storm::utility::simplify(loopProbability * averageTimeInStates[state]); |
|
||||
} |
|
||||
|
|
||||
template<typename ValueType> |
|
||||
void LongRunAverageEliminator<ValueType>::updatePredecessor(storm::storage::sparse::state_type const& predecessor, ValueType const& probability, storm::storage::sparse::state_type const& state) { |
|
||||
this->stateValues[predecessor] = storm::utility::simplify(this->stateValues[predecessor] + storm::utility::simplify(probability * this->stateValues[state])); |
|
||||
averageTimeInStates[predecessor] = storm::utility::simplify(averageTimeInStates[predecessor] + storm::utility::simplify(probability * averageTimeInStates[state])); |
|
||||
} |
|
||||
|
|
||||
template class LongRunAverageEliminator<double>; |
|
||||
|
|
||||
#ifdef STORM_HAVE_CARL
|
|
||||
template class LongRunAverageEliminator<storm::RationalNumber>; |
|
||||
template class LongRunAverageEliminator<storm::RationalFunction>; |
|
||||
#endif
|
|
||||
} // namespace stateelimination
|
|
||||
} // namespace storage
|
|
||||
} // namespace storm
|
|
@ -0,0 +1,38 @@ |
|||||
|
#include "src/solver/stateelimination/MultiValueStateEliminator.h"
|
||||
|
|
||||
|
#include "src/utility/constants.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace solver { |
||||
|
namespace stateelimination { |
||||
|
|
||||
|
template<typename ValueType> |
||||
|
MultiValueStateEliminator<ValueType>::MultiValueStateEliminator(storm::storage::FlexibleSparseMatrix<ValueType>& transitionMatrix, storm::storage::FlexibleSparseMatrix<ValueType>& backwardTransitions, PriorityQueuePointer priorityQueue, std::vector<ValueType>& stateValues, std::vector<ValueType>& additionalStateValuesVector) : PrioritizedStateEliminator<ValueType>(transitionMatrix, backwardTransitions, priorityQueue, stateValues), additionalStateValues({std::ref(additionalStateValuesVector)}) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
template<typename ValueType> |
||||
|
void MultiValueStateEliminator<ValueType>::updateValue(storm::storage::sparse::state_type const& state, ValueType const& loopProbability) { |
||||
|
this->stateValues[state] = storm::utility::simplify(loopProbability * this->stateValues[state]); |
||||
|
for(auto additionalStateValueVectorRef : additionalStateValues) { |
||||
|
additionalStateValueVectorRef.get()[state] = storm::utility::simplify(loopProbability * additionalStateValueVectorRef.get()[state]); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
template<typename ValueType> |
||||
|
void MultiValueStateEliminator<ValueType>::updatePredecessor(storm::storage::sparse::state_type const& predecessor, ValueType const& probability, storm::storage::sparse::state_type const& state) { |
||||
|
this->stateValues[predecessor] = storm::utility::simplify(this->stateValues[predecessor] + storm::utility::simplify(probability * this->stateValues[state])); |
||||
|
for(auto additionalStateValueVectorRef : additionalStateValues) { |
||||
|
additionalStateValueVectorRef.get()[predecessor] = storm::utility::simplify(additionalStateValueVectorRef.get()[predecessor] + storm::utility::simplify(probability * additionalStateValueVectorRef.get()[state])); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
template class MultiValueStateEliminator<double>; |
||||
|
|
||||
|
#ifdef STORM_HAVE_CARL
|
||||
|
template class MultiValueStateEliminator<storm::RationalNumber>; |
||||
|
template class MultiValueStateEliminator<storm::RationalFunction>; |
||||
|
#endif
|
||||
|
} // namespace stateelimination
|
||||
|
} // namespace storage
|
||||
|
} // namespace storm
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue