25 STORM_LOG_THROW(ma->isClosed(), storm::exceptions::InvalidModelException,
"MA should be closed first.");
27 if (ma->getMarkovianStates().full()) {
29 return ma->convertToCtmc();
33 "Labels are not preserved! Results may be incorrect. Continue at your own caution.");
40 STORM_LOG_WARN_COND(ma->getRewardModels().empty(),
"Reward models are not preserved in chain elimination.");
41 std::unordered_map<std::string, RewardModelType> rewardModels;
42 STORM_LOG_WARN_COND(!ma->hasChoiceLabeling(),
"Choice labels are not preserved in chain elimination.");
43 STORM_LOG_WARN_COND(!ma->hasStateValuations(),
"State valuations are not preserved in chain elimination.");
44 STORM_LOG_WARN_COND(!ma->hasChoiceOrigins(),
"Choice origins are not preserved in chain elimination.");
47 auto actionRewards = std::vector<ValueType>(ma->getTransitionMatrix().getRowCount(), storm::utility::zero<ValueType>());
52 for (uint_fast64_t state = 0; state < ma->getNumberOfStates(); ++state) {
54 if (ma->isProbabilisticState(state)) {
56 if (ma->getNumberOfChoices(state) <= 1) {
58 STORM_LOG_ASSERT(ma->getNumberOfChoices(state) == 1,
"State " << state <<
" has no choices.");
61 bool eliminate =
true;
64 switch (labelBehavior) {
69 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
71 STORM_LOG_TRACE(
"Do not eliminate state " << state <<
" because labels of state " << entryIt->getColumn() <<
" are different.");
81 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
84 if (!std::includes(labelsSuccessor.begin(), labelsSuccessor.end(), labelsState.begin(), labelsState.end())) {
85 STORM_LOG_TRACE(
"Do not eliminate state " << state <<
" because labels of state " << entryIt->getColumn()
86 <<
" are not included.");
98 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
99 successors.
set(entryIt->getColumn());
105 stateLabeling.
setStates(label, states | successors);
116 for (
auto entryIt = entriesInRow.begin(); entryIt != entriesInRow.end(); ++entryIt) {
117 successors.
set(entryIt->getColumn());
120 stateLabeling.
setStates(
"init", initialStates | successors);
131 keepStates.
set(state,
false);
138 auto keptRows = ma->getTransitionMatrix().getRowFilter(keepStates);
147 std::vector<ValueType> exitRates(markovianStates.
size());
152 auto model = std::make_shared<storm::models::sparse::MarkovAutomaton<ValueType, RewardModelType>>(std::move(components));
153 if (model->isConvertibleToCtmc()) {
154 return model->convertToCtmc();