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) {
88 assert(productChoice <
getProduct().getTransitionMatrix().getRowGroupIndices()[productState + 1]);
89 steps[productChoice] = step;
98 computeReachableStatesInEpochClasses();
101template<
typename ValueType>
108 for (uint64_t objIndex = 0; objIndex < objectives.size(); ++objIndex) {
109 if (!objectives[objIndex].formula->isProbabilityOperatorFormula()) {
113 std::vector<uint64_t> dimensionIndexMap;
114 for (
auto globalDimensionIndex : objectiveDimensions[objIndex]) {
115 dimensionIndexMap.push_back(globalDimensionIndex);
119 std::vector<storm::storage::BitVector> objMemStates;
121 for (; !m.full(); m.increment()) {
122 objMemStates.push_back(~m);
124 objMemStates.push_back(~m);
125 assert(objMemStates.size() == 1ull << dimensionIndexMap.size());
132 for (
auto dim : objectiveDimensions[objIndex]) {
133 auto const& dimension = dimensions[dim];
134 STORM_LOG_ASSERT(dimension.formula->isBoundedUntilFormula(),
"Unexpected Formula type");
135 constraintStates &= (mc.check(dimension.formula->asBoundedUntilFormula().getLeftSubformula())
136 ->template asExplicitQualitativeCheckResult<ValueType>()
137 .getTruthValuesVector() |
138 mc.check(dimension.formula->asBoundedUntilFormula().getRightSubformula())
139 ->template asExplicitQualitativeCheckResult<ValueType>()
140 .getTruthValuesVector());
144 for (uint64_t memState = 0; memState < objMemStates.size(); ++memState) {
145 auto const& memStateBV = objMemStates[memState];
146 for (uint64_t memStatePrime = 0; memStatePrime < objMemStates.size(); ++memStatePrime) {
147 auto const& memStatePrimeBV = objMemStates[memStatePrime];
148 if (memStatePrimeBV.isSubsetOf(memStateBV)) {
150 for (
auto subObjIndex : memStateBV) {
151 std::shared_ptr<storm::logic::Formula const> subObjFormula =
152 dimensions[dimensionIndexMap[subObjIndex]].formula->asBoundedUntilFormula().getRightSubformula().asSharedPointer();
153 if (memStatePrimeBV.get(subObjIndex)) {
154 subObjFormula = std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not,
157 transitionFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
158 storm::logic::BinaryBooleanStateFormula::OperatorType::And, transitionFormula, subObjFormula);
161 storm::storage::BitVector transitionStates =
162 mc.check(*transitionFormula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
163 if (memStatePrimeBV.empty()) {
164 transitionStates |= ~constraintStates;
166 transitionStates &= constraintStates;
168 objMemoryBuilder.setTransition(memState, memStatePrime, transitionStates);
171 if (memStateBV.full()) {
172 storm::storage::BitVector initialTransitionStates = model.
getInitialStates() & transitionStates;
175 if (memStatePrimeBV.empty() && !initialTransitionStates.
empty()) {
176 prob1InitialStates[objIndex] = initialTransitionStates;
179 for (
auto initState : initialTransitionStates) {
180 objMemoryBuilder.setInitialMemoryState(initState, memStatePrime);
188 for (uint64_t memState = 0; memState < objMemStates.size(); ++memState) {
189 auto const& memStateBV = objMemStates[memState];
190 for (
auto subObjIndex : memStateBV) {
191 objMemoryBuilder.setLabel(memState, dimensions[dimensionIndexMap[subObjIndex]].memoryLabel.get());
194 auto objMemory = objMemoryBuilder.build();
195 memory = memory.
product(objMemory);
200template<
typename ValueType>
201std::vector<typename ProductModel<ValueType>::MemoryState> ProductModel<ValueType>::computeMemoryStateMap(storm::storage::MemoryStructure
const& memory)
const {
203 std::vector<MemoryState> result;
205 for (uint64_t memStateIndex = 0; memStateIndex < memory.
getNumberOfStates(); ++memStateIndex) {
206 MemoryState memState = memoryStateManager.getInitialMemoryState();
208 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
209 if (dimensions[dim].memoryLabel) {
210 if (stateLabels.find(dimensions[dim].memoryLabel.get()) != stateLabels.end()) {
211 memoryStateManager.setRelevantDimension(memState, dim,
true);
213 memoryStateManager.setRelevantDimension(memState, dim,
false);
217 result.push_back(std::move(memState));
222template<
typename ValueType>
223void ProductModel<ValueType>::setReachableProductStates(storm::storage::SparseModelMemoryProduct<ValueType>& productBuilder,
224 std::vector<Epoch>
const& originalModelSteps, std::vector<MemoryState>
const& memoryStateMap)
const {
225 std::vector<uint64_t> inverseMemoryStateMap(memoryStateManager.getUpperMemoryStateBound(), std::numeric_limits<uint64_t>::max());
226 for (uint64_t memStateIndex = 0; memStateIndex < memoryStateMap.size(); ++memStateIndex) {
227 inverseMemoryStateMap[memoryStateMap[memStateIndex]] = memStateIndex;
230 auto const& memory = productBuilder.
getMemory();
234 std::vector<storm::storage::BitVector> reachableProductStates(memoryStateManager.getUpperMemoryStateBound());
235 for (
auto const& memState : memoryStateMap) {
236 reachableProductStates[memState] = storm::storage::BitVector(model.
getNumberOfStates(),
false);
241 std::vector<EpochClass> initEpochClasses;
242 initEpochClasses.push_back(epochManager.getEpochClass(epochManager.getZeroEpoch()));
243 for (uint64_t dim = 0; dim < dimensions.size(); ++dim) {
247 for (
auto& ec : initEpochClasses) {
248 epochManager.setDimensionOfEpochClass(ec, dim,
true);
250 }
else if (!dimension.maxValue) {
252 std::vector<EpochClass> newEcs = initEpochClasses;
253 for (
auto& ec : newEcs) {
254 epochManager.setDimensionOfEpochClass(ec, dim,
true);
256 initEpochClasses.insert(initEpochClasses.end(), newEcs.begin(), newEcs.end());
259 for (
auto const& initEpochClass : initEpochClasses) {
262 uint64_t transformedMemoryState = transformMemoryState(memoryStateMap[*memStateIt], initEpochClass, memoryStateManager.getInitialMemoryState());
263 reachableProductStates[transformedMemoryState].set(initState,
true);
270 std::set<Epoch> possibleSteps(originalModelSteps.begin(), originalModelSteps.end());
271 std::set<EpochClass, std::function<bool(EpochClass
const&, EpochClass
const&)>> reachableEpochClasses(
273 collectReachableEpochClasses(reachableEpochClasses, possibleSteps);
276 for (
auto epochClassIt = reachableEpochClasses.rbegin(); epochClassIt != reachableEpochClasses.rend(); ++epochClassIt) {
277 auto const& epochClass = *epochClassIt;
280 std::vector<std::pair<uint64_t, MemoryState>> dfsStack;
281 for (MemoryState
const& memState : memoryStateMap) {
282 for (
auto modelState : reachableProductStates[memState]) {
283 dfsStack.emplace_back(modelState, memState);
287 while (!dfsStack.empty()) {
288 uint64_t currentModelState = dfsStack.back().first;
289 MemoryState currentMemoryState = dfsStack.back().second;
290 uint64_t currentMemoryStateIndex = inverseMemoryStateMap[currentMemoryState];
293 for (uint64_t choice = modelTransitions.getRowGroupIndices()[currentModelState];
294 choice != modelTransitions.getRowGroupIndices()[currentModelState + 1]; ++choice) {
295 for (
auto transitionIt = modelTransitions.getRow(choice).begin(); transitionIt < modelTransitions.getRow(choice).end(); ++transitionIt) {
296 MemoryState successorMemoryState =
297 memoryStateMap[memory.
getSuccessorMemoryState(currentMemoryStateIndex, transitionIt - modelTransitions.begin())];
298 successorMemoryState = transformMemoryState(successorMemoryState, epochClass, currentMemoryState);
299 if (!reachableProductStates[successorMemoryState].get(transitionIt->getColumn())) {
300 reachableProductStates[successorMemoryState].set(transitionIt->getColumn(),
true);
301 dfsStack.emplace_back(transitionIt->getColumn(), successorMemoryState);
308 for (uint64_t memStateIndex = 0; memStateIndex < memoryStateManager.getMemoryStateCount(); ++memStateIndex) {
309 for (
auto modelState : reachableProductStates[memoryStateMap[memStateIndex]]) {
315template<
typename ValueType>
320template<
typename ValueType>
325template<
typename ValueType>
327 return modelMemoryToProductStateMap[modelState * memoryStateManager.getUpperMemoryStateBound() + memoryState] <
getProduct().getNumberOfStates();
330template<
typename ValueType>
333 <<
") in the model-memory-product which does not exist");
334 return modelMemoryToProductStateMap[modelState * memoryStateManager.getUpperMemoryStateBound() + memoryState];
337template<
typename ValueType>
340 auto productInitStateIt =
getProduct().getInitialStates().begin();
342 STORM_LOG_ASSERT(
getModelState(*productInitStateIt) == initialModelState,
"Could not find the corresponding initial state in the product model.");
343 return transformProductState(*productInitStateIt, epochClass, memoryStateManager.getInitialMemoryState());
346template<
typename ValueType>
348 return productToModelStateMap[productState];
351template<
typename ValueType>
353 return productToMemoryStateMap[productState];
356template<
typename ValueType>
358 return memoryStateManager;
361template<
typename ValueType>
363 return choiceToStateMap[productChoice];
366template<
typename ValueType>
369 std::vector<std::vector<ValueType>> objectiveRewards;
370 objectiveRewards.reserve(objectives.size());
372 for (uint64_t objIndex = 0; objIndex < objectives.size(); ++objIndex) {
373 auto const& formula = *objectives[objIndex].formula;
374 if (formula.isProbabilityOperatorFormula()) {
376 std::vector<uint64_t> dimensionIndexMap;
377 for (
auto globalDimensionIndex : objectiveDimensions[objIndex]) {
378 dimensionIndexMap.push_back(globalDimensionIndex);
381 std::shared_ptr<storm::logic::Formula const> sinkStatesFormula;
382 for (
auto dim : objectiveDimensions[objIndex]) {
383 auto memLabelFormula = std::make_shared<storm::logic::AtomicLabelFormula>(dimensions[dim].memoryLabel.get());
384 if (sinkStatesFormula) {
385 sinkStatesFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(storm::logic::BinaryBooleanStateFormula::OperatorType::Or,
386 sinkStatesFormula, memLabelFormula);
388 sinkStatesFormula = memLabelFormula;
392 std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not, sinkStatesFormula);
397 while (!relevantObjectives.
full()) {
401 bool collectRewardInEpoch =
true;
402 for (
auto subObjIndex : relevantObjectives) {
404 epochManager.isBottomDimensionEpochClass(epochClass, dimensionIndexMap[subObjIndex])) {
405 collectRewardInEpoch =
false;
410 if (collectRewardInEpoch) {
411 std::shared_ptr<storm::logic::Formula const> relevantStatesFormula;
413 for (uint64_t subObjIndex = 0; subObjIndex < dimensionIndexMap.size(); ++subObjIndex) {
414 std::shared_ptr<storm::logic::Formula> memLabelFormula =
415 std::make_shared<storm::logic::AtomicLabelFormula>(dimensions[dimensionIndexMap[subObjIndex]].memoryLabel.get());
416 if (relevantObjectives.get(subObjIndex)) {
417 auto rightSubFormula =
418 dimensions[dimensionIndexMap[subObjIndex]].formula->asBoundedUntilFormula().getRightSubformula().asSharedPointer();
419 goalStatesFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
420 storm::logic::BinaryBooleanStateFormula::OperatorType::And, goalStatesFormula, rightSubFormula);
422 memLabelFormula = std::make_shared<storm::logic::UnaryBooleanStateFormula>(
423 storm::logic::UnaryBooleanStateFormula::OperatorType::Not, memLabelFormula);
425 if (relevantStatesFormula) {
426 relevantStatesFormula = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
427 storm::logic::BinaryBooleanStateFormula::OperatorType::And, relevantStatesFormula, memLabelFormula);
429 relevantStatesFormula = memLabelFormula;
434 mc.
check(*relevantStatesFormula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
437 mc.
check(*goalStatesFormula)->template asExplicitQualitativeCheckResult<ValueType>().getTruthValuesVector();
438 for (
auto choice : relevantChoices) {
439 objRew[choice] +=
getProduct().getTransitionMatrix().getConstrainedRowSum(choice, goalStates);
444 objectiveRewards.push_back(std::move(objRew));
446 }
else if (formula.isRewardOperatorFormula()) {
447 auto const& rewModel =
getProduct().getRewardModel(formula.asRewardOperatorFormula().getRewardModelName());
448 STORM_LOG_THROW(!rewModel.hasTransitionRewards(), storm::exceptions::NotSupportedException,
449 "Reward model has transition rewards which is not expected.");
450 bool rewardCollectedInEpoch =
true;
451 if (formula.getSubformula().isCumulativeRewardFormula()) {
452 for (
auto dim : objectiveDimensions[objIndex]) {
453 if (epochManager.isBottomDimensionEpochClass(epochClass, dim)) {
454 rewardCollectedInEpoch =
false;
459 STORM_LOG_THROW(formula.getSubformula().isTotalRewardFormula(), storm::exceptions::UnexpectedException,
460 "Unexpected type of formula " << formula);
462 if (rewardCollectedInEpoch) {
463 objectiveRewards.push_back(rewModel.getTotalRewardVector(
getProduct().getTransitionMatrix()));
468 STORM_LOG_THROW(
false, storm::exceptions::UnexpectedException,
"Unexpected type of formula " << formula);
472 return objectiveRewards;
475template<
typename ValueType>
477 STORM_LOG_ASSERT(inStates.find(epochClass) != inStates.end(),
"Could not find InStates for the given epoch class");
478 return inStates.find(epochClass)->second;
481template<
typename ValueType>
482void ProductModel<ValueType>::computeReachableStatesInEpochClasses() {
483 std::set<Epoch> possibleSteps(steps.begin(), steps.end());
484 std::set<EpochClass, std::function<bool(EpochClass
const&, EpochClass
const&)>> reachableEpochClasses(
487 collectReachableEpochClasses(reachableEpochClasses, possibleSteps);
489 for (
auto epochClassIt = reachableEpochClasses.rbegin(); epochClassIt != reachableEpochClasses.rend(); ++epochClassIt) {
490 std::vector<EpochClass> predecessors;
491 for (
auto predecessorIt = reachableEpochClasses.rbegin(); predecessorIt != epochClassIt; ++predecessorIt) {
492 if (epochManager.isPredecessorEpochClass(*predecessorIt, *epochClassIt)) {
493 predecessors.push_back(*predecessorIt);
496 computeReachableStates(*epochClassIt, predecessors);
500template<
typename ValueType>
501void ProductModel<ValueType>::collectReachableEpochClasses(
502 std::set<EpochClass, std::function<
bool(EpochClass
const&, EpochClass
const&)>>& reachableEpochClasses, std::set<Epoch>
const& possibleSteps)
const {
505 Epoch startEpoch = epochManager.getZeroEpoch();
506 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
507 if (dimensions[dim].maxValue) {
508 epochManager.setDimensionOfEpoch(startEpoch, dim, dimensions[dim].maxValue.get());
510 epochManager.setBottomDimension(startEpoch, dim);
514 std::set<Epoch> seenEpochs({startEpoch});
515 std::vector<Epoch> dfsStack({startEpoch});
517 reachableEpochClasses.insert(epochManager.getEpochClass(startEpoch));
520 while (!dfsStack.empty()) {
521 Epoch currentEpoch = dfsStack.back();
523 for (
auto const& step : possibleSteps) {
524 Epoch successorEpoch = epochManager.getSuccessorEpoch(currentEpoch, step);
525 if (seenEpochs.insert(successorEpoch).second) {
526 reachableEpochClasses.insert(epochManager.getEpochClass(successorEpoch));
527 dfsStack.push_back(std::move(successorEpoch));
533 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
535 std::vector<EpochClass> newClasses;
536 for (
auto const& c : reachableEpochClasses) {
538 epochManager.setDimensionOfEpochClass(newClass, dim,
false);
539 newClasses.push_back(newClass);
541 for (
auto const& c : newClasses) {
542 reachableEpochClasses.insert(c);
548template<
typename ValueType>
549void ProductModel<ValueType>::computeReachableStates(EpochClass
const& epochClass, std::vector<EpochClass>
const& predecessors) {
550 storm::storage::BitVector bottomDimensions(epochManager.getDimensionCount(),
false);
551 bool considerInitialStates =
true;
552 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
553 if (epochManager.isBottomDimensionEpochClass(epochClass, dim)) {
554 bottomDimensions.set(dim,
true);
556 considerInitialStates =
false;
560 storm::storage::BitVector nonBottomDimensions = ~bottomDimensions;
562 storm::storage::BitVector ecInStates(getProduct().getNumberOfStates(),
false);
563 if (considerInitialStates) {
564 for (
auto initState : getProduct().getInitialStates()) {
565 uint64_t transformedInitState = transformProductState(initState, epochClass, memoryStateManager.getInitialMemoryState());
566 ecInStates.set(transformedInitState,
true);
569 for (
auto const& predecessor : predecessors) {
570 storm::storage::BitVector positiveStepDimensions(epochManager.getDimensionCount(),
false);
571 for (uint64_t dim = 0; dim < epochManager.getDimensionCount(); ++dim) {
572 if (!epochManager.isBottomDimensionEpochClass(predecessor, dim) && bottomDimensions.get(dim)) {
573 positiveStepDimensions.set(dim,
true);
576 STORM_LOG_ASSERT(reachableStates.find(predecessor) != reachableStates.end(),
"Could not find reachable states of predecessor epoch class.");
577 storm::storage::BitVector predecessorStates = reachableStates.find(predecessor)->second;
578 for (
auto predecessorState : predecessorStates) {
579 uint64_t predecessorMemoryState = getMemoryState(predecessorState);
580 for (uint64_t choice = getProduct().getTransitionMatrix().getRowGroupIndices()[predecessorState];
581 choice < getProduct().getTransitionMatrix().getRowGroupIndices()[predecessorState + 1]; ++choice) {
582 bool choiceLeadsToThisClass =
false;
583 Epoch
const& choiceStep = getSteps()[choice];
584 for (
auto dim : positiveStepDimensions) {
585 if (epochManager.getDimensionOfEpoch(choiceStep, dim) > 0) {
586 choiceLeadsToThisClass =
true;
590 if (choiceLeadsToThisClass) {
591 for (
auto const& transition : getProduct().getTransitionMatrix().getRow(choice)) {
592 uint64_t successorState = transformProductState(transition.getColumn(), epochClass, predecessorMemoryState);
594 ecInStates.set(successorState,
true);
602 storm::storage::BitVector ecReachableStates = ecInStates;
603 std::vector<uint64_t> dfsStack(ecReachableStates.
begin(), ecReachableStates.
end());
605 while (!dfsStack.empty()) {
606 uint64_t currentState = dfsStack.back();
607 uint64_t currentMemoryState = getMemoryState(currentState);
610 for (uint64_t choice = getProduct().getTransitionMatrix().getRowGroupIndices()[currentState];
611 choice != getProduct().getTransitionMatrix().getRowGroupIndices()[currentState + 1]; ++choice) {
612 bool choiceLeadsOutsideOfEpoch =
false;
613 Epoch
const& choiceStep = getSteps()[choice];
614 for (
auto dim : nonBottomDimensions) {
615 if (epochManager.getDimensionOfEpoch(choiceStep, dim) > 0) {
616 choiceLeadsOutsideOfEpoch =
true;
621 for (
auto const& transition : getProduct().getTransitionMatrix().getRow(choice)) {
622 uint64_t successorState = transformProductState(transition.getColumn(), epochClass, currentMemoryState);
623 if (choiceLeadsOutsideOfEpoch) {
624 ecInStates.set(successorState,
true);
626 if (!ecReachableStates.
get(successorState)) {
627 ecReachableStates.
set(successorState,
true);
628 dfsStack.push_back(successorState);
634 reachableStates[epochClass] = std::move(ecReachableStates);
636 inStates[epochClass] = std::move(ecInStates);
639template<
typename ValueType>
644 for (
auto const& objDimensions : objectiveDimensions) {
645 for (
auto dim : objDimensions) {
646 auto const& dimension = dimensions[dim];
647 if (dimension.memoryLabel) {
649 bool dimBottom = epochManager.isBottomDimensionEpochClass(epochClass, dim);
650 if (dimUpperBounded && dimBottom && memoryStateManager.isRelevantDimension(predecessorMemoryState, dim)) {
651 STORM_LOG_ASSERT(objDimensions == dimension.dependentDimensions,
"Unexpected set of dependent dimensions");
652 memoryStateManager.setRelevantDimensions(memoryStatePrime, objDimensions,
false);
654 }
else if (!dimUpperBounded && !dimBottom && memoryStateManager.isRelevantDimension(predecessorMemoryState, dim)) {
655 memoryStateManager.setRelevantDimensions(memoryStatePrime, dimension.dependentDimensions,
true);
664 return memoryStatePrime;
667template<
typename ValueType>
673template<
typename ValueType>
675 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)