22template<
typename ValueType>
25 std::vector<
Dimension<ValueType>>
const& dimensions, std::vector<storm::storage::BitVector>
const& objectiveDimensions,
26 EpochManager const& epochManager, std::vector<Epoch>
const& originalModelSteps)
27 : dimensions(dimensions),
28 objectiveDimensions(objectiveDimensions),
29 epochManager(epochManager),
30 memoryStateManager(dimensions.size()),
31 prob1InitialStates(objectives.size(),
boost::none) {
32 for (uint64_t dim = 0; dim < dimensions.size(); ++dim) {
33 if (!dimensions[dim].memoryLabel) {
34 memoryStateManager.setDimensionWithoutMemory(dim);
40 std::vector<MemoryState> memoryStateMap = computeMemoryStateMap(memory);
44 setReachableProductStates(productBuilder, originalModelSteps, memoryStateMap);
45 product = productBuilder.
build();
47 uint64_t numModelStates = productBuilder.
getOriginalModel().getNumberOfStates();
48 MemoryState upperMemStateBound = memoryStateManager.getUpperMemoryStateBound();
49 uint64_t numMemoryStates = memoryStateManager.getMemoryStateCount();
53 modelMemoryToProductStateMap.resize(upperMemStateBound * numModelStates, std::numeric_limits<uint64_t>::max());
54 productToModelStateMap.resize(numProductStates, std::numeric_limits<uint64_t>::max());
55 productToMemoryStateMap.resize(numProductStates, std::numeric_limits<uint64_t>::max());
56 for (uint64_t modelState = 0; modelState < numModelStates; ++modelState) {
57 for (uint64_t memoryStateIndex = 0; memoryStateIndex < numMemoryStates; ++memoryStateIndex) {
59 uint64_t productState = productBuilder.
getResultState(modelState, memoryStateIndex);
60 modelMemoryToProductStateMap[modelState * upperMemStateBound + memoryStateMap[memoryStateIndex]] = productState;
61 productToModelStateMap[productState] = modelState;
62 productToMemoryStateMap[productState] = memoryStateMap[memoryStateIndex];
68 choiceToStateMap.reserve(
getProduct().getTransitionMatrix().getRowCount());
69 for (uint64_t productState = 0; productState < numProductStates; ++productState) {
71 for (uint64_t i = 0; i < groupSize; ++i) {
72 choiceToStateMap.push_back(productState);
77 steps.resize(
getProduct().getTransitionMatrix().getRowCount(), 0);
78 for (uint64_t modelState = 0; modelState < numModelStates; ++modelState) {
79 uint64_t numChoices = productBuilder.
getOriginalModel().getTransitionMatrix().getRowGroupSize(modelState);
80 uint64_t firstChoice = productBuilder.
getOriginalModel().getTransitionMatrix().getRowGroupIndices()[modelState];
81 for (uint64_t choiceOffset = 0; choiceOffset < numChoices; ++choiceOffset) {
82 Epoch const& step = originalModelSteps[firstChoice + choiceOffset];
84 for (
MemoryState const& memoryState : memoryStateMap) {
89 "Product choice out of range.");
90 steps[productChoice] = step;
99 computeReachableStatesInEpochClasses();
102template<
typename ValueType>
109 for (uint64_t objIndex = 0; objIndex < objectives.size(); ++objIndex) {
110 if (!objectives[objIndex].formula->isProbabilityOperatorFormula()) {
114 std::vector<uint64_t> dimensionIndexMap;
115 for (
auto globalDimensionIndex : objectiveDimensions[objIndex]) {
116 dimensionIndexMap.push_back(globalDimensionIndex);
120 std::vector<storm::storage::BitVector> objMemStates;
122 for (; !m.full(); m.increment()) {
123 objMemStates.push_back(~m);
125 objMemStates.push_back(~m);
126 STORM_LOG_ASSERT(objMemStates.size() == 1ull << dimensionIndexMap.size(),
"Memory states size mismatch.");
133 for (
auto dim : objectiveDimensions[objIndex]) {
134 auto const& dimension = dimensions[dim];
135 STORM_LOG_ASSERT(dimension.formula->isBoundedUntilFormula(),
"Unexpected Formula type.");
136 constraintStates &= (mc.check(dimension.formula->asBoundedUntilFormula().getLeftSubformula())
137 ->template asExplicitQualitativeCheckResult<ValueType>()
138 .getTruthValuesVector() |
139 mc.check(dimension.formula->asBoundedUntilFormula().getRightSubformula())
140 ->template asExplicitQualitativeCheckResult<ValueType>()
141 .getTruthValuesVector());
145 for (uint64_t memState = 0; memState < objMemStates.size(); ++memState) {
146 auto const& memStateBV = objMemStates[memState];
147 for (uint64_t memStatePrime = 0; memStatePrime < objMemStates.size(); ++memStatePrime) {
148 auto const& memStatePrimeBV = objMemStates[memStatePrime];
149 if (memStatePrimeBV.isSubsetOf(memStateBV)) {
151 for (
auto subObjIndex : memStateBV) {
152 std::shared_ptr<storm::logic::Formula const> subObjFormula =
153 dimensions[dimensionIndexMap[subObjIndex]].formula->asBoundedUntilFormula().getRightSubformula().asSharedPointer();
154 if (memStatePrimeBV.get(subObjIndex)) {
155 subObjFormula = std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not,
158 transitionFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
159 storm::logic::BinaryBooleanStateFormula::OperatorType::And, transitionFormula, subObjFormula);
162 storm::storage::BitVector transitionStates =
163 mc.check(*transitionFormula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
164 if (memStatePrimeBV.empty()) {
165 transitionStates |= ~constraintStates;
167 transitionStates &= constraintStates;
169 objMemoryBuilder.setTransition(memState, memStatePrime, transitionStates);
172 if (memStateBV.full()) {
173 storm::storage::BitVector initialTransitionStates = model.
getInitialStates() & transitionStates;
176 if (memStatePrimeBV.empty() && !initialTransitionStates.
empty()) {
177 prob1InitialStates[objIndex] = initialTransitionStates;
180 for (uint64_t initState : initialTransitionStates) {
181 objMemoryBuilder.setInitialMemoryState(initState, memStatePrime);
189 for (uint64_t memState = 0; memState < objMemStates.size(); ++memState) {
190 auto const& memStateBV = objMemStates[memState];
191 for (
auto subObjIndex : memStateBV) {
192 objMemoryBuilder.setLabel(memState, dimensions[dimensionIndexMap[subObjIndex]].memoryLabel.get());
195 auto objMemory = objMemoryBuilder.build();
196 memory = memory.
product(objMemory);
201template<
typename ValueType>
202std::vector<typename ProductModel<ValueType>::MemoryState> ProductModel<ValueType>::computeMemoryStateMap(storm::storage::MemoryStructure
const& memory)
const {
204 std::vector<MemoryState> result;
206 for (uint64_t memStateIndex = 0; memStateIndex < memory.
getNumberOfStates(); ++memStateIndex) {
207 MemoryState memState = memoryStateManager.getInitialMemoryState();
209 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
210 if (dimensions[dim].memoryLabel) {
211 if (stateLabels.find(dimensions[dim].memoryLabel.get()) != stateLabels.end()) {
212 memoryStateManager.setRelevantDimension(memState, dim,
true);
214 memoryStateManager.setRelevantDimension(memState, dim,
false);
218 result.push_back(std::move(memState));
223template<
typename ValueType>
224void ProductModel<ValueType>::setReachableProductStates(storm::storage::SparseModelMemoryProduct<ValueType>& productBuilder,
225 std::vector<Epoch>
const& originalModelSteps, std::vector<MemoryState>
const& memoryStateMap)
const {
226 std::vector<uint64_t> inverseMemoryStateMap(memoryStateManager.getUpperMemoryStateBound(), std::numeric_limits<uint64_t>::max());
227 for (uint64_t memStateIndex = 0; memStateIndex < memoryStateMap.size(); ++memStateIndex) {
228 inverseMemoryStateMap[memoryStateMap[memStateIndex]] = memStateIndex;
231 auto const& memory = productBuilder.
getMemory();
235 std::vector<storm::storage::BitVector> reachableProductStates(memoryStateManager.getUpperMemoryStateBound());
236 for (
auto const& memState : memoryStateMap) {
237 reachableProductStates[memState] = storm::storage::BitVector(model.
getNumberOfStates(),
false);
242 std::vector<EpochClass> initEpochClasses;
243 initEpochClasses.push_back(epochManager.getEpochClass(epochManager.getZeroEpoch()));
244 for (uint64_t dim = 0; dim < dimensions.size(); ++dim) {
248 for (
auto& ec : initEpochClasses) {
249 epochManager.setDimensionOfEpochClass(ec, dim,
true);
251 }
else if (!dimension.maxValue) {
253 std::vector<EpochClass> newEcs = initEpochClasses;
254 for (
auto& ec : newEcs) {
255 epochManager.setDimensionOfEpochClass(ec, dim,
true);
257 initEpochClasses.insert(initEpochClasses.end(), newEcs.begin(), newEcs.end());
260 for (
auto const& initEpochClass : initEpochClasses) {
263 uint64_t transformedMemoryState = transformMemoryState(memoryStateMap[*memStateIt], initEpochClass, memoryStateManager.getInitialMemoryState());
264 reachableProductStates[transformedMemoryState].set(initState,
true);
271 std::set<Epoch> possibleSteps(originalModelSteps.begin(), originalModelSteps.end());
272 std::set<EpochClass, std::function<bool(EpochClass
const&, EpochClass
const&)>> reachableEpochClasses(
274 collectReachableEpochClasses(reachableEpochClasses, possibleSteps);
277 for (
auto epochClassIt = reachableEpochClasses.rbegin(); epochClassIt != reachableEpochClasses.rend(); ++epochClassIt) {
278 auto const& epochClass = *epochClassIt;
281 std::vector<std::pair<uint64_t, MemoryState>> dfsStack;
282 for (MemoryState
const& memState : memoryStateMap) {
283 for (
auto modelState : reachableProductStates[memState]) {
284 dfsStack.emplace_back(modelState, memState);
288 while (!dfsStack.empty()) {
289 uint64_t currentModelState = dfsStack.back().first;
290 MemoryState currentMemoryState = dfsStack.back().second;
291 uint64_t currentMemoryStateIndex = inverseMemoryStateMap[currentMemoryState];
294 for (uint64_t choice = modelTransitions.getRowGroupIndices()[currentModelState];
295 choice != modelTransitions.getRowGroupIndices()[currentModelState + 1]; ++choice) {
296 for (
auto transitionIt = modelTransitions.getRow(choice).begin(); transitionIt < modelTransitions.getRow(choice).end(); ++transitionIt) {
297 MemoryState successorMemoryState =
298 memoryStateMap[memory.
getSuccessorMemoryState(currentMemoryStateIndex, transitionIt - modelTransitions.begin())];
299 successorMemoryState = transformMemoryState(successorMemoryState, epochClass, currentMemoryState);
300 if (!reachableProductStates[successorMemoryState].get(transitionIt->getColumn())) {
301 reachableProductStates[successorMemoryState].set(transitionIt->getColumn(),
true);
302 dfsStack.emplace_back(transitionIt->getColumn(), successorMemoryState);
309 for (uint64_t memStateIndex = 0; memStateIndex < memoryStateManager.getMemoryStateCount(); ++memStateIndex) {
310 for (
auto modelState : reachableProductStates[memoryStateMap[memStateIndex]]) {
316template<
typename ValueType>
321template<
typename ValueType>
326template<
typename ValueType>
328 return modelMemoryToProductStateMap[modelState * memoryStateManager.getUpperMemoryStateBound() + memoryState] <
getProduct().getNumberOfStates();
331template<
typename ValueType>
334 <<
") in the model-memory-product which does not exist");
335 return modelMemoryToProductStateMap[modelState * memoryStateManager.getUpperMemoryStateBound() + memoryState];
338template<
typename ValueType>
341 auto productInitStateIt =
getProduct().getInitialStates().begin();
343 STORM_LOG_ASSERT(
getModelState(*productInitStateIt) == initialModelState,
"Could not find the corresponding initial state in the product model.");
344 return transformProductState(*productInitStateIt, epochClass, memoryStateManager.getInitialMemoryState());
347template<
typename ValueType>
349 return productToModelStateMap[productState];
352template<
typename ValueType>
354 return productToMemoryStateMap[productState];
357template<
typename ValueType>
359 return memoryStateManager;
362template<
typename ValueType>
364 return choiceToStateMap[productChoice];
367template<
typename ValueType>
370 std::vector<std::vector<ValueType>> objectiveRewards;
371 objectiveRewards.reserve(objectives.size());
373 for (uint64_t objIndex = 0; objIndex < objectives.size(); ++objIndex) {
374 auto const& formula = *objectives[objIndex].formula;
375 if (formula.isProbabilityOperatorFormula()) {
377 std::vector<uint64_t> dimensionIndexMap;
378 for (
auto globalDimensionIndex : objectiveDimensions[objIndex]) {
379 dimensionIndexMap.push_back(globalDimensionIndex);
382 std::shared_ptr<storm::logic::Formula const> sinkStatesFormula;
383 for (
auto dim : objectiveDimensions[objIndex]) {
384 auto memLabelFormula = std::make_shared<storm::logic::AtomicLabelFormula>(dimensions[dim].memoryLabel.get());
385 if (sinkStatesFormula) {
386 sinkStatesFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(storm::logic::BinaryBooleanStateFormula::OperatorType::Or,
387 sinkStatesFormula, memLabelFormula);
389 sinkStatesFormula = memLabelFormula;
393 std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not, sinkStatesFormula);
398 while (!relevantObjectives.
full()) {
402 bool collectRewardInEpoch =
true;
403 for (uint64_t subObjIndex : relevantObjectives) {
405 epochManager.isBottomDimensionEpochClass(epochClass, dimensionIndexMap[subObjIndex])) {
406 collectRewardInEpoch =
false;
411 if (collectRewardInEpoch) {
412 std::shared_ptr<storm::logic::Formula const> relevantStatesFormula;
414 for (uint64_t subObjIndex = 0; subObjIndex < dimensionIndexMap.size(); ++subObjIndex) {
415 std::shared_ptr<storm::logic::Formula> memLabelFormula =
416 std::make_shared<storm::logic::AtomicLabelFormula>(dimensions[dimensionIndexMap[subObjIndex]].memoryLabel.get());
417 if (relevantObjectives.get(subObjIndex)) {
418 auto rightSubFormula =
419 dimensions[dimensionIndexMap[subObjIndex]].formula->asBoundedUntilFormula().getRightSubformula().asSharedPointer();
420 goalStatesFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
421 storm::logic::BinaryBooleanStateFormula::OperatorType::And, goalStatesFormula, rightSubFormula);
423 memLabelFormula = std::make_shared<storm::logic::UnaryBooleanStateFormula>(
424 storm::logic::UnaryBooleanStateFormula::OperatorType::Not, memLabelFormula);
426 if (relevantStatesFormula) {
427 relevantStatesFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
428 storm::logic::BinaryBooleanStateFormula::OperatorType::And, relevantStatesFormula, memLabelFormula);
430 relevantStatesFormula = memLabelFormula;
435 mc.
check(*relevantStatesFormula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
438 mc.
check(*goalStatesFormula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
439 for (uint64_t choice : relevantChoices) {
440 objRew[choice] +=
getProduct().getTransitionMatrix().getConstrainedRowSum(choice, goalStates);
445 objectiveRewards.push_back(std::move(objRew));
447 }
else if (formula.isRewardOperatorFormula()) {
448 auto const& rewModel =
getProduct().getRewardModel(formula.asRewardOperatorFormula().getRewardModelName());
449 STORM_LOG_THROW(!rewModel.hasTransitionRewards(), storm::exceptions::NotSupportedException,
450 "Reward model has transition rewards which is not expected.");
451 bool rewardCollectedInEpoch =
true;
452 if (formula.getSubformula().isCumulativeRewardFormula()) {
453 for (
auto dim : objectiveDimensions[objIndex]) {
454 if (epochManager.isBottomDimensionEpochClass(epochClass, dim)) {
455 rewardCollectedInEpoch =
false;
460 STORM_LOG_THROW(formula.getSubformula().isTotalRewardFormula(), storm::exceptions::UnexpectedException,
461 "Unexpected type of formula " << formula <<
".");
463 if (rewardCollectedInEpoch) {
464 objectiveRewards.push_back(rewModel.getTotalRewardVector(
getProduct().getTransitionMatrix()));
469 STORM_LOG_THROW(
false, storm::exceptions::UnexpectedException,
"Unexpected type of formula " << formula <<
".");
473 return objectiveRewards;
476template<
typename ValueType>
478 STORM_LOG_ASSERT(inStates.find(epochClass) != inStates.end(),
"Could not find InStates for the given epoch class.");
479 return inStates.find(epochClass)->second;
482template<
typename ValueType>
483void ProductModel<ValueType>::computeReachableStatesInEpochClasses() {
484 std::set<Epoch> possibleSteps(steps.begin(), steps.end());
485 std::set<EpochClass, std::function<bool(EpochClass
const&, EpochClass
const&)>> reachableEpochClasses(
488 collectReachableEpochClasses(reachableEpochClasses, possibleSteps);
490 for (
auto epochClassIt = reachableEpochClasses.rbegin(); epochClassIt != reachableEpochClasses.rend(); ++epochClassIt) {
491 std::vector<EpochClass> predecessors;
492 for (
auto predecessorIt = reachableEpochClasses.rbegin(); predecessorIt != epochClassIt; ++predecessorIt) {
493 if (epochManager.isPredecessorEpochClass(*predecessorIt, *epochClassIt)) {
494 predecessors.push_back(*predecessorIt);
497 computeReachableStates(*epochClassIt, predecessors);
501template<
typename ValueType>
502void ProductModel<ValueType>::collectReachableEpochClasses(
503 std::set<EpochClass, std::function<
bool(EpochClass
const&, EpochClass
const&)>>& reachableEpochClasses, std::set<Epoch>
const& possibleSteps)
const {
506 Epoch startEpoch = epochManager.getZeroEpoch();
507 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
508 if (dimensions[dim].maxValue) {
509 epochManager.setDimensionOfEpoch(startEpoch, dim, dimensions[dim].maxValue.get());
511 epochManager.setBottomDimension(startEpoch, dim);
515 std::set<Epoch> seenEpochs({startEpoch});
516 std::vector<Epoch> dfsStack({startEpoch});
518 reachableEpochClasses.insert(epochManager.getEpochClass(startEpoch));
521 while (!dfsStack.empty()) {
522 Epoch currentEpoch = dfsStack.back();
524 for (
auto const& step : possibleSteps) {
525 Epoch successorEpoch = epochManager.getSuccessorEpoch(currentEpoch, step);
526 if (seenEpochs.insert(successorEpoch).second) {
527 reachableEpochClasses.insert(epochManager.getEpochClass(successorEpoch));
528 dfsStack.push_back(std::move(successorEpoch));
534 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
536 std::vector<EpochClass> newClasses;
537 for (
auto const& c : reachableEpochClasses) {
539 epochManager.setDimensionOfEpochClass(newClass, dim,
false);
540 newClasses.push_back(newClass);
542 for (
auto const& c : newClasses) {
543 reachableEpochClasses.insert(c);
549template<
typename ValueType>
550void ProductModel<ValueType>::computeReachableStates(EpochClass
const& epochClass, std::vector<EpochClass>
const& predecessors) {
551 storm::storage::BitVector bottomDimensions(epochManager.getDimensionCount(),
false);
552 bool considerInitialStates =
true;
553 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
554 if (epochManager.isBottomDimensionEpochClass(epochClass, dim)) {
555 bottomDimensions.set(dim,
true);
557 considerInitialStates =
false;
561 storm::storage::BitVector nonBottomDimensions = ~bottomDimensions;
563 storm::storage::BitVector ecInStates(getProduct().getNumberOfStates(),
false);
564 if (considerInitialStates) {
565 for (
auto initState : getProduct().getInitialStates()) {
566 uint64_t transformedInitState = transformProductState(initState, epochClass, memoryStateManager.getInitialMemoryState());
567 ecInStates.set(transformedInitState,
true);
570 for (
auto const& predecessor : predecessors) {
571 storm::storage::BitVector positiveStepDimensions(epochManager.getDimensionCount(),
false);
572 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
573 if (!epochManager.isBottomDimensionEpochClass(predecessor, dim) && bottomDimensions.get(dim)) {
574 positiveStepDimensions.set(dim,
true);
577 STORM_LOG_ASSERT(reachableStates.find(predecessor) != reachableStates.end(),
"Could not find reachable states of predecessor epoch class.");
578 storm::storage::BitVector predecessorStates = reachableStates.find(predecessor)->second;
579 for (uint64_t predecessorState : predecessorStates) {
580 uint64_t predecessorMemoryState = getMemoryState(predecessorState);
581 for (uint64_t choice = getProduct().getTransitionMatrix().getRowGroupIndices()[predecessorState];
582 choice < getProduct().getTransitionMatrix().getRowGroupIndices()[predecessorState + 1]; ++choice) {
583 bool choiceLeadsToThisClass =
false;
584 Epoch
const& choiceStep = getSteps()[choice];
585 for (uint64_t dim : positiveStepDimensions) {
586 if (epochManager.getDimensionOfEpoch(choiceStep, dim) > 0) {
587 choiceLeadsToThisClass =
true;
591 if (choiceLeadsToThisClass) {
592 for (
auto const& transition : getProduct().getTransitionMatrix().getRow(choice)) {
593 uint64_t successorState = transformProductState(transition.getColumn(), epochClass, predecessorMemoryState);
595 ecInStates.set(successorState,
true);
603 storm::storage::BitVector ecReachableStates = ecInStates;
604 std::vector<uint64_t> dfsStack(ecReachableStates.
begin(), ecReachableStates.
end());
606 while (!dfsStack.empty()) {
607 uint64_t currentState = dfsStack.back();
608 uint64_t currentMemoryState = getMemoryState(currentState);
611 for (uint64_t choice = getProduct().getTransitionMatrix().getRowGroupIndices()[currentState];
612 choice != getProduct().getTransitionMatrix().getRowGroupIndices()[currentState + 1]; ++choice) {
613 bool choiceLeadsOutsideOfEpoch =
false;
614 Epoch
const& choiceStep = getSteps()[choice];
615 for (uint64_t dim : nonBottomDimensions) {
616 if (epochManager.getDimensionOfEpoch(choiceStep, dim) > 0) {
617 choiceLeadsOutsideOfEpoch =
true;
622 for (
auto const& transition : getProduct().getTransitionMatrix().getRow(choice)) {
623 uint64_t successorState = transformProductState(transition.getColumn(), epochClass, currentMemoryState);
624 if (choiceLeadsOutsideOfEpoch) {
625 ecInStates.set(successorState,
true);
627 if (!ecReachableStates.
get(successorState)) {
628 ecReachableStates.
set(successorState,
true);
629 dfsStack.push_back(successorState);
635 reachableStates[epochClass] = std::move(ecReachableStates);
637 inStates[epochClass] = std::move(ecInStates);
640template<
typename ValueType>
645 for (
auto const& objDimensions : objectiveDimensions) {
646 for (uint64_t dim : objDimensions) {
647 auto const& dimension = dimensions[dim];
648 if (dimension.memoryLabel) {
650 bool dimBottom = epochManager.isBottomDimensionEpochClass(epochClass, dim);
651 if (dimUpperBounded && dimBottom && memoryStateManager.isRelevantDimension(predecessorMemoryState, dim)) {
652 STORM_LOG_ASSERT(objDimensions == dimension.dependentDimensions,
"Unexpected set of dependent dimensions.");
653 memoryStateManager.setRelevantDimensions(memoryStatePrime, objDimensions,
false);
655 }
else if (!dimUpperBounded && !dimBottom && memoryStateManager.isRelevantDimension(predecessorMemoryState, dim)) {
656 memoryStateManager.setRelevantDimensions(memoryStatePrime, dimension.dependentDimensions,
true);
665 return memoryStatePrime;
668template<
typename ValueType>
674template<
typename ValueType>
676 return prob1InitialStates[objectiveIndex];
std::shared_ptr< Formula > clone(Formula const &f) const
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
bool epochClassOrder(EpochClass const &epochClass1, EpochClass const &epochClass2) const
MemoryStateManager::MemoryState MemoryState
MemoryState transformMemoryState(MemoryState const &memoryState, EpochClass const &epochClass, MemoryState const &predecessorMemoryState) const
MemoryState getMemoryState(uint64_t const &productState) const
ProductModel(storm::models::sparse::Model< ValueType > const &model, std::vector< storm::modelchecker::multiobjective::Objective< ValueType > > const &objectives, std::vector< Dimension< ValueType > > const &dimensions, std::vector< storm::storage::BitVector > const &objectiveDimensions, EpochManager const &epochManager, std::vector< Epoch > const &originalModelSteps)
uint64_t getInitialProductState(uint64_t const &initialModelState, storm::storage::BitVector const &initialModelStates, EpochClass const &epochClass) const
EpochManager::EpochClass EpochClass
EpochManager::Epoch Epoch
std::vector< Epoch > const & getSteps() const
uint64_t transformProductState(uint64_t const &productState, EpochClass const &epochClass, MemoryState const &predecessorMemoryState) const
std::vector< std::vector< ValueType > > computeObjectiveRewards(EpochClass const &epochClass, std::vector< storm::modelchecker::multiobjective::Objective< ValueType > > const &objectives) const
uint64_t getModelState(uint64_t const &productState) const
uint64_t getProductStateFromChoice(uint64_t const &productChoice) const
storm::models::sparse::Model< ValueType > const & getProduct() const
storm::storage::BitVector const & getInStates(EpochClass const &epochClass) const
boost::optional< storm::storage::BitVector > const & getProb1InitialStates(uint64_t objectiveIndex) const
returns the initial states (with respect to the original model) that already satisfy the given object...
bool productStateExists(uint64_t const &modelState, uint64_t const &memoryState) const
uint64_t getProductState(uint64_t const &modelState, uint64_t const &memoryState) const
MemoryStateManager const & getMemoryStateManager() const
Base class for all sparse models.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
storm::storage::BitVector const & getInitialStates() const
Retrieves the initial states of the model.
std::set< std::string > getLabelsOfState(storm::storage::sparse::state_type state) const
Retrieves the set of labels attached to the given state.
A bit vector that is internally represented as a vector of 64-bit values.
bool full() const
Retrieves whether all bits are set in this bit vector.
const_iterator end() const
Returns an iterator pointing at the element past the back of the bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
void increment()
Increments the (unsigned) number represented by this BitVector by one.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
uint64_t getNumberOfSetBitsBeforeIndex(uint64_t index) const
Retrieves the number of bits set in this bit vector with an index strictly smaller than the given one...
static MemoryStructure buildTrivialMemoryStructure(storm::models::sparse::Model< ValueType, RewardModelType > const &model)
Builds a trivial memory structure for the given model (consisting of a single memory state).
This class represents a (deterministic) memory structure that can be used to encode certain events (s...
MemoryStructure product(MemoryStructure const &rhs) const
Builds the product of this memory structure and the given memory structure.
std::vector< uint_fast64_t > const & getInitialMemoryStates() const
uint_fast64_t getSuccessorMemoryState(uint_fast64_t const ¤tMemoryState, uint_fast64_t const &modelTransitionIndex) const
storm::models::sparse::StateLabeling const & getStateLabeling() const
uint_fast64_t getNumberOfStates() const
This class builds the product of the given sparse model and the given memory structure.
storm::storage::MemoryStructure const & getMemory() const
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build(bool preserveModelType=false)
Invokes the building of the product under the specified scheduler (if given).
void addReachableState(uint64_t const &modelState, uint64_t const &memoryState)
storm::models::sparse::Model< ValueType, RewardModelType > const & getOriginalModel() const
bool isStateReachable(uint64_t const &modelState, uint64_t const &memoryState)
uint64_t const & getResultState(uint64_t const &modelState, uint64_t const &memoryState)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)