24 STORM_LOG_THROW(ma->isClosed(), storm::exceptions::InvalidModelException,
"MA should be closed first.");
26 if (ma->getMarkovianStates().full()) {
28 return ma->convertToCtmc();
32 "Labels are not preserved! Results may be incorrect. Continue at your own caution.");
39 STORM_LOG_WARN_COND(ma->getRewardModels().empty(),
"Reward models are not preserved in chain elimination.");
40 std::unordered_map<std::string, RewardModelType> rewardModels;
41 STORM_LOG_WARN_COND(!ma->hasChoiceLabeling(),
"Choice labels are not preserved in chain elimination.");
42 STORM_LOG_WARN_COND(!ma->hasStateValuations(),
"State valuations are not preserved in chain elimination.");
43 STORM_LOG_WARN_COND(!ma->hasChoiceOrigins(),
"Choice origins are not preserved in chain elimination.");
46 auto actionRewards = std::vector<ValueType>(ma->getTransitionMatrix().getRowCount(), storm::utility::zero<ValueType>());
51 for (uint_fast64_t state = 0; state < ma->getNumberOfStates(); ++state) {
53 if (ma->isProbabilisticState(state)) {
55 if (ma->getNumberOfChoices(state) <= 1) {
57 STORM_LOG_ASSERT(ma->getNumberOfChoices(state) == 1,
"State " << state <<
" has no choices.");
60 bool eliminate =
true;
63 switch (labelBehavior) {
68 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
70 STORM_LOG_TRACE(
"Do not eliminate state " << state <<
" because labels of state " << entryIt->getColumn() <<
" are different.");
80 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
83 if (!std::includes(labelsSuccessor.begin(), labelsSuccessor.end(), labelsState.begin(), labelsState.end())) {
84 STORM_LOG_TRACE(
"Do not eliminate state " << state <<
" because labels of state " << entryIt->getColumn()
85 <<
" are not included.");
97 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
98 successors.
set(entryIt->getColumn());
104 stateLabeling.
setStates(label, states | successors);
115 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
116 successors.
set(entryIt->getColumn());
119 stateLabeling.
setStates(
"init", initialStates | successors);
130 keepStates.
set(state,
false);
137 auto keptRows = ma->getTransitionMatrix().getRowFilter(keepStates);
146 std::vector<ValueType> exitRates(markovianStates.
size());
151 auto model = std::make_shared<storm::models::sparse::MarkovAutomaton<ValueType, RewardModelType>>(std::move(components));
152 if (model->isConvertibleToCtmc()) {
153 return model->convertToCtmc();