18 std::map<uint64_t, uint64_t> stateMap;
19 std::map<uint32_t, uint32_t> observationMap;
21 uint64_t nrNewStates = prob0States.
empty() ? 1 : 2;
26 std::vector<uint32_t> newObservations;
29 for (uint64_t iter : prob1States) {
32 std::set<std::string> labelSet =
pomdp.getStateLabeling().getLabelsOfState(iter);
33 for (
auto const &label : labelSet) {
41 for (uint64_t iter : prob0States) {
43 for (
auto const &label :
pomdp.getStateLabeling().getLabelsOfState(iter)) {
53 uint64_t newId = prob0States.
empty() ? 1 : 2;
54 uint64_t nextObservation = prob0States.
empty() ? 1 : 2;
55 for (uint64_t iter : unknownStates) {
56 stateMap[iter] = newId;
57 if (observationMap.count(
pomdp.getObservation(iter)) == 0) {
58 observationMap[
pomdp.getObservation(iter)] = nextObservation;
61 for (
auto const &label :
pomdp.getStateLabeling().getLabelsOfState(iter)) {
70 uint64_t currentRow = 0;
71 uint64_t currentRowGroup = 0;
76 newObservations.push_back(0);
79 if (!prob0States.
empty()) {
84 newObservations.push_back(1);
87 auto transitionMatrix =
pomdp.getTransitionMatrix();
89 for (uint64_t iter : unknownStates) {
93 for (uint64_t row = 0; row < transitionMatrix.getRowGroupSize(iter); ++row) {
94 std::map<uint64_t, ValueType> transitionsInAction;
95 for (
auto const &entry : transitionMatrix.getRow(iter, row)) {
97 transitionsInAction[stateMap[entry.getColumn()]] += entry.getValue();
99 for (
auto const &transition : transitionsInAction) {
100 smb.
addNextValue(currentRow, transition.first, transition.second);
105 newObservations.push_back(observationMap[
pomdp.getObservation(iter)]);
109 auto newTransitionMatrix = smb.
build(currentRow, currentRowGroup, currentRowGroup);
112 if (
pomdp.hasChoiceLabeling()) {
113 auto const &originalChoiceLabeling =
pomdp.getChoiceLabeling();
114 components.
choiceLabeling.emplace(newTransitionMatrix.getRowCount());
115 for (
auto const &label : originalChoiceLabeling.getLabels()) {
119 for (uint64_t state : unknownStates) {
120 uint64_t
const originalRow = transitionMatrix.getRowGroupIndices()[state];
121 uint64_t
const newRow = newTransitionMatrix.getRowGroupIndices()[stateMap.at(state)];
122 for (uint64_t localAction = 0; localAction < transitionMatrix.getRowGroupSize(state); ++localAction) {
123 for (
auto const &label : originalChoiceLabeling.getLabelsOfChoice(originalRow + localAction)) {
124 components.
choiceLabeling->addLabelToChoice(label, newRow + localAction);
130 return std::make_shared<storm::models::sparse::Pomdp<ValueType>>(std::move(components),
true);