Browse Source
Merge branch 'master' of https://srv-i2.informatik.rwth-aachen.de/scm/git/storm
tempestpy_adaptions
Merge branch 'master' of https://srv-i2.informatik.rwth-aachen.de/scm/git/storm
tempestpy_adaptions
Matthias Volk
7 years ago
9 changed files with 185 additions and 29 deletions
-
1src/storm/storage/Distribution.h
-
53src/storm/storage/DistributionWithReward.cpp
-
53src/storm/storage/DistributionWithReward.h
-
22src/storm/storage/bisimulation/BisimulationDecomposition.cpp
-
11src/storm/storage/bisimulation/BisimulationDecomposition.h
-
18src/storm/storage/bisimulation/DeterministicModelBisimulationDecomposition.cpp
-
44src/storm/storage/bisimulation/NondeterministicModelBisimulationDecomposition.cpp
-
6src/storm/storage/bisimulation/NondeterministicModelBisimulationDecomposition.h
-
6src/storm/storage/dd/bisimulation/InternalCuddSignatureRefiner.cpp
@ -0,0 +1,53 @@ |
|||
#include "storm/storage/DistributionWithReward.h"
|
|||
|
|||
#include "storm/adapters/RationalFunctionAdapter.h"
|
|||
|
|||
#include "storm/utility/ConstantsComparator.h"
|
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
|
|||
template<typename ValueType, typename StateType> |
|||
DistributionWithReward<ValueType, StateType>::DistributionWithReward(ValueType const& reward) : Distribution<ValueType, StateType>(), reward(reward) { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
template<typename ValueType, typename StateType> |
|||
bool DistributionWithReward<ValueType, StateType>::equals(DistributionWithReward<ValueType, StateType> const& other, storm::utility::ConstantsComparator<ValueType> const& comparator) const { |
|||
if (this->reward != other.reward) { |
|||
return false; |
|||
} |
|||
return Distribution<ValueType, StateType>::equals(other, comparator); |
|||
} |
|||
|
|||
template<typename ValueType, typename StateType> |
|||
bool DistributionWithReward<ValueType, StateType>::less(DistributionWithReward<ValueType, StateType> const& other, storm::utility::ConstantsComparator<ValueType> const& comparator) const { |
|||
if (comparator.isLess(this->reward, other.reward)) { |
|||
return true; |
|||
} else if (comparator.isLess(other.reward, this->reward)) { |
|||
return false; |
|||
} else { |
|||
return Distribution<ValueType, StateType>::less(other, comparator); |
|||
} |
|||
} |
|||
|
|||
template<typename ValueType, typename StateType> |
|||
void DistributionWithReward<ValueType, StateType>::setReward(ValueType const& reward) { |
|||
this->reward = reward; |
|||
} |
|||
|
|||
template<typename ValueType, typename StateType> |
|||
ValueType const& DistributionWithReward<ValueType, StateType>::getReward() const { |
|||
return reward; |
|||
} |
|||
|
|||
template class DistributionWithReward<double>; |
|||
|
|||
#ifdef STORM_HAVE_CARL
|
|||
template class DistributionWithReward<storm::RationalNumber>; |
|||
template class DistributionWithReward<storm::RationalFunction>; |
|||
#endif
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
#pragma once |
|||
|
|||
#include "storm/storage/Distribution.h" |
|||
|
|||
#include "storm/utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace utility { |
|||
template <typename ValueType> |
|||
class ConstantsComparator; |
|||
} |
|||
|
|||
namespace storage { |
|||
|
|||
template<typename ValueType, typename StateType = uint32_t> |
|||
class DistributionWithReward : public Distribution<ValueType, StateType> { |
|||
public: |
|||
/*! |
|||
* Creates an empty distribution. |
|||
*/ |
|||
DistributionWithReward(ValueType const& reward = storm::utility::zero<ValueType>()); |
|||
|
|||
DistributionWithReward(DistributionWithReward const& other) = default; |
|||
DistributionWithReward& operator=(DistributionWithReward const& other) = default; |
|||
DistributionWithReward(DistributionWithReward&& other) = default; |
|||
DistributionWithReward& operator=(DistributionWithReward&& other) = default; |
|||
|
|||
/*! |
|||
* Checks whether the two distributions specify the same probabilities to go to the same states. |
|||
* |
|||
* @param other The distribution with which the current distribution is to be compared. |
|||
* @return True iff the two distributions are equal. |
|||
*/ |
|||
bool equals(DistributionWithReward<ValueType, StateType> const& other, storm::utility::ConstantsComparator<ValueType> const& comparator = storm::utility::ConstantsComparator<ValueType>()) const; |
|||
|
|||
bool less(DistributionWithReward<ValueType, StateType> const& other, storm::utility::ConstantsComparator<ValueType> const& comparator) const; |
|||
|
|||
/*! |
|||
* Sets the reward of this distribution. |
|||
*/ |
|||
void setReward(ValueType const& reward); |
|||
|
|||
/*! |
|||
* Retrieves the reward of this distribution. |
|||
*/ |
|||
ValueType const& getReward() const; |
|||
|
|||
private: |
|||
ValueType reward; |
|||
}; |
|||
|
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue