diff --git a/src/storm-dft/modelchecker/dft/DFTASFChecker.cpp b/src/storm-dft/modelchecker/dft/DFTASFChecker.cpp index fa5ada44c..98ccc8ae4 100644 --- a/src/storm-dft/modelchecker/dft/DFTASFChecker.cpp +++ b/src/storm-dft/modelchecker/dft/DFTASFChecker.cpp @@ -432,25 +432,26 @@ namespace storm { } // Only one spare can claim a child (constraint 8) + // and only not failed childs can be claimed (addition to constrain 8) for (size_t i = 0; i < dft.nrElements(); ++i) { std::shared_ptr const> element = dft.getElement(i); if (element->isSpareGate()) { auto spare = std::static_pointer_cast const>(element); for (auto const& child : spare->children()) { + std::vector> additionalC; + uint64_t timeClaiming = getClaimVariableIndex(spare->id(), child->id()); + std::shared_ptr leftC = std::make_shared(timeClaiming, notFailed); + // Child must be operational at time of claiming + additionalC.push_back(std::make_shared(timeClaiming, timePointVariables.at(child->id()))); // No other spare claims this child - std::vector> noOtherClaims; for (auto const& otherSpare : child->parents()) { - if (otherSpare->id() == spare->id()) { - // original spare - continue; + if (otherSpare->id() != spare->id()) { + // Different spare + additionalC.push_back(std::make_shared(getClaimVariableIndex(otherSpare->id(), child->id()), notFailed)); } - noOtherClaims.push_back(std::make_shared(getClaimVariableIndex(otherSpare->id(), child->id()), notFailed)); - } - if (!noOtherClaims.empty()) { - std::shared_ptr leftC = std::make_shared(getClaimVariableIndex(spare->id(), child->id()), notFailed); - constraints.push_back(std::make_shared(leftC, std::make_shared(noOtherClaims))); - constraints.back()->setDescription("Only one spare claims the child " + child->name()); } + constraints.push_back(std::make_shared(leftC, std::make_shared(additionalC))); + constraints.back()->setDescription("Child " + child->name() + " must be operational at time of claiming by spare " + spare->name() + " and can only be claimed by one spare."); } } } @@ -467,7 +468,6 @@ namespace storm { std::vector> noClaimingPossible; // Child cannot be claimed. - noClaimingPossible.push_back(std::make_shared(claimChild, notFailed)); if (childIndex + 1 < spare->children().size()) { // Consider next child for claiming (second case in constraint 7) noClaimingPossible.push_back(generateTryToClaimConstraint(spare, childIndex+1, timepoint));