Browse Source

added 'fixed ring' pattern

tempestpy_adaptions
TimQu 7 years ago
parent
commit
19070a27a9
  1. 6
      src/storm-pomdp-cli/settings/modules/POMDPSettings.cpp
  2. 20
      src/storm-pomdp/storage/PomdpMemory.cpp
  3. 8
      src/storm-pomdp/storage/PomdpMemory.h

6
src/storm-pomdp-cli/settings/modules/POMDPSettings.cpp

@ -20,7 +20,7 @@ namespace storm {
const std::string selfloopReductionOption = "selfloopreduction"; const std::string selfloopReductionOption = "selfloopreduction";
const std::string memoryBoundOption = "memorybound"; const std::string memoryBoundOption = "memorybound";
const std::string memoryPatternOption = "memorypattern"; const std::string memoryPatternOption = "memorypattern";
std::vector<std::string> memoryPatterns = {"trivial", "fixedcounter", "selectivecounter", "ring", "settablebits", "full"};
std::vector<std::string> memoryPatterns = {"trivial", "fixedcounter", "selectivecounter", "ring", "fixedring", "settablebits", "full"};
const std::string fscmode = "fscmode"; const std::string fscmode = "fscmode";
std::vector<std::string> fscModes = {"standard", "simple-linear", "simple-linear-inverse"}; std::vector<std::string> fscModes = {"standard", "simple-linear", "simple-linear-inverse"};
const std::string transformBinaryOption = "transformbinary"; const std::string transformBinaryOption = "transformbinary";
@ -76,7 +76,9 @@ namespace storm {
} else if (pattern == "selectivecounter") { } else if (pattern == "selectivecounter") {
return storm::storage::PomdpMemoryPattern::SelectiveCounter; return storm::storage::PomdpMemoryPattern::SelectiveCounter;
} else if (pattern == "ring") { } else if (pattern == "ring") {
return storm::storage::PomdpMemoryPattern::Ring;
return storm::storage::PomdpMemoryPattern::SelectiveRing;
} else if (pattern == "fixedring") {
return storm::storage::PomdpMemoryPattern::FixedRing;
} else if (pattern == "settablebits") { } else if (pattern == "settablebits") {
return storm::storage::PomdpMemoryPattern::SettableBits; return storm::storage::PomdpMemoryPattern::SettableBits;
} else if (pattern == "full") { } else if (pattern == "full") {

20
src/storm-pomdp/storage/PomdpMemory.cpp

@ -80,7 +80,9 @@ namespace storm {
return "fixedcounter"; return "fixedcounter";
case PomdpMemoryPattern::SelectiveCounter: case PomdpMemoryPattern::SelectiveCounter:
return "selectivecounter"; return "selectivecounter";
case PomdpMemoryPattern::Ring:
case PomdpMemoryPattern::FixedRing:
return "fixedring";
case PomdpMemoryPattern::SelectiveRing:
return "ring"; return "ring";
case PomdpMemoryPattern::SettableBits: case PomdpMemoryPattern::SettableBits:
return "settablebits"; return "settablebits";
@ -99,8 +101,10 @@ namespace storm {
return buildFixedCountingMemory(numStates); return buildFixedCountingMemory(numStates);
case PomdpMemoryPattern::SelectiveCounter: case PomdpMemoryPattern::SelectiveCounter:
return buildSelectiveCountingMemory(numStates); return buildSelectiveCountingMemory(numStates);
case PomdpMemoryPattern::Ring:
return buildRingMemory(numStates);
case PomdpMemoryPattern::FixedRing:
return buildFixedRingMemory(numStates);
case PomdpMemoryPattern::SelectiveRing:
return buildSelectiveRingMemory(numStates);
case PomdpMemoryPattern::SettableBits: case PomdpMemoryPattern::SettableBits:
return buildSettableBitsMemory(numStates); return buildSettableBitsMemory(numStates);
case PomdpMemoryPattern::Full: case PomdpMemoryPattern::Full:
@ -129,7 +133,15 @@ namespace storm {
return PomdpMemory(transitions, 0); return PomdpMemory(transitions, 0);
} }
PomdpMemory PomdpMemoryBuilder::buildRingMemory(uint64_t numStates) const {
PomdpMemory PomdpMemoryBuilder::buildFixedRingMemory(uint64_t numStates) const {
std::vector<storm::storage::BitVector> transitions(numStates, storm::storage::BitVector(numStates, false));
for (uint64_t state = 0; state < numStates; ++state) {
transitions[state].set((state + 1) % numStates);
}
return PomdpMemory(transitions, 0);
}
PomdpMemory PomdpMemoryBuilder::buildSelectiveRingMemory(uint64_t numStates) const {
std::vector<storm::storage::BitVector> transitions(numStates, storm::storage::BitVector(numStates, false)); std::vector<storm::storage::BitVector> transitions(numStates, storm::storage::BitVector(numStates, false));
for (uint64_t state = 0; state < numStates; ++state) { for (uint64_t state = 0; state < numStates; ++state) {
transitions[state].set(state); transitions[state].set(state);

8
src/storm-pomdp/storage/PomdpMemory.h

@ -23,7 +23,7 @@ namespace storm {
}; };
enum class PomdpMemoryPattern { enum class PomdpMemoryPattern {
Trivial, FixedCounter, SelectiveCounter, Ring, SettableBits, Full
Trivial, FixedCounter, SelectiveCounter, FixedRing, SelectiveRing, SettableBits, Full
}; };
std::string toString(PomdpMemoryPattern const& pattern); std::string toString(PomdpMemoryPattern const& pattern);
@ -44,9 +44,13 @@ namespace storm {
// Every state has a selfloop and a transition to the next state. The last state just has a selfloop. // Every state has a selfloop and a transition to the next state. The last state just has a selfloop.
PomdpMemory buildSelectiveCountingMemory(uint64_t numStates) const; PomdpMemory buildSelectiveCountingMemory(uint64_t numStates) const;
// Builds a memory structure that consists of a ring of the given number of states.
// Every state has a transition to the successor state
PomdpMemory buildFixedRingMemory(uint64_t numStates) const;
// Builds a memory structure that consists of a ring of the given number of states. // Builds a memory structure that consists of a ring of the given number of states.
// Every state has a transition to the successor state and a selfloop // Every state has a transition to the successor state and a selfloop
PomdpMemory buildRingMemory(uint64_t numStates) const;
PomdpMemory buildSelectiveRingMemory(uint64_t numStates) const;
// Builds a memory structure that represents floor(log(numStates)) bits that can only be set from zero to one or from zero to zero. // Builds a memory structure that represents floor(log(numStates)) bits that can only be set from zero to one or from zero to zero.
PomdpMemory buildSettableBitsMemory(uint64_t numStates) const; PomdpMemory buildSettableBitsMemory(uint64_t numStates) const;

Loading…
Cancel
Save