Skip to content

Commit

Permalink
Fixed issues with DFT representant computation
Browse files Browse the repository at this point in the history
  • Loading branch information
volkm committed Sep 4, 2024
1 parent d61ad71 commit 8bae7c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions resources/examples/testfiles/dft/modules3.dft
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
toplevel "T";
"T" or "M" "S";
"M" and "A" "B";
"S" wsp "C" "B";
"A" lambda=1.0 dorm=0.0;
"B" lambda=1.0 dorm=0.0;
"C" lambda=1.0 dorm=0.0;
10 changes: 9 additions & 1 deletion src/storm-dft/storage/DFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ DFT<ValueType>::DFT(DFTElementVector const& elements, DFTElementPointer const& t
for (size_t modelem : module) {
if (mElements[modelem]->isSpareGate() || mElements[modelem]->isBasicElement()) {
sparesAndBes.insert(modelem);
mRepresentants.insert(std::make_pair(modelem, spareReprs->id()));
}
}
mModules.insert(std::make_pair(spareReprs->id(), storm::dft::storage::DftModule(spareReprs->id(), sparesAndBes)));
Expand Down Expand Up @@ -85,6 +84,15 @@ DFT<ValueType>::DFT(DFTElementVector const& elements, DFTElementPointer const& t
}
mModules.insert(std::make_pair(mTopLevelIndex, topModule));

// Set representants for all spare modules
for (auto const& module : mModules) {
if (module.first != mTopLevelIndex) {
for (auto const& index : module.second.getElements()) {
mRepresentants.insert(std::make_pair(index, module.first));
}
}
}

// Reserve space for failed spares
++mMaxSpareChildCount;
mStateVectorSize = DFTStateGenerationInfo::getStateVectorSize(nrElements(), mNrOfSpares, mNrRepresentatives, mMaxSpareChildCount);
Expand Down
2 changes: 2 additions & 0 deletions src/test/storm-dft/api/DftModelCheckerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ TYPED_TEST(DftModelCheckerTest, SpareMTTF) {
EXPECT_NEAR(result, 249 / 52.0, this->precision()); // DFTCalc has result of 4.33779 due to different semantics of nested spares
result = this->analyzeMTTF(STORM_TEST_RESOURCES_DIR "/dft/spare_dc.dft");
EXPECT_NEAR(result, 78311 / 182700.0, this->precision());
result = this->analyzeMTTF(STORM_TEST_RESOURCES_DIR "/dft/modules3.dft");
EXPECT_NEAR(result, 7 / 6.0, this->precision());
}

TYPED_TEST(DftModelCheckerTest, SeqMTTF) {
Expand Down

0 comments on commit 8bae7c1

Please sign in to comment.