12namespace bisimulation {
14template<storm::dd::DdType DdType,
typename ValueType>
19 statePartition(initialStatePartition),
20 signatureComputer(model),
21 signatureRefiner(model.getManager(), statePartition.getBlockVariable(), model.getRowAndNondeterminismVariables(), model.getColumnVariables(),
22 !model.isNondeterministicModel(), model.getNondeterminismVariables()),
23 totalSignatureTime(0),
24 totalRefinementTime(0) {
28template<storm::dd::DdType DdType,
typename ValueType>
30 Partition<DdType, ValueType> newStatePartition = this->internalRefine(signatureComputer, signatureRefiner, statePartition, statePartition, mode);
31 if (statePartition.getNumberOfBlocks() == newStatePartition.
getNumberOfBlocks()) {
35 this->statePartition = newStatePartition;
40template<storm::dd::DdType DdType,
typename ValueType>
46 auto start = std::chrono::high_resolution_clock::now();
53 std::chrono::milliseconds::rep signatureTime = 0;
54 std::chrono::milliseconds::rep refinementTime = 0;
59 auto signatureIterator = signatureComputer.
compute(targetPartition);
60 while (signatureIterator.hasNext() && !refined) {
61 auto signatureStart = std::chrono::high_resolution_clock::now();
62 auto signature = signatureIterator.next();
63 auto signatureEnd = std::chrono::high_resolution_clock::now();
64 totalSignatureTime += (signatureEnd - signatureStart);
65 STORM_LOG_TRACE(
"Signature " << refinements <<
"[" << index <<
"] DD has " << signature.getSignatureAdd().getNodeCount() <<
" nodes.");
67 auto refinementStart = std::chrono::high_resolution_clock::now();
68 newPartition = signatureRefiner.
refine(oldPartition, signature);
69 auto refinementEnd = std::chrono::high_resolution_clock::now();
70 totalRefinementTime += (refinementEnd - refinementStart);
72 signatureTime += std::chrono::duration_cast<std::chrono::milliseconds>(signatureEnd - signatureStart).count();
73 refinementTime = std::chrono::duration_cast<std::chrono::milliseconds>(refinementEnd - refinementStart).count();
81 auto totalTimeInRefinement = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start).count();
83 << totalTimeInRefinement <<
"ms (signature: " << signatureTime <<
"ms, refinement: " << refinementTime <<
"ms).");
91template<storm::dd::DdType DdType,
typename ValueType>
96 auto refinementStart = std::chrono::high_resolution_clock::now();
97 auto newPartition = signatureRefiner.
refine(oldPartition, signature);
98 auto refinementEnd = std::chrono::high_resolution_clock::now();
99 totalRefinementTime += (refinementEnd - refinementStart);
105template<storm::dd::DdType DdType,
typename ValueType>
108 "Symbolic bisimulation currently does not support transition rewards.");
120template<storm::dd::DdType DdType,
typename ValueType>
124 if (newPartition == statePartition) {
127 this->statePartition = newPartition;
132template<storm::dd::DdType DdType,
typename ValueType>
136 return refineWrtStateRewards(stateActionRewards);
139template<storm::dd::DdType DdType,
typename ValueType>
141 return statePartition;
144template<storm::dd::DdType DdType,
typename ValueType>
146 return signatureComputer.getFullSignature(statePartition);
149template<storm::dd::DdType DdType,
typename ValueType>
154template<storm::dd::DdType DdType,
typename ValueType>
156 return totalSignatureTime;
159template<storm::dd::DdType DdType,
typename ValueType>
161 return totalRefinementTime;
virtual uint_fast64_t getNodeCount() const override
Retrieves the number of nodes necessary to represent the DD.
uint64_t getNumberOfBlocks() const
virtual bool refineWrtStateActionRewards(storm::dd::Add< DdType, ValueType > const &stateActionRewards)
std::chrono::high_resolution_clock::duration getTotalRefinementTime() const
virtual bool refineWrtStateRewards(storm::dd::Add< DdType, ValueType > const &stateRewards)
Signature< DdType, ValueType > getFullSignature() const
Retrieves the full signature of all states wrt.
Partition< DdType, ValueType > const & getStatePartition() const
Retrieves the current state partition in the refinement process.
virtual bool refine(SignatureMode const &mode=SignatureMode::Eager)
Refines the partition.
Status getStatus() const
Retrieves the status of the refinement process.
bool refineWrtRewardModel(storm::models::symbolic::StandardRewardModel< DdType, ValueType > const &rewardModel)
Refines the partition wrt.
PartitionRefiner(storm::models::symbolic::Model< DdType, ValueType > const &model, Partition< DdType, ValueType > const &initialStatePartition)
Partition< DdType, ValueType > internalRefine(SignatureComputer< DdType, ValueType > &stateSignatureComputer, SignatureRefiner< DdType, ValueType > &signatureRefiner, Partition< DdType, ValueType > const &oldPartition, Partition< DdType, ValueType > const &targetPartition, SignatureMode const &mode=SignatureMode::Eager)
std::chrono::high_resolution_clock::duration getTotalSignatureTime() const
SignatureIterator< DdType, ValueType > compute(Partition< DdType, ValueType > const &partition)
void setSignatureMode(SignatureMode const &newMode)
storm::dd::Add< DdType, ValueType > const & getSignatureAdd() const
Partition< DdType, ValueType > refine(Partition< DdType, ValueType > const &oldPartition, Signature< DdType, ValueType > const &signature)
Base class for all symbolic models.
storm::dd::Add< Type, ValueType > const & getStateActionRewardVector() const
Retrieves the state-action rewards of the reward model.
bool hasStateRewards() const
Retrieves whether the reward model has state rewards.
storm::dd::Add< Type, ValueType > const & getStateRewardVector() const
Retrieves the state rewards of the reward model.
bool hasStateActionRewards() const
Retrieves whether the reward model has state-action rewards.
bool hasTransitionRewards() const
Retrieves whether the reward model has transition rewards.
#define STORM_LOG_INFO(message)
#define STORM_LOG_TRACE(message)
#define STORM_LOG_THROW(cond, exception, message)