Browse Source

Output uses logger now

Former-commit-id: bb5061ccd4
tempestpy_adaptions
Mavo 9 years ago
parent
commit
4ae86c76f9
  1. 19
      src/builder/ExplicitDFTModelBuilder.cpp
  2. 15
      src/parser/DFTGalileoParser.cpp
  3. 53
      src/storage/dft/DFT.cpp
  4. 27
      src/storage/dft/DFT.h
  5. 6
      src/storage/dft/DFTBuilder.cpp
  6. 40
      src/storage/dft/DFTElements.h
  7. 3
      src/storage/dft/DFTState.cpp
  8. 14
      src/storage/dft/DFTState.h
  9. 2
      src/storage/dft/DFTStateSpaceGenerationQueues.h
  10. 12
      src/storm-dyftee.cpp

19
src/builder/ExplicitDFTModelBuilder.cpp

@ -17,12 +17,11 @@ namespace storm {
// Begin model generation
exploreStates(stateQueue, transitionMatrixBuilder);
//std::cout << "Generated " << mStates.size() << " states" << std::endl;
STORM_LOG_DEBUG("Generated " << mStates.size() << " states");
// Build CTMC
transitionMatrix = transitionMatrixBuilder.build();
//std::cout << "TransitionMatrix: " << std::endl;
//std::cout << transitionMatrix << std::endl;
STORM_LOG_DEBUG("TransitionMatrix: " << std::endl << transitionMatrix);
// TODO Matthias: build CTMC
}
@ -44,7 +43,7 @@ namespace storm {
// Let BE fail
while (smallest < state.nrFailableBEs()) {
//std::cout << "exploring from: " << mDft.getStateString(state) << std::endl;
STORM_LOG_TRACE("exploring from: " << mDft.getStateString(state));
storm::storage::DFTState newState(state);
std::pair<std::shared_ptr<storm::storage::DFTBE<ValueType>>, bool> nextBE = newState.letNextBEFail(smallest++);
@ -53,7 +52,7 @@ namespace storm {
break;
}
//std::cout << "with the failure of: " << nextBE.first->name() << " [" << nextBE.first->id() << "]" << std::endl;
STORM_LOG_TRACE("with the failure of: " << nextBE.first->name() << " [" << nextBE.first->id() << "]");
storm::storage::DFTStateSpaceGenerationQueues queues;
@ -85,22 +84,22 @@ namespace storm {
auto itInsert = mStates.insert(newState);
assert(itInsert.second);
it = itInsert.first;
//std::cout << "New state " << mDft.getStateString(newState) << std::endl;
STORM_LOG_TRACE("New state " << mDft.getStateString(newState));
// Recursive call
if (!mDft.hasFailed(newState) && !mDft.isFailsafe(newState)) {
stateQueue.push(newState);
} else {
if (mDft.hasFailed(newState)) {
//std::cout << "Failed " << mDft.getStateString(newState) << std::endl;
STORM_LOG_TRACE("Failed " << mDft.getStateString(newState));
} else {
assert(mDft.isFailsafe(newState));
//std::cout << "Failsafe" << mDft.getStateString(newState) << std::endl;
STORM_LOG_TRACE("Failsafe" << mDft.getStateString(newState));
}
}
} else {
// State already exists
//std::cout << "State " << mDft.getStateString(*it) << " already exists" << std::endl;
STORM_LOG_TRACE("State " << mDft.getStateString(*it) << " already exists");
}
// Set transition
@ -114,7 +113,7 @@ namespace storm {
{
ValueType rate = it->second / sum;
transitionMatrixBuilder.addNextValue(state.getId(), it->first, rate);
//std::cout << "Added transition from " << state.getId() << " to " << it->first << " with " << rate << std::endl;
STORM_LOG_TRACE("Added transition from " << state.getId() << " to " << it->first << " with " << rate);
}
} // end while queue

15
src/parser/DFTGalileoParser.cpp

@ -12,7 +12,10 @@ namespace storm {
namespace parser {
storm::storage::DFT DFTGalileoParser::parseDFT(const std::string& filename) {
if(readFile(filename)) {
return mBuilder.build();
storm::storage::DFT dft = mBuilder.build();
STORM_LOG_DEBUG("Elements:" << std::endl << dft.getElementsString());
STORM_LOG_DEBUG("Spare Modules:" << std::endl << dft.getSpareModulesString());
return dft;
} else {
throw storm::exceptions::FileIoException();
}
@ -24,9 +27,8 @@ namespace storm {
if(firstQuots == std::string::npos) {
return name;
} else if (secondQuots ==std::string::npos) {
std::cerr << "No ending quotation mark found in " << name <<std::endl;
throw storm::exceptions::FileIoException();
} else if (secondQuots == std::string::npos) {
STORM_LOG_THROW(false, storm::exceptions::FileIoException, "No ending quotation mark found in " << name);
} else {
return name.substr(firstQuots+1,secondQuots-1);
}
@ -43,7 +45,7 @@ namespace storm {
file.open(filename);
}
catch (std::ifstream::failure e) {
std::cerr << "Exception during file opening on " << filename << "." << std::endl;
STORM_LOG_THROW(false, storm::exceptions::FileIoException, "Exception during file opening on " << filename << ".");
return false;
}
file.exceptions( 0 );
@ -53,7 +55,7 @@ namespace storm {
while(std::getline(file, line))
{
bool success = true;
std::cout << line << std::endl;
STORM_LOG_TRACE("Parsing: " << line);
size_t commentstarts = line.find("//");
line = line.substr(0, commentstarts);
size_t firstsemicolon = line.find(";");
@ -89,6 +91,7 @@ namespace storm {
} else if(tokens[1] == "wsp" || tokens[1] == "csp") {
success = mBuilder.addSpareElement(name, childNames);
} else if(boost::starts_with(tokens[1], "lambda=")) {
//TODO Matthias: Use ValueType instead of fixed double
success = mBuilder.addBasicElement(name, boost::lexical_cast<double>(tokens[1].substr(7)), boost::lexical_cast<double>(tokens[2].substr(5)));
} else {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Type name: " + tokens[1] + " not recognized.");

53
src/storage/dft/DFT.cpp

@ -61,60 +61,63 @@ namespace storm {
}
void DFT::printElements(std::ostream& os) const {