1
1
#pragma once
2
2
3
+ #include < any>
3
4
#include " storm/models/sparse/Ctmc.h"
4
5
#include " storm/models/sparse/Dtmc.h"
5
6
#include " storm/models/sparse/Mdp.h"
@@ -24,8 +25,16 @@ std::shared_ptr<ModelType> performDeterministicSparseBisimulationMinimization(st
24
25
if (!formulas.empty () && graphPreserving) {
25
26
options = typename storm::storage::DeterministicModelBisimulationDecomposition<ModelType>::Options (*model, formulas);
26
27
}
28
+ // If we cannot use formula-based decomposition because of
29
+ // non-graph-preserving regions but there are reward models, we need to
30
+ // preserve those
31
+ if (!graphPreserving && std::any_of (formulas.begin (), formulas.end (), [](auto const & formula) {
32
+ return formula->getReferencedRewardModels ().size () > 0 ;
33
+ })) {
34
+ options.setKeepRewards (true );
35
+ }
27
36
options.setType (type);
28
-
37
+
29
38
storm::storage::DeterministicModelBisimulationDecomposition<ModelType> bisimulationDecomposition (*model, options);
30
39
bisimulationDecomposition.computeBisimulationDecomposition ();
31
40
return bisimulationDecomposition.getQuotient ();
@@ -39,6 +48,14 @@ std::shared_ptr<ModelType> performNondeterministicSparseBisimulationMinimization
39
48
if (!formulas.empty () && graphPreserving) {
40
49
options = typename storm::storage::NondeterministicModelBisimulationDecomposition<ModelType>::Options (*model, formulas);
41
50
}
51
+ // If we cannot use formula-based decomposition because of
52
+ // non-graph-preserving regions but there are reward models, we need to
53
+ // preserve those
54
+ if (!graphPreserving && std::any_of (formulas.begin (), formulas.end (), [](auto const & formula) {
55
+ return formula->getReferencedRewardModels ().size () > 0 ;
56
+ })) {
57
+ options.setKeepRewards (true );
58
+ }
42
59
options.setType (type);
43
60
44
61
storm::storage::NondeterministicModelBisimulationDecomposition<ModelType> bisimulationDecomposition (*model, options);
0 commit comments