Browse Source

Cleanup DFTASFChecker

tempestpy_adaptions
Alexander Bork 6 years ago
parent
commit
449c513db2
  1. 6
      src/storm-dft-cli/storm-dft.cpp
  2. 16
      src/storm-dft/api/storm-dft.cpp
  3. 4
      src/storm-dft/api/storm-dft.h
  4. 9
      src/storm-dft/modelchecker/dft/DFTASFChecker.cpp
  5. 7
      src/storm-dft/modelchecker/dft/DFTASFChecker.h
  6. 1
      src/storm-dft/utility/FDEPConflictFinder.cpp
  7. 2
      src/storm-dft/utility/FailureBoundFinder.cpp
  8. 2
      src/test/storm-dft/api/DftSmtTest.cpp

6
src/storm-dft-cli/storm-dft.cpp

@ -86,7 +86,7 @@ void processOptions() {
dft = dftTransformator.transformBinaryFDEPs(*dft);
}
// Export to smtlib2
storm::api::exportDFTToSMT<ValueType>(*dft, dftIOSettings.getExportSmtFilename(), debug.isTestSet());
storm::api::exportDFTToSMT<ValueType>(*dft, dftIOSettings.getExportSmtFilename());
return;
}
@ -101,7 +101,7 @@ void processOptions() {
STORM_LOG_DEBUG("Running DFT analysis with use of SMT");
// Set dynamic behavior vector
dft->setDynamicBehaviorInfo();
auto smtResults = storm::api::analyzeDFTSMT(*dft, true, debug.isTestSet());
auto smtResults = storm::api::analyzeDFTSMT(*dft, true);
// Set the conflict map of the dft
std::set<size_t> conflict_set;
for (auto conflict : smtResults.fdepConflicts) {
@ -116,6 +116,8 @@ void processOptions() {
}
#endif
//Proprocessing
// From now on we analyse DFT via model checking
// Set min or max

16
src/storm-dft/api/storm-dft.cpp

@ -31,30 +31,23 @@ namespace storm {
}
template<>
void exportDFTToSMT(storm::storage::DFT<double> const &dft, std::string const &file, bool experimentalMode) {
void exportDFTToSMT(storm::storage::DFT<double> const &dft, std::string const &file) {
storm::modelchecker::DFTASFChecker asfChecker(dft);
if (experimentalMode) {
asfChecker.activateExperimentalMode();
}
asfChecker.convert();
asfChecker.toFile(file);
}
template<>
void exportDFTToSMT(storm::storage::DFT<storm::RationalFunction> const &dft, std::string const &file,
bool experimentalMode) {
void exportDFTToSMT(storm::storage::DFT<storm::RationalFunction> const &dft, std::string const &file) {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to SMT does not support this data type.");
}
template<>
storm::api::PreprocessingResult
analyzeDFTSMT(storm::storage::DFT<double> const &dft, bool printOutput, bool experimentalMode) {
analyzeDFTSMT(storm::storage::DFT<double> const &dft, bool printOutput) {
uint64_t solverTimeout = 10;
storm::modelchecker::DFTASFChecker smtChecker(dft);
if (experimentalMode) {
smtChecker.activateExperimentalMode();
}
smtChecker.toSolver();
storm::api::PreprocessingResult results;
@ -87,8 +80,7 @@ namespace storm {
template<>
storm::api::PreprocessingResult
analyzeDFTSMT(storm::storage::DFT<storm::RationalFunction> const &dft, bool printOutput,
bool experimentalMode) {
analyzeDFTSMT(storm::storage::DFT<storm::RationalFunction> const &dft, bool printOutput) {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException,
"Analysis by SMT not supported for this data type.");
}

4
src/storm-dft/api/storm-dft.h

@ -109,7 +109,7 @@ namespace storm {
*/
template<typename ValueType>
storm::api::PreprocessingResult
analyzeDFTSMT(storm::storage::DFT<ValueType> const &dft, bool printOutput, bool experimentalMode);
analyzeDFTSMT(storm::storage::DFT<ValueType> const &dft, bool printOutput);
/*!
* Export DFT to JSON file.
@ -136,7 +136,7 @@ namespace storm {
* @param file File.
*/
template<typename ValueType>
void exportDFTToSMT(storm::storage::DFT<ValueType> const &dft, std::string const &file, bool experimentalMode);
void exportDFTToSMT(storm::storage::DFT<ValueType> const &dft, std::string const &file);
/*!
* Transform DFT to GSPN.

9
src/storm-dft/modelchecker/dft/DFTASFChecker.cpp

@ -18,11 +18,6 @@ namespace storm {
// Intentionally left empty.
}
void DFTASFChecker::activateExperimentalMode() {
STORM_LOG_WARN("DFT-SMT-Checker now runs in experimental mode, no guarantee for correct results is given!");
experimentalMode = true;
}
uint64_t DFTASFChecker::getClaimVariableIndex(uint64_t spare, uint64_t child) const {
return claimVariables.at(SpareAndChildPair(spare, child));
}
@ -44,9 +39,7 @@ namespace storm {
beVariables.push_back(varNames.size() - 1);
break;
case storm::storage::DFTElementType::BE_CONST: {
STORM_LOG_THROW(experimentalMode, storm::exceptions::NotSupportedException,
"Constant BEs are not supported in SMT translation.");
STORM_LOG_WARN("Constant BEs are only experimentally supported");
STORM_LOG_WARN("Constant BEs are only experimentally supported in the SMT encoding");
// Constant BEs are initially either failed or failsafe, treat them differently
auto be = std::static_pointer_cast<storm::storage::BEConst<double> const>(element);
if (be->failed()) {

7
src/storm-dft/modelchecker/dft/DFTASFChecker.h

@ -45,12 +45,6 @@ namespace storm {
public:
DFTASFChecker(storm::storage::DFT<ValueType> const&);
/**
* Activates the experimental support for constant BEs and possibly other not thoroughly tested features
*
*/
void activateExperimentalMode();
/**
* Generate general variables and constraints for the DFT and store them in the corresponding maps and vectors
*
@ -235,7 +229,6 @@ namespace storm {
std::unordered_map<uint64_t, uint64_t> markovianVariables;
std::vector<uint64_t> tmpTimePointVariables;
uint64_t notFailed;
bool experimentalMode = false;
};
}
}

1
src/storm-dft/utility/FDEPConflictFinder.cpp

@ -13,7 +13,6 @@ namespace storm {
if (useSMT) {
storm::modelchecker::DFTASFChecker checker(dft);
smtChecker = std::make_shared<storm::modelchecker::DFTASFChecker>(checker);
smtChecker->activateExperimentalMode();
smtChecker->toSolver();
}

2
src/storm-dft/utility/FailureBoundFinder.cpp

@ -143,7 +143,6 @@ namespace storm {
STORM_LOG_TRACE("Compute lower bound for number of BE failures necessary for the DFT to fail");
storm::modelchecker::DFTASFChecker smtchecker(dft);
smtchecker.activateExperimentalMode();
smtchecker.toSolver();
uint64_t bound = 0;
@ -191,7 +190,6 @@ namespace storm {
if (useSMT) {
storm::modelchecker::DFTASFChecker smtchecker(dft);
smtchecker.activateExperimentalMode();
smtchecker.toSolver();
if (smtchecker.checkTleNeverFailed() == storm::solver::SmtSolver::CheckResult::Sat) {

2
src/test/storm-dft/api/DftSmtTest.cpp

@ -1,5 +1,3 @@
#include "storm-dft/utility/FDEPConflictFinder.h"
#include "storm-dft/utility/FailureBoundFinder.h"
#include "gtest/gtest.h"
#include "storm-config.h"

Loading…
Cancel
Save