Browse Source

Merge branch 'future' into next_state_generators

Former-commit-id: a34608d2a0
main
dehnert 9 years ago
parent
commit
9506f4f420
  1. 52
      CMakeLists.txt
  2. 21
      resources/3rdparty/CMakeLists.txt
  3. 9
      src/adapters/GmmxxAdapter.h
  4. 12
      src/cli/cli.cpp
  5. 28
      src/counterexamples/GenerateCounterexample.h
  6. 44
      src/counterexamples/MILPMinimalLabelSetGenerator.h
  7. 42
      src/counterexamples/PathBasedSubsystemGenerator.h
  8. 84
      src/counterexamples/SMTMinimalCommandSetGenerator.h
  9. 14
      src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp
  10. 6
      src/models/sparse/Dtmc.cpp
  11. 18
      src/parser/AtomicPropositionLabelingParser.cpp
  12. 2
      src/parser/AutoParser.cpp
  13. 38
      src/parser/DeterministicSparseTransitionParser.cpp
  14. 20
      src/parser/MappedFile.cpp
  15. 6
      src/parser/MarkovAutomatonParser.cpp
  16. 20
      src/parser/MarkovAutomatonSparseTransitionParser.cpp
  17. 1
      src/parser/NondeterministicModelParser.cpp
  18. 34
      src/parser/NondeterministicSparseTransitionParser.cpp
  19. 2
      src/parser/SparseChoiceLabelingParser.cpp
  20. 14
      src/parser/SparseStateRewardParser.cpp
  21. 12
      src/solver/GmmxxLinearEquationSolver.cpp
  22. 8
      src/solver/GmmxxMinMaxLinearEquationSolver.cpp
  23. 6
      src/solver/GurobiLpSolver.cpp
  24. 8
      src/solver/NativeMinMaxLinearEquationSolver.cpp
  25. 42
      src/solver/TopologicalMinMaxLinearEquationSolver.cpp
  26. 2
      src/storage/ModelFormulasPair.h
  27. 4
      src/storage/SparseMatrix.cpp
  28. 12
      src/utility/ErrorHandling.h
  29. 14
      src/utility/cstring.cpp
  30. 12
      src/utility/graph.cpp
  31. 14
      src/utility/initialize.cpp
  32. 7
      src/utility/initialize.h
  33. 179
      src/utility/macros.h
  34. 3
      storm-config.h.in
  35. 17
      test/functional/storm-functional-tests.cpp
  36. 2
      test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp
  37. 2
      test/performance/modelchecker/NativeDtmcPrctlModelCheckerTest.cpp
  38. 14
      test/performance/storm-performance-tests.cpp

52
CMakeLists.txt

@ -28,6 +28,8 @@ option(USE_LIBCXX "Sets whether the standard library is libc++." OFF)
option(USE_CARL "Sets whether carl should be included." ON)
option(FORCE_COLOR "Force color output" OFF)
option(STORM_COMPILE_WITH_CCACHE "Compile using CCache" ON)
option(STORM_LOGGING_FRAMEWORK "Use a framework for logging" OFF)
option(STORM_LOG_DISABLE_DEBUG "Disable log and trace message support" OFF)
set(GUROBI_ROOT "" CACHE STRING "A hint to the root directory of Gurobi (optional).")
set(Z3_ROOT "" CACHE STRING "A hint to the root directory of Z3 (optional).")
set(CUDA_ROOT "" CACHE STRING "The root directory of CUDA.")
@ -259,8 +261,6 @@ endif(STORM_HAVE_Z3)
set(STORM_HAVE_GLPK 1)
message (STATUS "StoRM - Linking with glpk")
set(GLPK_LIBRARIES ${CMAKE_BINARY_DIR}/resources/3rdparty/glpk-4.57/lib/libglpk${DYNAMIC_EXT})
set(GLPK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/resources/3rdparty/glpk-4.57/include)
include_directories(${GLPK_INCLUDE_DIR})
list(APPEND STORM_LINK_LIBRARIES ${GLPK_LIBRARIES})
@ -537,28 +537,15 @@ endif()
##
#############################################################
set(STORM_SYLVAN_ROOT "${PROJECT_SOURCE_DIR}/resources/3rdparty/sylvan")
ExternalProject_Add(
sylvan
DOWNLOAD_COMMAND ""
PREFIX "sylvan"
SOURCE_DIR "${STORM_SYLVAN_ROOT}"
CMAKE_ARGS -DSYLVAN_BUILD_TEST=Off -DSYLVAN_BUILD_EXAMPLES=Off -DCMAKE_BUILD_TYPE=Release
BINARY_DIR "${PROJECT_BINARY_DIR}/sylvan"
INSTALL_COMMAND ""
INSTALL_DIR "${PROJECT_BINARY_DIR}/sylvan"
)
ExternalProject_Get_Property(sylvan binary_dir)
set(Sylvan_INCLUDE_DIR "${STORM_SYLVAN_ROOT}/src")
message(STATUS "Linking with shipped version of sylvan (in directory ${STORM_SYLVAN_ROOT}).")
include_directories("${Sylvan_INCLUDE_DIR}")
list(APPEND STORM_LINK_LIBRARIES "${binary_dir}/src/libsylvan.a")
list(APPEND STORM_LINK_LIBRARIES ${Sylvan_LIBRARY})
if(${OPERATING_SYSTEM} MATCHES "Linux")
find_package(Hwloc QUIET)
if(NOT Hwloc_FOUND)
message(SEND_ERROR "HWLOC is required but was not found.")
message(SEND_ERROR "HWLOC is required but was not found.")
else()
list(APPEND STORM_LINK_LIBRARIES ${Hwloc_LIBRARIES})
list(APPEND STORM_LINK_LIBRARIES ${Hwloc_LIBRARIES})
endif()
endif()
@ -573,20 +560,21 @@ endif()
## Log4CPlus
##
#############################################################
set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
set(LOG4CPLUS_BUILD_TESTING OFF)
set(LOG4CPLUS_USE_UNICODE OFF)
set(LOG4CPLUS_DEFINE_INSTALL_TARGET OFF)
add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
list(APPEND STORM_LINK_LIBRARIES log4cplusS)
if (UNIX AND NOT APPLE)
list(APPEND STORM_LINK_LIBRARIES rt)
endif(UNIX AND NOT APPLE)
if(STORM_LOGGING_FRAMEWORK)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
set(LOG4CPLUS_BUILD_TESTING OFF)
set(LOG4CPLUS_USE_UNICODE OFF)
set(LOG4CPLUS_DEFINE_INSTALL_TARGET OFF)
add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
list(APPEND STORM_LINK_LIBRARIES log4cplusS)
if (UNIX AND NOT APPLE)
list(APPEND STORM_LINK_LIBRARIES rt)
endif(UNIX AND NOT APPLE)
endif()
#############################################################
##
## Intel Threading Building Blocks (optional)

21
resources/3rdparty/CMakeLists.txt

@ -32,6 +32,8 @@ ExternalProject_Add(
)
add_dependencies(resources glpk)
set(GLPK_LIBRARIES ${CMAKE_BINARY_DIR}/resources/3rdparty/glpk-4.57/lib/libglpk${DYNAMIC_EXT} PARENT_SCOPE)
set(GLPK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/resources/3rdparty/glpk-4.57/include PARENT_SCOPE)
ExternalProject_Add(
cudd3
@ -42,6 +44,9 @@ ExternalProject_Add(
BUILD_COMMAND make "CFLAGS=-O2 -w"
INSTALL_COMMAND make install
BUILD_IN_SOURCE 0
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
)
add_dependencies(resources cudd3)
@ -51,6 +56,22 @@ set(CUDD3_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cudd-3.0.0/include PARENT_SCOP
set(CUDD3_SHARED_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/cudd-3.0.0/lib/libcudd${DYNAMIC_EXT} PARENT_SCOPE)
set(CUDD3_STATIC_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/cudd-3.0.0/liblibcudd${STATIC_EXT} PARENT_SCOPE)
set(STORM_SYLVAN_ROOT "${PROJECT_SOURCE_DIR}/resources/3rdparty/sylvan")
ExternalProject_Add(
sylvan
DOWNLOAD_COMMAND ""
PREFIX "sylvan"
SOURCE_DIR "${STORM_SYLVAN_ROOT}"
CMAKE_ARGS -DSYLVAN_BUILD_TEST=Off -DSYLVAN_BUILD_EXAMPLES=Off -DCMAKE_BUILD_TYPE=Release
BINARY_DIR "${PROJECT_BINARY_DIR}/sylvan"
INSTALL_COMMAND ""
INSTALL_DIR "${PROJECT_BINARY_DIR}/sylvan"
)
ExternalProject_Get_Property(sylvan binary_dir)
set(Sylvan_INCLUDE_DIR "${STORM_SYLVAN_ROOT}/src" PARENT_SCOPE)
set(Sylvan_LIBRARY "${binary_dir}/src/libsylvan.a" PARENT_SCOPE)
ExternalProject_Add(
googletest
#For downloads (may be useful later!)

9
src/adapters/GmmxxAdapter.h

@ -16,10 +16,7 @@
#include "src/storage/SparseMatrix.h"
#include "src/utility/ConversionHelper.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
@ -34,7 +31,7 @@ public:
template<class T>
static std::unique_ptr<gmm::csr_matrix<T>> toGmmxxSparseMatrix(storm::storage::SparseMatrix<T> const& matrix) {
uint_fast64_t realNonZeros = matrix.getEntryCount();
LOG4CPLUS_DEBUG(logger, "Converting matrix with " << realNonZeros << " non-zeros to gmm++ format.");
STORM_LOG_DEBUG("Converting matrix with " << realNonZeros << " non-zeros to gmm++ format.");
// Prepare the resulting matrix.
std::unique_ptr<gmm::csr_matrix<T>> result(new gmm::csr_matrix<T>(matrix.getRowCount(), matrix.getColumnCount()));
@ -58,7 +55,7 @@ public:
std::swap(result->ir, columns);
std::swap(result->pr, values);
LOG4CPLUS_DEBUG(logger, "Done converting matrix to gmm++ format.");
STORM_LOG_DEBUG("Done converting matrix to gmm++ format.");
return result;
}

12
src/cli/cli.cpp

@ -186,18 +186,14 @@ namespace storm {
}
if (storm::settings::generalSettings().isVerboseSet()) {
logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::INFO_LOG_LEVEL);
LOG4CPLUS_INFO(logger, "Enabled verbose mode, log output gets printed to console.");
STORM_GLOBAL_LOGLEVEL_INFO();
}
if (storm::settings::debugSettings().isDebugSet()) {
logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL);
logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::DEBUG_LOG_LEVEL);
LOG4CPLUS_INFO(logger, "Enabled very verbose mode, log output gets printed to console.");
STORM_GLOBAL_LOGLEVEL_DEBUG();
}
if (storm::settings::debugSettings().isTraceSet()) {
logger.setLogLevel(log4cplus::TRACE_LOG_LEVEL);
logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::TRACE_LOG_LEVEL);
LOG4CPLUS_INFO(logger, "Enabled trace mode, log output gets printed to console.");
STORM_GLOBAL_LOGLEVEL_TRACE();
}
if (storm::settings::debugSettings().isLogfileSet()) {
storm::utility::initializeFileLogging();

28
src/counterexamples/GenerateCounterexample.h

@ -24,20 +24,20 @@
* @param parser An AutoParser to get the model from.
*/
void generateCounterExample(std::shared_ptr<storm::models::sparse::Model<double>> model) {
LOG4CPLUS_INFO(logger, "Starting counterexample generation.");
LOG4CPLUS_INFO(logger, "Testing inputs...");
STORM_LOG_INFO("Starting counterexample generation.");
STORM_LOG_INFO("Testing inputs...");
storm::settings::SettingsManager* s = storm::settings::SettingsManager::getInstance();
// First test output directory.
std::string outPath = s->getOptionByLongName("counterExample").getArgument(0).getValueAsString();
if(outPath.back() != '/' && outPath.back() != '\\') {
LOG4CPLUS_ERROR(logger, "The output path is not valid.");
STORM_LOG_ERROR("The output path is not valid.");
return;
}
std::ofstream testFile(outPath + "test.dot");
if(testFile.fail()) {
LOG4CPLUS_ERROR(logger, "The output path is not valid.");
STORM_LOG_ERROR("The output path is not valid.");
return;
}
testFile.close();
@ -45,7 +45,7 @@
// Differentiate between model types.
if(model->getType() != storm::models::DTMC) {
LOG4CPLUS_ERROR(logger, "Counterexample generation for the selected model type is not supported.");
STORM_LOG_ERROR("Counterexample generation for the selected model type is not supported.");
return;
}
@ -53,21 +53,21 @@
// Note that the ownership of the object referenced by dtmc lies at the main function.
// Thus, it must not be deleted.
storm::models::Dtmc<double> dtmc = *(model->as<storm::models::Dtmc<double>>());
LOG4CPLUS_INFO(logger, "Model is a DTMC.");
STORM_LOG_INFO("Model is a DTMC.");
// Get specified PRCTL formulas.
if(!s->isSet("prctl")) {
LOG4CPLUS_ERROR(logger, "No PRCTL formula file specified.");
STORM_LOG_ERROR("No PRCTL formula file specified.");
return;
}
std::string const chosenPrctlFile = s->getOptionByLongName("prctl").getArgument(0).getValueAsString();
LOG4CPLUS_INFO(logger, "Parsing prctl file: " << chosenPrctlFile << ".");
STORM_LOG_INFO("Parsing prctl file: " << chosenPrctlFile << ".");
std::list<std::shared_ptr<storm::properties::prctl::PrctlFilter<double>>> formulaList = storm::parser::PrctlFileParser::parsePrctlFile(chosenPrctlFile);
// Test for each formula if a counterexample can be generated for it.
if(formulaList.size() == 0) {
LOG4CPLUS_ERROR(logger, "No PRCTL formula found.");
STORM_LOG_ERROR("No PRCTL formula found.");
return;
}
@ -94,7 +94,7 @@
// First check if it is a formula type for which a counterexample can be generated.
if (std::dynamic_pointer_cast<storm::properties::prctl::AbstractStateFormula<double>>(formula->getChild()).get() == nullptr) {
LOG4CPLUS_ERROR(logger, "Unexpected kind of formula. Expected a state formula.");
STORM_LOG_ERROR("Unexpected kind of formula. Expected a state formula.");
continue;
}
@ -102,9 +102,9 @@
// Do some output
std::cout << "Generating counterexample for formula " << fIndex << ":" << std::endl;
LOG4CPLUS_INFO(logger, "Generating counterexample for formula " + std::to_string(fIndex) + ": ");
STORM_LOG_INFO("Generating counterexample for formula " + std::to_string(fIndex) + ": ");
std::cout << "\t" << formula->toString() << "\n" << std::endl;
LOG4CPLUS_INFO(logger, formula->toString());
STORM_LOG_INFO(formula->toString());
// Now check if the model does not satisfy the formula.
// That is if there is at least one initial state of the model that does not.
@ -117,14 +117,14 @@
if((result & dtmc.getInitialStates()).getNumberOfSetBits() == dtmc.getInitialStates().getNumberOfSetBits()) {
std::cout << "Formula is satisfied. Can not generate counterexample.\n\n" << std::endl;
LOG4CPLUS_INFO(logger, "Formula is satisfied. Can not generate counterexample.");
STORM_LOG_INFO("Formula is satisfied. Can not generate counterexample.");
continue;
}
// Generate counterexample
storm::models::Dtmc<double> counterExample = storm::counterexamples::PathBasedSubsystemGenerator<double>::computeCriticalSubsystem(dtmc, stateForm);
LOG4CPLUS_INFO(logger, "Found counterexample.");
STORM_LOG_INFO("Found counterexample.");
// Output counterexample
// Do standard output

44
src/counterexamples/MILPMinimalLabelSetGenerator.h

@ -98,10 +98,10 @@ namespace storm {
result.relevantStates &= ~psiStates;
result.problematicStates = storm::utility::graph::performProb0E(labeledMdp.getTransitionMatrix(), labeledMdp.getNondeterministicChoiceIndices(), labeledMdp.getBackwardTransitions(), phiStates, psiStates);
result.problematicStates &= result.relevantStates;
LOG4CPLUS_DEBUG(logger, "Found " << phiStates.getNumberOfSetBits() << " filter states.");
LOG4CPLUS_DEBUG(logger, "Found " << psiStates.getNumberOfSetBits() << " target states.");
LOG4CPLUS_DEBUG(logger, "Found " << result.relevantStates.getNumberOfSetBits() << " relevant states.");
LOG4CPLUS_DEBUG(logger, "Found " << result.problematicStates.getNumberOfSetBits() << " problematic states.");
STORM_LOG_DEBUG("Found " << phiStates.getNumberOfSetBits() << " filter states.");
STORM_LOG_DEBUG("Found " << psiStates.getNumberOfSetBits() << " target states.");
STORM_LOG_DEBUG("Found " << result.relevantStates.getNumberOfSetBits() << " relevant states.");
STORM_LOG_DEBUG("Found " << result.problematicStates.getNumberOfSetBits() << " problematic states.");
return result;
}
@ -158,7 +158,7 @@ namespace storm {
// Finally, determine the set of labels that are known to be taken.
result.knownLabels = storm::utility::counterexamples::getGuaranteedLabelSet(labeledMdp, psiStates, result.allRelevantLabels);
LOG4CPLUS_DEBUG(logger, "Found " << result.allRelevantLabels.size() << " relevant labels and " << result.knownLabels.size() << " known labels.");
STORM_LOG_DEBUG("Found " << result.allRelevantLabels.size() << " relevant labels and " << result.knownLabels.size() << " known labels.");
return result;
}
@ -364,47 +364,47 @@ namespace storm {
std::pair<std::unordered_map<uint_fast64_t, storm::expressions::Variable>, uint_fast64_t> labelVariableResult = createLabelVariables(solver, choiceInformation.allRelevantLabels);
result.labelToVariableMap = std::move(labelVariableResult.first);
result.numberOfVariables += labelVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for labels.");
STORM_LOG_DEBUG("Created variables for labels.");
// Create scheduler variables for relevant states and their actions.
std::pair<std::unordered_map<uint_fast64_t, std::list<storm::expressions::Variable>>, uint_fast64_t> schedulerVariableResult = createSchedulerVariables(solver, stateInformation, choiceInformation);
result.stateToChoiceVariablesMap = std::move(schedulerVariableResult.first);
result.numberOfVariables += schedulerVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for nondeterministic choices.");
STORM_LOG_DEBUG("Created variables for nondeterministic choices.");
// Create scheduler variables for nondeterministically choosing an initial state.
std::pair<std::unordered_map<uint_fast64_t, storm::expressions::Variable>, uint_fast64_t> initialChoiceVariableResult = createInitialChoiceVariables(solver, labeledMdp, stateInformation);
result.initialStateToChoiceVariableMap = std::move(initialChoiceVariableResult.first);
result.numberOfVariables += initialChoiceVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for the nondeterministic choice of the initial state.");
STORM_LOG_DEBUG("Created variables for the nondeterministic choice of the initial state.");
// Create variables for probabilities for all relevant states.
std::pair<std::unordered_map<uint_fast64_t, storm::expressions::Variable>, uint_fast64_t> probabilityVariableResult = createProbabilityVariables(solver, stateInformation);
result.stateToProbabilityVariableMap = std::move(probabilityVariableResult.first);
result.numberOfVariables += probabilityVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for the reachability probabilities.");
STORM_LOG_DEBUG("Created variables for the reachability probabilities.");
// Create a probability variable for a virtual initial state that nondeterministically chooses one of the system's real initial states as its target state.
std::pair<storm::expressions::Variable, uint_fast64_t> virtualInitialStateVariableResult = createVirtualInitialStateVariable(solver);
result.virtualInitialStateVariable = virtualInitialStateVariableResult.first;
result.numberOfVariables += virtualInitialStateVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for the virtual initial state.");
STORM_LOG_DEBUG("Created variables for the virtual initial state.");
// Create variables for problematic states.
std::pair<std::unordered_map<uint_fast64_t, storm::expressions::Variable>, uint_fast64_t> problematicStateVariableResult = createProblematicStateVariables(solver, labeledMdp, stateInformation, choiceInformation);
result.problematicStateToVariableMap = std::move(problematicStateVariableResult.first);
result.numberOfVariables += problematicStateVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for the problematic states.");
STORM_LOG_DEBUG("Created variables for the problematic states.");
// Create variables for problematic choices.
std::pair<std::unordered_map<std::pair<uint_fast64_t, uint_fast64_t>, storm::expressions::Variable, PairHash>, uint_fast64_t> problematicTransitionVariableResult = createProblematicChoiceVariables(solver, labeledMdp, stateInformation, choiceInformation);
result.problematicTransitionToVariableMap = problematicTransitionVariableResult.first;
result.numberOfVariables += problematicTransitionVariableResult.second;
LOG4CPLUS_DEBUG(logger, "Created variables for the problematic choices.");
STORM_LOG_DEBUG("Created variables for the problematic choices.");
// Finally, we need to update the model to make the new variables usable.
solver.update();
LOG4CPLUS_INFO(logger, "Successfully created " << result.numberOfVariables << " MILP variables.");
STORM_LOG_INFO("Successfully created " << result.numberOfVariables << " MILP variables.");
// Finally, return variable information struct.
return result;
@ -816,43 +816,43 @@ namespace storm {
static void buildConstraintSystem(storm::solver::LpSolver& solver, storm::models::sparse::Mdp<T> const& labeledMdp, storm::storage::BitVector const& psiStates, StateInformation const& stateInformation, ChoiceInformation const& choiceInformation, VariableInformation const& variableInformation, double probabilityThreshold, bool strictBound, bool includeSchedulerCuts = false) {
// Assert that the reachability probability in the subsystem exceeds the given threshold.
uint_fast64_t numberOfConstraints = assertProbabilityGreaterThanThreshold(solver, labeledMdp, variableInformation, probabilityThreshold, strictBound);
LOG4CPLUS_DEBUG(logger, "Asserted that reachability probability exceeds threshold.");
STORM_LOG_DEBUG("Asserted that reachability probability exceeds threshold.");
// Add constraints that assert the policy takes at most one action in each state.
numberOfConstraints += assertValidPolicy(solver, stateInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted that policy is valid.");
STORM_LOG_DEBUG("Asserted that policy is valid.");
// Add constraints that assert the labels that belong to some taken choices are taken as well.
numberOfConstraints += assertChoicesImplyLabels(solver, labeledMdp, stateInformation, choiceInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted that labels implied by choices are taken.");
STORM_LOG_DEBUG("Asserted that labels implied by choices are taken.");
// Add constraints that encode that the reachability probability from states which do not pick any action
// is zero.
numberOfConstraints += assertZeroProbabilityWithoutChoice(solver, stateInformation, choiceInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted that reachability probability is zero if no choice is taken.");
STORM_LOG_DEBUG("Asserted that reachability probability is zero if no choice is taken.");
// Add constraints that encode the reachability probabilities for states.
numberOfConstraints += assertReachabilityProbabilities(solver, labeledMdp, psiStates, stateInformation, choiceInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted constraints for reachability probabilities.");
STORM_LOG_DEBUG("Asserted constraints for reachability probabilities.");
// Add constraints that ensure the reachability of an unproblematic state from each problematic state.
numberOfConstraints += assertUnproblematicStateReachable(solver, labeledMdp, stateInformation, choiceInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted that unproblematic state reachable from problematic states.");
STORM_LOG_DEBUG("Asserted that unproblematic state reachable from problematic states.");
// Add constraints that express that certain labels are already known to be taken.
numberOfConstraints += assertKnownLabels(solver, labeledMdp, psiStates, choiceInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted known labels are taken.");
STORM_LOG_DEBUG("Asserted known labels are taken.");
// If required, assert additional constraints that reduce the number of possible policies.
if (includeSchedulerCuts) {
numberOfConstraints += assertSchedulerCuts(solver, labeledMdp, psiStates, stateInformation, choiceInformation, variableInformation);
LOG4CPLUS_DEBUG(logger, "Asserted scheduler cuts.");
STORM_LOG_DEBUG("Asserted scheduler cuts.");
}
// Finally, we can tell the solver to incorporate the latest changes.
solver.update();
LOG4CPLUS_INFO(logger, "Successfully created " << numberOfConstraints << " MILP constraints.");
STORM_LOG_INFO("Successfully created " << numberOfConstraints << " MILP constraints.");
}
/*!

42
src/counterexamples/PathBasedSubsystemGenerator.h

@ -100,7 +100,7 @@ public:
}
}
LOG4CPLUS_DEBUG(logger, "Initialized.");
STORM_LOG_DEBUG("Initialized.");
//Now find the shortest distances to all states
while(!activeSet.empty()) {
@ -151,7 +151,7 @@ public:
}
}
LOG4CPLUS_DEBUG(logger, "Discovery done.");
STORM_LOG_DEBUG("Discovery done.");
}
/*!
@ -215,7 +215,7 @@ public:
}
}
LOG4CPLUS_DEBUG(logger, "Initialized.");
STORM_LOG_DEBUG("Initialized.");
//Now find the shortest distances to all states
while(!activeSet.empty()) {
@ -269,7 +269,7 @@ public:
}
}
LOG4CPLUS_DEBUG(logger, "Discovery done.");
STORM_LOG_DEBUG("Discovery done.");
}
/*!
@ -324,7 +324,7 @@ public:
if(distances[bestIndex].second == (T) -1){
shortestPath.push_back(bestIndex);
probability = (T) 0;
LOG4CPLUS_DEBUG(logger, "Terminal state not viable!");
STORM_LOG_DEBUG("Terminal state not viable!");
return;
}
@ -338,8 +338,8 @@ public:
bestIndex = distances[bestIndex].first;
}
LOG4CPLUS_DEBUG(logger, "Found best state: " << bestIndex);
LOG4CPLUS_DEBUG(logger, "Value: " << bestValue);
STORM_LOG_DEBUG("Found best state: " << bestIndex);
STORM_LOG_DEBUG("Value: " << bestValue);
shortestPath.push_back(bestIndex);
bestIndex = distances[bestIndex].first;
@ -382,9 +382,9 @@ public:
//-------------------------------------------------------------
#ifdef BENCHMARK
LOG4CPLUS_INFO(logger, "Formula: " << stateFormula.toString());
STORM_LOG_INFO("Formula: " << stateFormula.toString());
#endif
LOG4CPLUS_INFO(logger, "Start finding critical subsystem.");
STORM_LOG_INFO("Start finding critical subsystem.");
// make model checker
// TODO: Implement and use generic Model Checker factory.
@ -397,7 +397,7 @@ public:
std::shared_ptr<storm::properties::prctl::ProbabilisticBoundOperator<T>> boundOperator = std::dynamic_pointer_cast<storm::properties::prctl::ProbabilisticBoundOperator<T>>(stateFormula);
if(boundOperator == nullptr){
LOG4CPLUS_ERROR(logger, "No path bound operator at formula root.");
STORM_LOG_ERROR("No path bound operator at formula root.");
return model.getSubDtmc(subSys);
}
T bound = boundOperator->getBound();
@ -440,7 +440,7 @@ public:
targetStates = until->getRight()->check(modelCheck);
}
else {
LOG4CPLUS_ERROR(logger, "Strange path formula. Can't decipher.");
STORM_LOG_ERROR("Strange path formula. Can't decipher.");
return model.getSubDtmc(subSys);
}
@ -476,11 +476,11 @@ public:
if((initStates & targetStates).getNumberOfSetBits() != 0) {
subSys.set(*(initStates & targetStates).begin());
LOG4CPLUS_INFO(logger, "Critical subsystem found.");
LOG4CPLUS_INFO(logger, "Paths needed: " << pathCount);
LOG4CPLUS_INFO(logger, "State count of critical subsystem: " << subSys.getNumberOfSetBits());
LOG4CPLUS_INFO(logger, "Prob: " << 1);
LOG4CPLUS_INFO(logger, "Model checks: " << mcCount);
STORM_LOG_INFO("Critical subsystem found.");
STORM_LOG_INFO("Paths needed: " << pathCount);
STORM_LOG_INFO("State count of critical subsystem: " << subSys.getNumberOfSetBits());
STORM_LOG_INFO("Prob: " << 1);
STORM_LOG_INFO("Model checks: " << mcCount);
return model.getSubDtmc(subSys);
}
@ -555,11 +555,11 @@ public:
}
}
LOG4CPLUS_INFO(logger, "Critical subsystem found.");
LOG4CPLUS_INFO(logger, "Paths needed: " << pathCount);
LOG4CPLUS_INFO(logger, "State count of critical subsystem: " << subSys.getNumberOfSetBits());
LOG4CPLUS_INFO(logger, "Prob: " << subSysProb);
LOG4CPLUS_INFO(logger, "Model checks: " << mcCount);
STORM_LOG_INFO("Critical subsystem found.");
STORM_LOG_INFO("Paths needed: " << pathCount);
STORM_LOG_INFO("State count of critical subsystem: " << subSys.getNumberOfSetBits());
STORM_LOG_INFO("Prob: " << subSysProb);
STORM_LOG_INFO("Model checks: " << mcCount);
return model.getSubDtmc(subSys);
}

84
src/counterexamples/SMTMinimalCommandSetGenerator.h

@ -99,8 +99,8 @@ namespace storm {
relevancyInformation.relevantStates = storm::utility::graph::performProbGreater0E(labeledMdp.getTransitionMatrix(), labeledMdp.getNondeterministicChoiceIndices(), backwardTransitions, phiStates, psiStates);
relevancyInformation.relevantStates &= ~psiStates;
LOG4CPLUS_DEBUG(logger, "Found " << relevancyInformation.relevantStates.getNumberOfSetBits() << " relevant states.");
LOG4CPLUS_DEBUG(logger, relevancyInformation.relevantStates);
STORM_LOG_DEBUG("Found " << relevancyInformation.relevantStates.getNumberOfSetBits() << " relevant states.");
STORM_LOG_DEBUG(relevancyInformation.relevantStates);
// Retrieve some references for convenient access.
storm::storage::SparseMatrix<T> const& transitionMatrix = labeledMdp.getTransitionMatrix();
@ -141,7 +141,7 @@ namespace storm {
std::cout << "Found " << relevancyInformation.relevantLabels.size() << " relevant and " << relevancyInformation.knownLabels.size() << " known labels." << std::endl;
LOG4CPLUS_DEBUG(logger, "Found " << relevancyInformation.relevantLabels.size() << " relevant and " << relevancyInformation.knownLabels.size() << " known labels.");
STORM_LOG_DEBUG("Found " << relevancyInformation.relevantLabels.size() << " relevant and " << relevancyInformation.knownLabels.size() << " known labels.");
return relevancyInformation;
}
@ -350,9 +350,9 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "Successfully gathered data for explicit cuts.");
STORM_LOG_DEBUG("Successfully gathered data for explicit cuts.");
LOG4CPLUS_DEBUG(logger, "Asserting initial combination is taken.");
STORM_LOG_DEBUG("Asserting initial combination is taken.");
{
std::vector<storm::expressions::Expression> formulae;
@ -378,7 +378,7 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "Asserting target combination is taken.");
STORM_LOG_DEBUG("Asserting target combination is taken.");
{
std::vector<storm::expressions::Expression> formulae;
@ -414,7 +414,7 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "Asserting taken labels are followed by another label if they are not a target label.");
STORM_LOG_DEBUG("Asserting taken labels are followed by another label if they are not a target label.");
// Now assert that for each non-target label, we take a following label.
for (auto const& labelSetFollowingSetsPair : followingLabels) {
std::vector<storm::expressions::Expression> formulae;
@ -502,7 +502,7 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "Asserting synchronization cuts.");
STORM_LOG_DEBUG("Asserting synchronization cuts.");
// Finally, assert that if we take one of the synchronizing labels, we also take one of the combinations
// the label appears in.
for (auto const& labelSynchronizingSetsPair : synchronizingLabels) {
@ -667,7 +667,7 @@ namespace storm {
// If the solver reports unsat, then we know that the current selection is not enabled in the initial state.
if (checkResult == storm::solver::SmtSolver::CheckResult::Unsat) {
LOG4CPLUS_DEBUG(logger, "Selection not enabled in initial state.");
STORM_LOG_DEBUG("Selection not enabled in initial state.");
storm::expressions::Expression guardConjunction;
if (currentCommandVector.size() == 1) {
guardConjunction = currentCommandVector.begin()->get().getGuardExpression();
@ -685,10 +685,10 @@ namespace storm {
}
} else {
throw storm::exceptions::InvalidStateException() << "Choice label set is empty.";
LOG4CPLUS_DEBUG(logger, "Choice label set is empty.");
STORM_LOG_DEBUG("Choice label set is empty.");
}
LOG4CPLUS_DEBUG(logger, "About to assert disjunction of negated guards.");
STORM_LOG_DEBUG("About to assert disjunction of negated guards.");
storm::expressions::Expression guardExpression = localManager.boolean(false);
bool firstAssignment = true;
for (auto const& command : currentCommandVector) {
@ -699,7 +699,7 @@ namespace storm {
}
}
localSolver->add(guardExpression);
LOG4CPLUS_DEBUG(logger, "Asserted disjunction of negated guards.");
STORM_LOG_DEBUG("Asserted disjunction of negated guards.");
// Now check the possible preceding label sets for the essential ones.
for (auto const& precedingLabelSet : labelSetAndPrecedingLabelSetsPair.second) {
@ -742,10 +742,10 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "About to assert a weakest precondition.");
STORM_LOG_DEBUG("About to assert a weakest precondition.");
storm::expressions::Expression wp = guardConjunction.substitute(currentUpdateCombinationMap);
formulae.push_back(wp);
LOG4CPLUS_DEBUG(logger, "Asserted weakest precondition.");
STORM_LOG_DEBUG("Asserted weakest precondition.");
// Now try to move iterators to the next position if possible. If we could properly move it, we can directly
// move on to the next combination of updates. If we have to reset it to the start, we
@ -768,7 +768,7 @@ namespace storm {
// Now assert the disjunction of all weakest preconditions of all considered update combinations.
assertDisjunction(*localSolver, formulae, localManager);
LOG4CPLUS_DEBUG(logger, "Asserted disjunction of all weakest preconditions.");
STORM_LOG_DEBUG("Asserted disjunction of all weakest preconditions.");
if (localSolver->check() == storm::solver::SmtSolver::CheckResult::Sat) {
backwardImplications[labelSetAndPrecedingLabelSetsPair.first].insert(precedingLabelSet);
@ -793,7 +793,7 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "Asserting taken labels are preceded by another label if they are not an initial label.");
STORM_LOG_DEBUG("Asserting taken labels are preceded by another label if they are not an initial label.");
// Now assert that for each non-target label, we take a following label.
for (auto const& labelSetImplicationsPair : backwardImplications) {
std::vector<storm::expressions::Expression> formulae;
@ -1042,7 +1042,7 @@ namespace storm {
static std::vector<storm::expressions::Expression> createAdder(VariableInformation const& variableInformation, std::vector<storm::expressions::Expression> const& in1, std::vector<storm::expressions::Expression> const& in2) {
// Sanity check for sizes of input.
if (in1.size() != in2.size() || in1.size() == 0) {
LOG4CPLUS_ERROR(logger, "Illegal input to adder (" << in1.size() << ", " << in2.size() << ").");
STORM_LOG_ERROR("Illegal input to adder (" << in1.size() << ", " << in2.size() << ").");
throw storm::exceptions::InvalidArgumentException() << "Illegal input to adder.";
}
@ -1097,7 +1097,7 @@ namespace storm {
* @return A bit vector representing the number of literals that are set to true.
*/
static std::vector<storm::expressions::Expression> createCounterCircuit(VariableInformation const& variableInformation, std::vector<storm::expressions::Variable> const& literals) {
LOG4CPLUS_DEBUG(logger, "Creating counter circuit for " << literals.size() << " literals.");
STORM_LOG_DEBUG("Creating counter circuit for " << literals.size() << " literals.");
// Create the auxiliary vector.
std::vector<std::vector<storm::expressions::Expression>> aux;
@ -1136,7 +1136,7 @@ namespace storm {
* @return The relaxation variable associated with the constraint.
*/
static storm::expressions::Variable assertLessOrEqualKRelaxed(storm::solver::SmtSolver& solver, VariableInformation const& variableInformation, uint64_t k) {
LOG4CPLUS_DEBUG(logger, "Asserting solution has size less or equal " << k << ".");
STORM_LOG_DEBUG("Asserting solution has size less or equal " << k << ".");
std::vector<storm::expressions::Variable> const& input = variableInformation.adderVariables;
@ -1209,16 +1209,16 @@ namespace storm {
}
// Check whether the assumptions are satisfiable.
LOG4CPLUS_DEBUG(logger, "Invoking satisfiability checking.");
STORM_LOG_DEBUG("Invoking satisfiability checking.");
z3::check_result result = solver.check(assumptions);
LOG4CPLUS_DEBUG(logger, "Done invoking satisfiability checking.");
STORM_LOG_DEBUG("Done invoking satisfiability checking.");
if (result == z3::sat) {
return true;
} else {
LOG4CPLUS_DEBUG(logger, "Computing unsat core.");
STORM_LOG_DEBUG("Computing unsat core.");
z3::expr_vector unsatCore = solver.unsat_core();
LOG4CPLUS_DEBUG(logger, "Computed unsat core.");
STORM_LOG_DEBUG("Computed unsat core.");
std::vector<z3::expr> blockingVariables;
blockingVariables.reserve(unsatCore.size());
@ -1334,7 +1334,7 @@ namespace storm {
// As long as the constraints are unsatisfiable, we need to relax the last at-most-k constraint and
// try with an increased bound.
while (solver.checkWithAssumptions({assumption}) == storm::solver::SmtSolver::CheckResult::Unsat) {
LOG4CPLUS_DEBUG(logger, "Constraint system is unsatisfiable with at most " << currentBound << " taken commands; increasing bound.");
STORM_LOG_DEBUG("Constraint system is unsatisfiable with at most " << currentBound << " taken commands; increasing bound.");
solver.add(variableInformation.auxiliaryVariables.back());
variableInformation.auxiliaryVariables.push_back(assertLessOrEqualKRelaxed(solver, variableInformation, ++currentBound));
assumption = !variableInformation.auxiliaryVariables.back();
@ -1359,7 +1359,7 @@ namespace storm {
static void analyzeZeroProbabilitySolution(storm::solver::SmtSolver& solver, storm::models::sparse::Mdp<T> const& subMdp, storm::models::sparse::Mdp<T> const& originalMdp, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, boost::container::flat_set<uint_fast64_t> const& commandSet, VariableInformation& variableInformation, RelevancyInformation const& relevancyInformation) {
storm::storage::BitVector reachableStates(subMdp.getNumberOfStates());
LOG4CPLUS_DEBUG(logger, "Analyzing solution with zero probability.");
STORM_LOG_DEBUG("Analyzing solution with zero probability.");
// Initialize the stack for the DFS.
bool targetStateIsReachable = false;
@ -1403,10 +1403,10 @@ namespace storm {
}
}
LOG4CPLUS_DEBUG(logger, "Successfully performed reachability analysis.");
STORM_LOG_DEBUG("Successfully performed reachability analysis.");
if (targetStateIsReachable) {
LOG4CPLUS_ERROR(logger, "Target must be unreachable for this analysis.");
STORM_LOG_ERROR("Target must be unreachable for this analysis.");
throw storm::exceptions::InvalidStateException() << "Target must be unreachable for this analysis.";
}
@ -1417,7 +1417,7 @@ namespace storm {
std::set_difference(relevancyInformation.relevantLabels.begin(), relevancyInformation.relevantLabels.end(), commandSet.begin(), commandSet.end(), std::inserter(locallyRelevantLabels, locallyRelevantLabels.begin()));
std::vector<boost::container::flat_set<uint_fast64_t>> guaranteedLabelSets = storm::utility::counterexamples::getGuaranteedLabelSets(originalMdp, statesThatCanReachTargetStates, locallyRelevantLabels);
LOG4CPLUS_DEBUG(logger, "Found " << reachableLabels.size() << " reachable labels and " << reachableStates.getNumberOfSetBits() << " reachable states.");
STORM_LOG_DEBUG("Found " << reachableLabels.size() << " reachable labels and " << reachableStates.getNumberOfSetBits() << " reachable states.");
// Search for states on the border of the reachable state space, i.e. states that are still reachable
// and possess a (disabled) option to leave the reachable part of the state space.
@ -1466,7 +1466,7 @@ namespace storm {
formulae.push_back(cube);
}
LOG4CPLUS_DEBUG(logger, "Asserting reachability implications.");
STORM_LOG_DEBUG("Asserting reachability implications.");
assertDisjunction(solver, formulae, *variableInformation.manager);
}
@ -1484,7 +1484,7 @@ namespace storm {
*/
static void analyzeInsufficientProbabilitySolution(storm::solver::SmtSolver& solver, storm::models::sparse::Mdp<T> const& subMdp, storm::models::sparse::Mdp<T> const& originalMdp, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, boost::container::flat_set<uint_fast64_t> const& commandSet, VariableInformation& variableInformation, RelevancyInformation const& relevancyInformation) {
LOG4CPLUS_DEBUG(logger, "Analyzing solution with insufficient probability.");
STORM_LOG_DEBUG("Analyzing solution with insufficient probability.");
storm::storage::BitVector reachableStates(subMdp.getNumberOfStates());
@ -1529,7 +1529,7 @@ namespace storm {
}
}
}
LOG4CPLUS_DEBUG(logger, "Successfully determined reachable state space.");
STORM_LOG_DEBUG("Successfully determined reachable state space.");
storm::storage::BitVector unreachableRelevantStates = ~reachableStates & relevancyInformation.relevantStates;
storm::storage::BitVector statesThatCanReachTargetStates = storm::utility::graph::performProbGreater0E(subMdp.getTransitionMatrix(), subMdp.getNondeterministicChoiceIndices(), subMdp.getBackwardTransitions(), phiStates, psiStates);
@ -1574,7 +1574,7 @@ namespace storm {
formulae.push_back(cube);
}
LOG4CPLUS_DEBUG(logger, "Asserting reachability implications.");
STORM_LOG_DEBUG("Asserting reachability implications.");
assertDisjunction(solver, formulae, *variableInformation.manager);
}
#endif
@ -1627,7 +1627,7 @@ namespace storm {
double maximalReachabilityProbability = 0;
if (checkThresholdFeasible) {
storm::modelchecker::helper::SparseMdpPrctlHelper<T> modelCheckerHelper;
LOG4CPLUS_DEBUG(logger, "Invoking model checker.");
STORM_LOG_DEBUG("Invoking model checker.");
std::vector<T> result = std::move(modelCheckerHelper.computeUntilProbabilities(false, labeledMdp.getTransitionMatrix(), labeledMdp.getBackwardTransitions(), phiStates, psiStates, false, false, storm::utility::solver::MinMaxLinearEquationSolverFactory<T>()).values);
for (auto state : labeledMdp.getInitialStates()) {
maximalReachabilityProbability = std::max(maximalReachabilityProbability, result[state]);
@ -1645,7 +1645,7 @@ namespace storm {
// (4) Create the variables for the relevant commands.
VariableInformation variableInformation = createVariables(manager, labeledMdp, psiStates, relevancyInformation, includeReachabilityEncoding);
LOG4CPLUS_DEBUG(logger, "Created variables.");
STORM_LOG_DEBUG("Created variables.");
// (5) Now assert an adder whose result variables can later be used to constrain the nummber of label
// variables that were set to true. Initially, we are looking for a solution that has no label enabled
@ -1654,14 +1654,14 @@ namespace storm {
variableInformation.auxiliaryVariables.push_back(assertLessOrEqualKRelaxed(*solver, variableInformation, 0));
// (6) Add constraints that cut off a lot of suboptimal solutions.
LOG4CPLUS_DEBUG(logger, "Asserting cuts.");
STORM_LOG_DEBUG("Asserting cuts.");
assertExplicitCuts(labeledMdp, psiStates, variableInformation, relevancyInformation, *solver);
LOG4CPLUS_DEBUG(logger, "Asserted explicit cuts.");
STORM_LOG_DEBUG("Asserted explicit cuts.");
assertSymbolicCuts(preparedProgram, labeledMdp, variableInformation, relevancyInformation, *solver);
LOG4CPLUS_DEBUG(logger, "Asserted symbolic cuts.");
STORM_LOG_DEBUG("Asserted symbolic cuts.");
if (includeReachabilityEncoding) {
assertReachabilityCuts(labeledMdp, psiStates, variableInformation, relevancyInformation, *solver);
LOG4CPLUS_DEBUG(logger, "Asserted reachability cuts.");
STORM_LOG_DEBUG("Asserted reachability cuts.");
}
// As we are done with the setup at this point, stop the clock for the setup time.
@ -1680,20 +1680,20 @@ namespace storm {
maximalReachabilityProbability = 0;
uint_fast64_t zeroProbabilityCount = 0;
do {
LOG4CPLUS_DEBUG(logger, "Computing minimal command set.");
STORM_LOG_DEBUG("Computing minimal command set.");
solverClock = std::chrono::high_resolution_clock::now();
commandSet = findSmallestCommandSet(*solver, variableInformation, currentBound);
totalSolverTime += std::chrono::high_resolution_clock::now() - solverClock;
LOG4CPLUS_DEBUG(logger, "Computed minimal command set of size " << (commandSet.size() + relevancyInformation.knownLabels.size()) << ".");
STORM_LOG_DEBUG("Computed minimal command set of size " << (commandSet.size() + relevancyInformation.knownLabels.size()) << ".");
// Restrict the given MDP to the current set of labels and compute the reachability probability.
modelCheckingClock = std::chrono::high_resolution_clock::now();
commandSet.insert(relevancyInformation.knownLabels.begin(), relevancyInformation.knownLabels.end());
storm::models::sparse::Mdp<T> subMdp = labeledMdp.restrictChoiceLabels(commandSet);
storm::modelchecker::helper::SparseMdpPrctlHelper<T> modelCheckerHelper;
LOG4CPLUS_DEBUG(logger, "Invoking model checker.");
STORM_LOG_DEBUG("Invoking model checker.");
std::vector<T> result = std::move(modelCheckerHelper.computeUntilProbabilities(false, subMdp.getTransitionMatrix(), subMdp.getBackwardTransitions(), phiStates, psiStates, false, false, storm::utility::solver::MinMaxLinearEquationSolverFactory<T>()).values);
LOG4CPLUS_DEBUG(logger, "Computed model checking results.");
STORM_LOG_DEBUG("Computed model checking results.");
totalModelCheckingTime += std::chrono::high_resolution_clock::now() - modelCheckingClock;
// Now determine the maximal reachability probability by checking all initial states.

14
src/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp

@ -87,9 +87,9 @@ namespace storm {
storm::storage::BitVector statesWithProbability0 = std::move(statesWithProbability01.first);
storm::storage::BitVector statesWithProbability1 = std::move(statesWithProbability01.second);
storm::storage::BitVector maybeStates = ~(statesWithProbability0 | statesWithProbability1);
LOG4CPLUS_INFO(logger, "Found " << statesWithProbability0.getNumberOfSetBits() << " 'no' states.");
LOG4CPLUS_INFO(logger, "Found " << statesWithProbability1.getNumberOfSetBits() << " 'yes' states.");
LOG4CPLUS_INFO(logger, "Found " << maybeStates.getNumberOfSetBits() << " 'maybe' states.");
STORM_LOG_INFO("Found " << statesWithProbability0.getNumberOfSetBits() << " 'no' states.");
STORM_LOG_INFO("Found " << statesWithProbability1.getNumberOfSetBits() << " 'yes' states.");
STORM_LOG_INFO("Found " << maybeStates.getNumberOfSetBits() << " 'maybe' states.");
// Create resulting vector.
std::vector<ValueType> result(transitionMatrix.getRowGroupCount());
@ -287,16 +287,16 @@ namespace storm {
}
infinityStates.complement();
storm::storage::BitVector maybeStates = ~targetStates & ~infinityStates;
LOG4CPLUS_INFO(logger, "Found " << infinityStates.getNumberOfSetBits() << " 'infinity' states.");
LOG4CPLUS_INFO(logger, "Found " << targetStates.getNumberOfSetBits() << " 'target' states.");
LOG4CPLUS_INFO(logger, "Found " << maybeStates.getNumberOfSetBits() << " 'maybe' states.");
STORM_LOG_INFO("Found " << infinityStates.getNumberOfSetBits() << " 'infinity' states.");
STORM_LOG_INFO("Found " << targetStates.getNumberOfSetBits() << " 'target' states.");
STORM_LOG_INFO("Found " << maybeStates.getNumberOfSetBits() << " 'maybe' states.");
// Create resulting vector.
std::vector<ValueType> result(transitionMatrix.getRowGroupCount(), storm::utility::zero<ValueType>());
// Check whether we need to compute exact rewards for some states.
if (qualitative) {
LOG4CPLUS_INFO(logger, "The rewards for the initial states were determined in a preprocessing step. No exact rewards were computed.");
STORM_LOG_INFO("The rewards for the initial states were determined in a preprocessing step. No exact rewards were computed.");
// Set the values for all maybe-states to 1 to indicate that their reward values
// are neither 0 nor infinity.
storm::utility::vector::setVectorValues<ValueType>(result, maybeStates, storm::utility::one<ValueType>());

6
src/models/sparse/Dtmc.cpp

@ -33,7 +33,7 @@ namespace storm {
//
// // Is there any state in the subsystem?
// if(subSysStates.getNumberOfSetBits() == 0) {
// LOG4CPLUS_ERROR(logger, "No states in subsystem!");
// STORM_LOG_ERROR("No states in subsystem!");
// return storm::models::Dtmc<ValueType>(storm::storage::SparseMatrix<ValueType>(),
// storm::models::sparse::StateLabeling(this->getStateLabeling(), subSysStates),
// boost::optional<std::vector<ValueType>>(),
@ -43,13 +43,13 @@ namespace storm {
//
// // Does the vector have the right size?
// if(subSysStates.size() != this->getNumberOfStates()) {
// LOG4CPLUS_INFO(logger, "BitVector has wrong size. Resizing it...");
// STORM_LOG_INFO("BitVector has wrong size. Resizing it...");
// subSysStates.resize(this->getNumberOfStates());
// }
//
// // Test if it is a proper subsystem of this Dtmc, i.e. if there is at least one state to be left out.
// if(subSysStates.getNumberOfSetBits() == subSysStates.size()) {
// LOG4CPLUS_INFO(logger, "All states are kept. This is no proper subsystem.");
// STORM_LOG_INFO("All states are kept. This is no proper subsystem.");
// return storm::models::Dtmc<ValueType>(*this);
// }
//

18
src/parser/AtomicPropositionLabelingParser.cpp

@ -16,10 +16,6 @@
#include "src/exceptions/WrongFormatException.h"
#include "src/exceptions/FileIoException.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
namespace storm {
namespace parser {
@ -29,7 +25,7 @@ namespace storm {
// Open the given file.
if (!MappedFile::fileExistsAndIsReadable(filename.c_str())) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": The supplied Labeling input file does not exist or is not readable by this process.");
STORM_LOG_ERROR("Error while parsing " << filename << ": The supplied Labeling input file does not exist or is not readable by this process.");
throw storm::exceptions::FileIoException() << "Error while parsing " << filename << ": The supplied Labeling input file does not exist or is not readable by this process.";
}
@ -68,9 +64,9 @@ namespace storm {
// If #DECLARATION or #END have not been found, the file format is wrong.
if (!(foundDecl && foundEnd)) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": File header is corrupted (#DECLARATION or #END missing - case sensitive).");
if (!foundDecl) LOG4CPLUS_ERROR(logger, "\tDid not find #DECLARATION token.");
if (!foundEnd) LOG4CPLUS_ERROR(logger, "\tDid not find #END token.");
STORM_LOG_ERROR("Error while parsing " << filename << ": File header is corrupted (#DECLARATION or #END missing - case sensitive).");
if (!foundDecl) STORM_LOG_ERROR("\tDid not find #DECLARATION token.");
if (!foundEnd) STORM_LOG_ERROR("\tDid not find #END token.");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": File header is corrupted (#DECLARATION or #END missing - case sensitive).";
}
@ -99,7 +95,7 @@ namespace storm {
if (cnt >= sizeof(proposition)) {
// if token is longer than our buffer, the following strncpy code might get risky...
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": Atomic proposition with length > " << (sizeof(proposition) - 1) << " was found.");
STORM_LOG_ERROR("Error while parsing " << filename << ": Atomic proposition with length > " << (sizeof(proposition) - 1) << " was found.");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": Atomic proposition with length > " << (sizeof(proposition) - 1) << " was found.";
} else if (cnt > 0) {
@ -138,7 +134,7 @@ namespace storm {
// If the state has already been read or skipped once there might be a problem with the file (doubled lines, or blocks).
if (state <= lastState && lastState != startIndexComparison) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": State " << state << " was found but has already been read or skipped previously.");
STORM_LOG_ERROR("Error while parsing " << filename << ": State " << state << " was found but has already been read or skipped previously.");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": State " << state << " was found but has already been read or skipped previously.";
}
@ -159,7 +155,7 @@ namespace storm {
// Has the label been declared in the header?
if(!labeling.containsLabel(proposition)) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": Atomic proposition" << proposition << " was found but not declared.");
STORM_LOG_ERROR("Error while parsing " << filename << ": Atomic proposition" << proposition << " was found but not declared.");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": Atomic proposition" << proposition << " was found but not declared.";
}
labeling.addLabelToState(proposition, state);

2
src/parser/AutoParser.cpp

@ -54,7 +54,7 @@ namespace storm {
break;
}
default:
LOG4CPLUS_WARN(logger, "Unknown/Unhandled Model Type which cannot be parsed."); // Unknown
STORM_LOG_WARN("Unknown/Unhandled Model Type which cannot be parsed."); // Unknown
}
return model;

38
src/parser/DeterministicSparseTransitionParser.cpp

@ -17,11 +17,7 @@
#include "src/settings/modules/GeneralSettings.h"
#include "src/adapters/CarlAdapter.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
namespace parser {
@ -46,7 +42,7 @@ namespace storm {
setlocale(LC_NUMERIC, "C");
if (!MappedFile::fileExistsAndIsReadable(filename.c_str())) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": File does not exist or is not readable.");
STORM_LOG_ERROR("Error while parsing " << filename << ": File does not exist or is not readable.");
throw storm::exceptions::FileIoException() << "The supplied Transition input file \"" << filename << "\" does not exist or is not readable by this process.";
}
@ -58,11 +54,11 @@ namespace storm {
bool insertDiagonalEntriesIfMissing = !isRewardFile;
DeterministicSparseTransitionParser<ValueType>::FirstPassResult firstPass = DeterministicSparseTransitionParser<ValueType>::firstPass(file.getData(), insertDiagonalEntriesIfMissing);
LOG4CPLUS_INFO(logger, "First pass on " << filename << " shows " << firstPass.numberOfNonzeroEntries << " NonZeros.");
STORM_LOG_INFO("First pass on " << filename << " shows " << firstPass.numberOfNonzeroEntries << " NonZeros.");
// If first pass returned zero, the file format was wrong.
if (firstPass.numberOfNonzeroEntries == 0) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": empty or erroneous file format.");
STORM_LOG_ERROR("Error while parsing " << filename << ": empty or erroneous file format.");
throw storm::exceptions::WrongFormatException();
}
@ -78,7 +74,7 @@ namespace storm {
if (isRewardFile) {
// The reward matrix should match the size of the transition matrix.
if (firstPass.highestStateIndex + 1 > transitionMatrix.getRowCount() || firstPass.highestStateIndex + 1 > transitionMatrix.getColumnCount()) {
LOG4CPLUS_ERROR(logger, "Reward matrix has more rows or columns than transition matrix.");
STORM_LOG_ERROR("Reward matrix has more rows or columns than transition matrix.");
throw storm::exceptions::WrongFormatException() << "Reward matrix has more rows or columns than transition matrix.";
} else {
// If we found the right number of states or less, we set it to the number of states represented by the transition matrix.
@ -122,9 +118,9 @@ namespace storm {
hadDeadlocks = true;
if (!dontFixDeadlocks) {
resultMatrix.addNextValue(skippedRow, skippedRow, storm::utility::one<ValueType>());
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions. A self-loop was inserted.");
STORM_LOG_WARN("Warning while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions. A self-loop was inserted.");
} else {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions.");
STORM_LOG_ERROR("Error while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions.");
// Before throwing the appropriate exception we will give notice of all deadlock states.
}
}
@ -143,9 +139,9 @@ namespace storm {
if (!rowHadDiagonalEntry) {
if (insertDiagonalEntriesIfMissing) {
resultMatrix.addNextValue(lastRow, lastRow, storm::utility::zero<ValueType>());
LOG4CPLUS_DEBUG(logger, "While parsing " << filename << ": state " << lastRow << " has no transition to itself. Inserted a 0-transition. (1)");
STORM_LOG_DEBUG("While parsing " << filename << ": state " << lastRow << " has no transition to itself. Inserted a 0-transition. (1)");
} else {
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << lastRow << " has no transition to itself.");
STORM_LOG_WARN("Warning while parsing " << filename << ": state " << lastRow << " has no transition to itself.");
}
// No increment for lastRow.
rowHadDiagonalEntry = true;
@ -154,9 +150,9 @@ namespace storm {
hadDeadlocks = true;
if (!dontFixDeadlocks) {
resultMatrix.addNextValue(skippedRow, skippedRow, storm::utility::one<ValueType>());
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions. A self-loop was inserted.");
STORM_LOG_WARN("Warning while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions. A self-loop was inserted.");
} else {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions.");
STORM_LOG_ERROR("Error while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions.");
// Before throwing the appropriate exception we will give notice of all deadlock states.
}
}
@ -171,9 +167,9 @@ namespace storm {
if (col > row && !rowHadDiagonalEntry) {
if (insertDiagonalEntriesIfMissing) {
resultMatrix.addNextValue(row, row, storm::utility::zero<ValueType>());
LOG4CPLUS_DEBUG(logger, "While parsing " << filename << ": state " << row << " has no transition to itself. Inserted a 0-transition. (2)");
STORM_LOG_DEBUG("While parsing " << filename << ": state " << row << " has no transition to itself. Inserted a 0-transition. (2)");
} else {
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << row << " has no transition to itself.");
STORM_LOG_WARN("Warning while parsing " << filename << ": state " << row << " has no transition to itself.");
}
rowHadDiagonalEntry = true;
}
@ -185,9 +181,9 @@ namespace storm {
if (!rowHadDiagonalEntry) {
if (insertDiagonalEntriesIfMissing) {
resultMatrix.addNextValue(lastRow, lastRow, storm::utility::zero<ValueType>());
LOG4CPLUS_DEBUG(logger, "While parsing " << filename << ": state " << lastRow << " has no transition to itself. Inserted a 0-transition. (3)");
STORM_LOG_DEBUG("While parsing " << filename << ": state " << lastRow << " has no transition to itself. Inserted a 0-transition. (3)");
} else {
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << lastRow << " has no transition to itself.");
STORM_LOG_WARN("Warning while parsing " << filename << ": state " << lastRow << " has no transition to itself.");
}
}
@ -200,7 +196,7 @@ namespace storm {
// Since we cannot check if each transition for which there is a reward in the reward file also exists in the transition matrix during parsing, we have to do it afterwards.
if (isRewardFile && !result.isSubmatrixOf(transitionMatrix)) {
LOG4CPLUS_ERROR(logger, "There are rewards for non existent transitions given in the reward file.");
STORM_LOG_ERROR("There are rewards for non existent transitions given in the reward file.");
throw storm::exceptions::WrongFormatException() << "There are rewards for non existent transitions given in the reward file.";
}
@ -272,7 +268,7 @@ namespace storm {
// Have we already seen this transition?
if (row == lastRow && col == lastCol) {
LOG4CPLUS_ERROR(logger, "The same transition (" << row << ", " << col << ") is given twice.");
STORM_LOG_ERROR("The same transition (" << row << ", " << col << ") is given twice.");
throw storm::exceptions::InvalidArgumentException() << "The same transition (" << row << ", " << col << ") is given twice.";
}

20
src/parser/MappedFile.cpp

@ -14,11 +14,7 @@
#include <boost/integer/integer_mask.hpp>
#include "src/exceptions/FileIoException.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
namespace parser {
@ -33,20 +29,20 @@ namespace storm {
#else
if (stat64(filename, &(this->st)) != 0) {
#endif
LOG4CPLUS_ERROR(logger, "Error in stat(" << filename << "): Probably, this file does not exist.");
STORM_LOG_ERROR("Error in stat(" << filename << "): Probably, this file does not exist.");
throw exceptions::FileIoException() << "MappedFile Error in stat(): Probably, this file does not exist.";
}
this->file = open(filename, O_RDONLY);
if (this->file < 0) {
LOG4CPLUS_ERROR(logger, "Error in open(" << filename << "): Probably, we may not read this file.");
STORM_LOG_ERROR("Error in open(" << filename << "): Probably, we may not read this file.");
throw exceptions::FileIoException() << "MappedFile Error in open(): Probably, we may not read this file.";
}
this->data = static_cast<char*>(mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0));
if (this->data == MAP_FAILED) {
close(this->file);
LOG4CPLUS_ERROR(logger, "Error in mmap(" << filename << "): " << std::strerror(errno));
STORM_LOG_ERROR("Error in mmap(" << filename << "): " << std::strerror(errno));
throw exceptions::FileIoException() << "MappedFile Error in mmap(): " << std::strerror(errno);
}
this->dataEnd = this->data + this->st.st_size;
@ -56,20 +52,20 @@ namespace storm {
// _stat64(), CreateFile(), CreateFileMapping(), MapViewOfFile()
if (_stat64(filename, &(this->st)) != 0) {
LOG4CPLUS_ERROR(logger, "Error in _stat(" << filename << "): Probably, this file does not exist.");
STORM_LOG_ERROR("Error in _stat(" << filename << "): Probably, this file does not exist.");
throw exceptions::FileIoException("MappedFile Error in stat(): Probably, this file does not exist.");
}
this->file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (this->file == INVALID_HANDLE_VALUE) {
LOG4CPLUS_ERROR(logger, "Error in CreateFileA(" << filename << "): Probably, we may not read this file.");
STORM_LOG_ERROR("Error in CreateFileA(" << filename << "): Probably, we may not read this file.");
throw exceptions::FileIoException("MappedFile Error in CreateFileA(): Probably, we may not read this file.");
}
this->mapping = CreateFileMappingA(this->file, NULL, PAGE_READONLY, (DWORD)(st.st_size >> 32), (DWORD)st.st_size, NULL);
if (this->mapping == NULL) {
CloseHandle(this->file);
LOG4CPLUS_ERROR(logger, "Error in CreateFileMappingA(" << filename << ").");
STORM_LOG_ERROR("Error in CreateFileMappingA(" << filename << ").");
throw exceptions::FileIoException("MappedFile Error in CreateFileMappingA().");
}
@ -77,7 +73,7 @@ namespace storm {
if (this->data == NULL) {
CloseHandle(this->mapping);
CloseHandle(this->file);
LOG4CPLUS_ERROR(logger, "Error in MapViewOfFile(" << filename << ").");
STORM_LOG_ERROR("Error in MapViewOfFile(" << filename << ").");
throw exceptions::FileIoException("MappedFile Error in MapViewOfFile().");
}
this->dataEnd = this->data + this->st.st_size;

6
src/parser/MarkovAutomatonParser.cpp

@ -8,10 +8,6 @@
#include "src/adapters/CarlAdapter.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
namespace storm {
namespace parser {
@ -37,7 +33,7 @@ namespace storm {
// Since Markov Automata do not support transition rewards no path should be given here.
if (transitionRewardFilename != "") {
LOG4CPLUS_ERROR(logger, "Transition rewards are unsupported for Markov automata.");
STORM_LOG_ERROR("Transition rewards are unsupported for Markov automata.");
throw storm::exceptions::WrongFormatException() << "Transition rewards are unsupported for Markov automata.";
}

20
src/parser/MarkovAutomatonSparseTransitionParser.cpp

@ -48,11 +48,11 @@ namespace storm {
result.numberOfNonzeroEntries += source - lastsource - 1;
result.numberOfChoices += source - lastsource - 1;
} else {
LOG4CPLUS_ERROR(logger, "Found deadlock states (e.g. " << lastsource + 1 << ") during parsing. Please fix them or set the appropriate flag.");
STORM_LOG_ERROR("Found deadlock states (e.g. " << lastsource + 1 << ") during parsing. Please fix them or set the appropriate flag.");
throw storm::exceptions::WrongFormatException() << "Found deadlock states (e.g. " << lastsource + 1 << ") during parsing. Please fix them or set the appropriate flag.";
}
} else if (source < lastsource) {
LOG4CPLUS_ERROR(logger, "Illegal state choice order. A choice of state " << source << " appears at an illegal position.");
STORM_LOG_ERROR("Illegal state choice order. A choice of state " << source << " appears at an illegal position.");
throw storm::exceptions::WrongFormatException() << "Illegal state choice order. A choice of state " << source << " appears at an illegal position.";
}
@ -80,11 +80,11 @@ namespace storm {
if (isMarkovianChoice) {
if (stateHasMarkovianChoice) {
LOG4CPLUS_ERROR(logger, "The state " << source << " has multiple Markovian choices.");
STORM_LOG_ERROR("The state " << source << " has multiple Markovian choices.");
throw storm::exceptions::WrongFormatException() << "The state " << source << " has multiple Markovian choices.";
}
if (stateHasProbabilisticChoice) {
LOG4CPLUS_ERROR(logger, "The state " << source << " has a probabilistic choice preceding a Markovian choice. The Markovian choice must be the first choice listed.");
STORM_LOG_ERROR("The state " << source << " has a probabilistic choice preceding a Markovian choice. The Markovian choice must be the first choice listed.");
throw storm::exceptions::WrongFormatException() << "The state " << source << " has a probabilistic choice preceding a Markovian choice. The Markovian choice must be the first choice listed.";
}
stateHasMarkovianChoice = true;
@ -106,7 +106,7 @@ namespace storm {
// If the end of the file was reached, we need to abort and check whether we are in a legal state.
if (buf[0] == '\0') {
if (!hasSuccessorState) {
LOG4CPLUS_ERROR(logger, "Premature end-of-file. Expected at least one successor state for state " << source << ".");
STORM_LOG_ERROR("Premature end-of-file. Expected at least one successor state for state " << source << ".");
throw storm::exceptions::WrongFormatException() << "Premature end-of-file. Expected at least one successor state for state " << source << ".";
} else {
// If there was at least one successor for the current choice, this is legal and we need to move on.
@ -122,18 +122,18 @@ namespace storm {
result.highestStateIndex = target;
}
if (hasSuccessorState && target <= lastSuccessorState) {
LOG4CPLUS_ERROR(logger, "Illegal transition order for source state " << source << ".");
STORM_LOG_ERROR("Illegal transition order for source state " << source << ".");
throw storm::exceptions::WrongFormatException() << "Illegal transition order for source state " << source << ".";
}
// And the corresponding probability/rate.
double val = checked_strtod(buf, &buf);
if (val < 0.0) {
LOG4CPLUS_ERROR(logger, "Illegal negative probability/rate value for transition from " << source << " to " << target << ": " << val << ".");
STORM_LOG_ERROR("Illegal negative probability/rate value for transition from " << source << " to " << target << ": " << val << ".");
throw storm::exceptions::WrongFormatException() << "Illegal negative probability/rate value for transition from " << source << " to " << target << ": " << val << ".";
}
if (!isMarkovianChoice && val > 1.0) {
LOG4CPLUS_ERROR(logger, "Illegal probability value for transition from " << source << " to " << target << ": " << val << ".");
STORM_LOG_ERROR("Illegal probability value for transition from " << source << " to " << target << ": " << val << ".");
throw storm::exceptions::WrongFormatException() << "Illegal probability value for transition from " << source << " to " << target << ": " << val << ".";
}
@ -191,7 +191,7 @@ namespace storm {
++currentChoice;
}
} else {
LOG4CPLUS_ERROR(logger, "Found deadlock states (e.g. " << lastsource + 1 << ") during parsing. Please fix them or set the appropriate flag.");
STORM_LOG_ERROR("Found deadlock states (e.g. " << lastsource + 1 << ") during parsing. Please fix them or set the appropriate flag.");
throw storm::exceptions::WrongFormatException() << "Found deadlock states (e.g. " << lastsource + 1 << ") during parsing. Please fix them or set the appropriate flag.";
}
}
@ -269,7 +269,7 @@ namespace storm {
setlocale(LC_NUMERIC, "C");
if (!MappedFile::fileExistsAndIsReadable(filename.c_str())) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": File does not exist or is not readable.");
STORM_LOG_ERROR("Error while parsing " << filename << ": File does not exist or is not readable.");
throw storm::exceptions::FileIoException() << "Error while parsing " << filename << ": File does not exist or is not readable.";
}

1
src/parser/NondeterministicModelParser.cpp

@ -11,6 +11,7 @@
#include "src/parser/SparseChoiceLabelingParser.h"
#include "src/adapters/CarlAdapter.h"
#include "src/utility/macros.h"
namespace storm {
namespace parser {

34
src/parser/NondeterministicSparseTransitionParser.cpp

@ -14,11 +14,7 @@
#include "src/utility/cstring.h"
#include "src/adapters/CarlAdapter.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
namespace parser {
@ -44,7 +40,7 @@ namespace storm {
setlocale(LC_NUMERIC, "C");
if (!MappedFile::fileExistsAndIsReadable(filename.c_str())) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": File does not exist or is not readable.");
STORM_LOG_ERROR("Error while parsing " << filename << ": File does not exist or is not readable.");
throw storm::exceptions::FileIoException() << "Error while parsing " << filename << ": File does not exist or is not readable.";
}
@ -57,7 +53,7 @@ namespace storm {
// If first pass returned zero, the file format was wrong.
if (firstPass.numberOfNonzeroEntries == 0) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": erroneous file format.");
STORM_LOG_ERROR("Error while parsing " << filename << ": erroneous file format.");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": erroneous file format.";
}
@ -73,13 +69,13 @@ namespace storm {
if (isRewardFile) {
// The reward matrix should match the size of the transition matrix.
if (firstPass.choices > modelInformation.getRowCount() || (uint_fast64_t) (firstPass.highestStateIndex + 1) > modelInformation.getColumnCount()) {
LOG4CPLUS_ERROR(logger, "Reward matrix size exceeds transition matrix size.");
STORM_LOG_ERROR("Reward matrix size exceeds transition matrix size.");
throw storm::exceptions::OutOfRangeException() << "Reward matrix size exceeds transition matrix size.";
} else if (firstPass.choices != modelInformation.getRowCount()) {
LOG4CPLUS_ERROR(logger, "Reward matrix row count does not match transition matrix row count.");
STORM_LOG_ERROR("Reward matrix row count does not match transition matrix row count.");
throw storm::exceptions::OutOfRangeException() << "Reward matrix row count does not match transition matrix row count.";
} else if (firstPass.numberOfNonzeroEntries > modelInformation.getEntryCount()) {
LOG4CPLUS_ERROR(logger, "The reward matrix has more entries than the transition matrix. There must be a reward for a non existent transition");
STORM_LOG_ERROR("The reward matrix has more entries than the transition matrix. There must be a reward for a non existent transition");
throw storm::exceptions::OutOfRangeException() << "The reward matrix has more entries than the transition matrix.";
} else {
firstPass.highestStateIndex = modelInformation.getColumnCount() - 1;
@ -89,7 +85,7 @@ namespace storm {
// Create the matrix builder.
// The matrix to be build should have as many columns as we have nodes and as many rows as we have choices.
// Those two values, as well as the number of nonzero elements, was been calculated in the first run.
LOG4CPLUS_INFO(logger, "Attempting to create matrix of size " << firstPass.choices << " x " << (firstPass.highestStateIndex + 1) << " with " << firstPass.numberOfNonzeroEntries << " entries.");
STORM_LOG_INFO("Attempting to create matrix of size " << firstPass.choices << " x " << (firstPass.highestStateIndex + 1) << " with " << firstPass.numberOfNonzeroEntries << " entries.");
storm::storage::SparseMatrixBuilder<ValueType> matrixBuilder;
if (!isRewardFile) {
matrixBuilder = storm::storage::SparseMatrixBuilder<ValueType>(firstPass.choices, firstPass.highestStateIndex + 1, firstPass.numberOfNonzeroEntries, true, true, firstPass.highestStateIndex + 1);
@ -155,9 +151,9 @@ namespace storm {
matrixBuilder.newRowGroup(curRow);
matrixBuilder.addNextValue(curRow, node, 1);
++curRow;
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": node " << node << " has no outgoing transitions. A self-loop was inserted.");
STORM_LOG_WARN("Warning while parsing " << filename << ": node " << node << " has no outgoing transitions. A self-loop was inserted.");
} else {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": node " << node << " has no outgoing transitions.");
STORM_LOG_ERROR("Error while parsing " << filename << ": node " << node << " has no outgoing transitions.");
}
}
if (source != lastSource) {
@ -194,7 +190,7 @@ namespace storm {
// Since we cannot check if each transition for which there is a reward in the reward file also exists in the transition matrix during parsing, we have to do it afterwards.
if (isRewardFile && !resultMatrix.isSubmatrixOf(modelInformation)) {
LOG4CPLUS_ERROR(logger, "There are rewards for non existent transitions given in the reward file.");
STORM_LOG_ERROR("There are rewards for non existent transitions given in the reward file.");
throw storm::exceptions::WrongFormatException() << "There are rewards for non existent transitions given in the reward file.";
}
@ -230,7 +226,7 @@ namespace storm {
choice = checked_strtol(buf, &buf);
if (source < lastSource) {
LOG4CPLUS_ERROR(logger, "The current source state " << source << " is smaller than the last one " << lastSource << ".");
STORM_LOG_ERROR("The current source state " << source << " is smaller than the last one " << lastSource << ".");
throw storm::exceptions::InvalidArgumentException() << "The current source state " << source << " is smaller than the last one " << lastSource << ".";
}
@ -243,7 +239,7 @@ namespace storm {
// Make sure that the highest state index of the reward file is not higher than the highest state index of the corresponding model.
if (result.highestStateIndex > modelInformation.getColumnCount() - 1) {
LOG4CPLUS_ERROR(logger, "State index " << result.highestStateIndex << " found. This exceeds the highest state index of the model, which is " << modelInformation.getColumnCount() - 1 << " .");
STORM_LOG_ERROR("State index " << result.highestStateIndex << " found. This exceeds the highest state index of the model, which is " << modelInformation.getColumnCount() - 1 << " .");
throw storm::exceptions::OutOfRangeException() << "State index " << result.highestStateIndex << " found. This exceeds the highest state index of the model, which is " << modelInformation.getColumnCount() - 1 << " .";
}
@ -292,18 +288,18 @@ namespace storm {
// Also, have we already seen this transition?
if (target == lastTarget && choice == lastChoice && source == lastSource) {
LOG4CPLUS_ERROR(logger, "The same transition (" << source << ", " << choice << ", " << target << ") is given twice.");
STORM_LOG_ERROR("The same transition (" << source << ", " << choice << ", " << target << ") is given twice.");
throw storm::exceptions::InvalidArgumentException() << "The same transition (" << source << ", " << choice << ", " << target << ") is given twice.";
}
// Read value and check whether it's positive.
val = checked_strtod(buf, &buf);
if (!isRewardFile && (val < 0.0 || val > 1.0)) {
LOG4CPLUS_ERROR(logger, "Expected a positive probability but got \"" << std::string(buf, 0, 16) << "\".");
STORM_LOG_ERROR("Expected a positive probability but got \"" << std::string(buf, 0, 16) << "\".");
NondeterministicSparseTransitionParser::FirstPassResult nullResult;
return nullResult;
} else if (val < 0.0) {
LOG4CPLUS_ERROR(logger, "Expected a positive reward value but got \"" << std::string(buf, 0, 16) << "\".");
STORM_LOG_ERROR("Expected a positive reward value but got \"" << std::string(buf, 0, 16) << "\".");
NondeterministicSparseTransitionParser::FirstPassResult nullResult;
return nullResult;
}

2
src/parser/SparseChoiceLabelingParser.cpp

@ -14,7 +14,7 @@ namespace storm {
std::vector<storm::models::sparse::LabelSet> SparseChoiceLabelingParser::parseChoiceLabeling(std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, std::string const& filename) {
// Open file.
if (!MappedFile::fileExistsAndIsReadable(filename.c_str())) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": File does not exist or is not readable.");
STORM_LOG_ERROR("Error while parsing " << filename << ": File does not exist or is not readable.");
throw storm::exceptions::FileIoException() << "Error while parsing " << filename << ": File does not exist or is not readable.";
}

14
src/parser/SparseStateRewardParser.cpp

@ -8,11 +8,7 @@
#include "src/parser/MappedFile.h"
#include "src/adapters/CarlAdapter.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
namespace parser {
@ -22,7 +18,7 @@ namespace storm {
std::vector<ValueType> SparseStateRewardParser<ValueType>::parseSparseStateReward(uint_fast64_t stateCount, std::string const& filename) {
// Open file.
if (!MappedFile::fileExistsAndIsReadable(filename.c_str())) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": File does not exist or is not readable.");
STORM_LOG_ERROR("Error while parsing " << filename << ": File does not exist or is not readable.");
throw storm::exceptions::FileIoException() << "Error while parsing " << filename << ": File does not exist or is not readable.";
}
@ -47,12 +43,12 @@ namespace storm {
// If the state has already been read or skipped once there might be a problem with the file (doubled lines, or blocks).
// Note: The value -1 shows that lastState has not yet been set, i.e. this is the first run of the loop (state index (2^64)-1 is a really bad starting index).
if (state <= lastState && lastState != startIndexComparison) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": State " << state << " was found but has already been read or skipped previously.");
STORM_LOG_ERROR("Error while parsing " << filename << ": State " << state << " was found but has already been read or skipped previously.");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": State " << state << " was found but has already been read or skipped previously.";
}
if (stateCount <= state) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": Found reward for a state of an invalid index \"" << state << "\". The model has only " << stateCount << " states.");
STORM_LOG_ERROR("Error while parsing " << filename << ": Found reward for a state of an invalid index \"" << state << "\". The model has only " << stateCount << " states.");
throw storm::exceptions::OutOfRangeException() << "Error while parsing " << filename << ": Found reward for a state of an invalid index \"" << state << "\"";
}
@ -60,7 +56,7 @@ namespace storm {
reward = checked_strtod(buf, &buf);
if (reward < 0.0) {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": Expected positive reward value but got \"" << reward << "\".");
STORM_LOG_ERROR("Error while parsing " << filename << ": Expected positive reward value but got \"" << reward << "\".");
throw storm::exceptions::WrongFormatException() << "Error while parsing " << filename << ": State reward file specifies illegal reward value.";
}

12
src/solver/GmmxxLinearEquationSolver.cpp

@ -56,9 +56,9 @@ namespace storm {
template<typename ValueType>
void GmmxxLinearEquationSolver<ValueType>::solveEquationSystem(std::vector<ValueType>& x, std::vector<ValueType> const& b, std::vector<ValueType>* multiplyResult) const {
LOG4CPLUS_INFO(logger, "Using method '" << methodToString() << "' with preconditioner '" << preconditionerToString() << "' (max. " << maximalNumberOfIterations << " iterations).");
STORM_LOG_INFO("Using method '" << methodToString() << "' with preconditioner '" << preconditionerToString() << "' (max. " << maximalNumberOfIterations << " iterations).");
if (method == SolutionMethod::Jacobi && preconditioner != Preconditioner::None) {
LOG4CPLUS_WARN(logger, "Jacobi method currently does not support preconditioners. The requested preconditioner will be ignored.");
STORM_LOG_WARN("Jacobi method currently does not support preconditioners. The requested preconditioner will be ignored.");
}
if (method == SolutionMethod::Bicgstab || method == SolutionMethod::Qmr || method == SolutionMethod::Gmres) {
@ -93,18 +93,18 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (iter.converged()) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iter.get_iteration() << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << iter.get_iteration() << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
STORM_LOG_WARN("Iterative solver did not converge.");
}
} else if (method == SolutionMethod::Jacobi) {
uint_fast64_t iterations = solveLinearEquationSystemWithJacobi(*originalA, x, b, multiplyResult);
// Check if the solver converged and issue a warning otherwise.
if (iterations < maximalNumberOfIterations) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << iterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge.");
STORM_LOG_WARN("Iterative solver did not converge.");
}
}
}

8
src/solver/GmmxxMinMaxLinearEquationSolver.cpp

@ -69,9 +69,9 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (converged) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << iterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge after " << iterations << " iterations.");
STORM_LOG_WARN("Iterative solver did not converge after " << iterations << " iterations.");
}
// If we performed an odd number of iterations, we need to swap the x and currentX, because the newest result
@ -149,9 +149,9 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (converged) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << iterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge after " << iterations << " iterations.");
STORM_LOG_WARN("Iterative solver did not converge after " << iterations << " iterations.");
}
// If requested, we store the scheduler for retrieval.

6
src/solver/GurobiLpSolver.cpp

@ -26,7 +26,7 @@ namespace storm {
// Create the environment.
int error = GRBloadenv(&env, "");
if (error || env == nullptr) {
LOG4CPLUS_ERROR(logger, "Could not initialize Gurobi (" << GRBgeterrormsg(env) << ", error code " << error << ").");
STORM_LOG_ERROR("Could not initialize Gurobi (" << GRBgeterrormsg(env) << ", error code " << error << ").");
throw storm::exceptions::InvalidStateException() << "Could not initialize Gurobi environment (" << GRBgeterrormsg(env) << ", error code " << error << ").";
}
@ -36,7 +36,7 @@ namespace storm {
// Create the model.
error = GRBnewmodel(env, &model, name.c_str(), 0, nullptr, nullptr, nullptr, nullptr, nullptr);
if (error) {
LOG4CPLUS_ERROR(logger, "Could not initialize Gurobi model (" << GRBgeterrormsg(env) << ", error code " << error << ").");
STORM_LOG_ERROR("Could not initialize Gurobi model (" << GRBgeterrormsg(env) << ", error code " << error << ").");
throw storm::exceptions::InvalidStateException() << "Could not initialize Gurobi model (" << GRBgeterrormsg(env) << ", error code " << error << ").";
}
}
@ -346,7 +346,7 @@ namespace storm {
void GurobiLpSolver::writeModelToFile(std::string const& filename) const {
int error = GRBwrite(model, filename.c_str());
if (error) {
LOG4CPLUS_ERROR(logger, "Unable to write Gurobi model (" << GRBgeterrormsg(env) << ", error code " << error << ") to file.");
STORM_LOG_ERROR("Unable to write Gurobi model (" << GRBgeterrormsg(env) << ", error code " << error << ") to file.");
throw storm::exceptions::InvalidStateException() << "Unable to write Gurobi model (" << GRBgeterrormsg(env) << ", error code " << error << ") to file.";
}
}

8
src/solver/NativeMinMaxLinearEquationSolver.cpp

@ -65,9 +65,9 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (converged) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << iterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge after " << iterations << " iterations.");
STORM_LOG_WARN("Iterative solver did not converge after " << iterations << " iterations.");
}
// If we performed an odd number of iterations, we need to swap the x and currentX, because the newest result
@ -147,9 +147,9 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (converged) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << iterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << iterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converge after " << iterations << " iterations.");
STORM_LOG_WARN("Iterative solver did not converge after " << iterations << " iterations.");
}
// If requested, we store the scheduler for retrieval.

42
src/solver/TopologicalMinMaxLinearEquationSolver.cpp

@ -13,11 +13,7 @@
#include "src/settings/modules/NativeEquationSolverSettings.h"
#include "src/settings/modules/TopologicalValueIterationEquationSolverSettings.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
#include "storm-config.h"
#ifdef STORM_HAVE_CUDA
# include "cudaForStorm.h"
@ -73,10 +69,10 @@ namespace storm {
// For testing only
if (sizeof(ValueType) == sizeof(double)) {
//std::cout << "<<< Using CUDA-DOUBLE Kernels >>>" << std::endl;
LOG4CPLUS_INFO(logger, "<<< Using CUDA-DOUBLE Kernels >>>");
STORM_LOG_INFO("<<< Using CUDA-DOUBLE Kernels >>>");
} else {
//std::cout << "<<< Using CUDA-FLOAT Kernels >>>" << std::endl;
LOG4CPLUS_INFO(logger, "<<< Using CUDA-FLOAT Kernels >>>");
STORM_LOG_INFO("<<< Using CUDA-FLOAT Kernels >>>");
}
// Now, we need to determine the SCCs of the MDP and perform a topological sort.
@ -107,12 +103,12 @@ namespace storm {
} else {
result = __basicValueIteration_mvReduce_maximize<uint_fast64_t, ValueType>(this->maximalNumberOfIterations, this->precision, this->relative, A.rowIndications, A.columnsAndValues, x, b, nondeterministicChoiceIndices, globalIterations);
}
LOG4CPLUS_INFO(logger, "Executed " << globalIterations << " of max. " << maximalNumberOfIterations << " Iterations on GPU.");
STORM_LOG_INFO("Executed " << globalIterations << " of max. " << maximalNumberOfIterations << " Iterations on GPU.");
bool converged = false;
if (!result) {
converged = false;
LOG4CPLUS_ERROR(logger, "An error occurred in the CUDA Plugin. Can not continue.");
STORM_LOG_ERROR("An error occurred in the CUDA Plugin. Can not continue.");
throw storm::exceptions::InvalidStateException() << "An error occurred in the CUDA Plugin. Can not continue.";
} else {
converged = true;
@ -120,12 +116,12 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (converged) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << globalIterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << globalIterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converged after " << globalIterations << " iterations.");
STORM_LOG_WARN("Iterative solver did not converged after " << globalIterations << " iterations.");
}
#else
LOG4CPLUS_ERROR(logger, "The useGpu Flag of a SCC was set, but this version of StoRM does not support CUDA acceleration. Internal Error!");
STORM_LOG_ERROR("The useGpu Flag of a SCC was set, but this version of StoRM does not support CUDA acceleration. Internal Error!");
throw storm::exceptions::InvalidStateException() << "The useGpu Flag of a SCC was set, but this version of StoRM does not support CUDA acceleration. Internal Error!";
#endif
} else {
@ -139,7 +135,7 @@ namespace storm {
// Calculate the optimal distribution of sccs
std::vector<std::pair<bool, storm::storage::StateBlock>> optimalSccs = this->getOptimalGroupingFromTopologicalSccDecomposition(sccDecomposition, topologicalSort, this->A);
LOG4CPLUS_INFO(logger, "Optimized SCC Decomposition, originally " << topologicalSort.size() << " SCCs, optimized to " << optimalSccs.size() << " SCCs.");
STORM_LOG_INFO("Optimized SCC Decomposition, originally " << topologicalSort.size() << " SCCs, optimized to " << optimalSccs.size() << " SCCs.");
std::vector<ValueType>* currentX = nullptr;
std::vector<ValueType>* swap = nullptr;
@ -198,9 +194,9 @@ namespace storm {
#ifdef STORM_HAVE_CUDA
STORM_LOG_THROW(resetCudaDevice(), storm::exceptions::InvalidStateException, "Could not reset CUDA Device, can not use CUDA-based equation solver.");
//LOG4CPLUS_INFO(logger, "Device has " << getTotalCudaMemory() << " Bytes of Memory with " << getFreeCudaMemory() << "Bytes free (" << (static_cast<double>(getFreeCudaMemory()) / static_cast<double>(getTotalCudaMemory())) * 100 << "%).");
//LOG4CPLUS_INFO(logger, "We will allocate " << (sizeof(uint_fast64_t)* sccSubmatrix.rowIndications.size() + sizeof(uint_fast64_t)* sccSubmatrix.columnsAndValues.size() * 2 + sizeof(double)* sccSubX.size() + sizeof(double)* sccSubX.size() + sizeof(double)* sccSubB.size() + sizeof(double)* sccSubB.size() + sizeof(uint_fast64_t)* sccSubNondeterministicChoiceIndices.size()) << " Bytes.");
//LOG4CPLUS_INFO(logger, "The CUDA Runtime Version is " << getRuntimeCudaVersion());
//STORM_LOG_INFO("Device has " << getTotalCudaMemory() << " Bytes of Memory with " << getFreeCudaMemory() << "Bytes free (" << (static_cast<double>(getFreeCudaMemory()) / static_cast<double>(getTotalCudaMemory())) * 100 << "%).");
//STORM_LOG_INFO("We will allocate " << (sizeof(uint_fast64_t)* sccSubmatrix.rowIndications.size() + sizeof(uint_fast64_t)* sccSubmatrix.columnsAndValues.size() * 2 + sizeof(double)* sccSubX.size() + sizeof(double)* sccSubX.size() + sizeof(double)* sccSubB.size() + sizeof(double)* sccSubB.size() + sizeof(uint_fast64_t)* sccSubNondeterministicChoiceIndices.size()) << " Bytes.");
//STORM_LOG_INFO("The CUDA Runtime Version is " << getRuntimeCudaVersion());
bool result = false;
localIterations = 0;
@ -209,11 +205,11 @@ namespace storm {
} else {
result = __basicValueIteration_mvReduce_maximize<uint_fast64_t, ValueType>(this->maximalNumberOfIterations, this->precision, this->relative, sccSubmatrix.rowIndications, sccSubmatrix.columnsAndValues, *currentX, sccSubB, sccSubNondeterministicChoiceIndices, localIterations);
}
LOG4CPLUS_INFO(logger, "Executed " << localIterations << " of max. " << maximalNumberOfIterations << " Iterations on GPU.");
STORM_LOG_INFO("Executed " << localIterations << " of max. " << maximalNumberOfIterations << " Iterations on GPU.");
if (!result) {
converged = false;
LOG4CPLUS_ERROR(logger, "An error occurred in the CUDA Plugin. Can not continue.");
STORM_LOG_ERROR("An error occurred in the CUDA Plugin. Can not continue.");
throw storm::exceptions::InvalidStateException() << "An error occurred in the CUDA Plugin. Can not continue.";
} else {
converged = true;
@ -226,12 +222,12 @@ namespace storm {
}
globalIterations += localIterations;
#else
LOG4CPLUS_ERROR(logger, "The useGpu Flag of a SCC was set, but this version of StoRM does not support CUDA acceleration. Internal Error!");
STORM_LOG_ERROR("The useGpu Flag of a SCC was set, but this version of StoRM does not support CUDA acceleration. Internal Error!");
throw storm::exceptions::InvalidStateException() << "The useGpu Flag of a SCC was set, but this version of StoRM does not support CUDA acceleration. Internal Error!";
#endif
} else {
//std::cout << "WARNING: Using CPU based TopoSolver! (double)" << std::endl;
LOG4CPLUS_INFO(logger, "Performance Warning: Using CPU based TopoSolver! (double)");
STORM_LOG_INFO("Performance Warning: Using CPU based TopoSolver! (double)");
localIterations = 0;
converged = false;
while (!converged && localIterations < this->maximalNumberOfIterations) {
@ -263,7 +259,7 @@ namespace storm {
++localIterations;
++globalIterations;
}
LOG4CPLUS_INFO(logger, "Executed " << localIterations << " of max. " << this->maximalNumberOfIterations << " Iterations.");
STORM_LOG_INFO("Executed " << localIterations << " of max. " << this->maximalNumberOfIterations << " Iterations.");
}
@ -289,9 +285,9 @@ namespace storm {
// Check if the solver converged and issue a warning otherwise.
if (converged) {
LOG4CPLUS_INFO(logger, "Iterative solver converged after " << currentMaxLocalIterations << " iterations.");
STORM_LOG_INFO("Iterative solver converged after " << currentMaxLocalIterations << " iterations.");
} else {
LOG4CPLUS_WARN(logger, "Iterative solver did not converged after " << currentMaxLocalIterations << " iterations.");
STORM_LOG_WARN("Iterative solver did not converged after " << currentMaxLocalIterations << " iterations.");
}
}
}

2
src/storage/ModelFormulasPair.h

@ -1,6 +1,6 @@
#pragma once
#include "../models/ModelBase.h"
#include <vector>
namespace storm {
namespace logic {

4
src/storage/SparseMatrix.cpp

@ -22,10 +22,6 @@
#include "src/utility/macros.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
namespace storm {
namespace storage {

12
src/utility/ErrorHandling.h

@ -49,7 +49,7 @@ std::string demangle(char const* symbol) {
if (!SymInitialize(hProcess, NULL, TRUE)) {
// SymInitialize failed
error = GetLastError();
LOG4CPLUS_ERROR(logger, "SymInitialize returned error : " << error);
STORM_LOG_ERROR("SymInitialize returned error : " << error);
return FALSE;
} else {
char demangled[1024];
@ -58,7 +58,7 @@ std::string demangle(char const* symbol) {
} else {
// UnDecorateSymbolName failed
DWORD error = GetLastError();
LOG4CPLUS_ERROR(logger, "UnDecorateSymbolName returned error: " << error);
STORM_LOG_ERROR("UnDecorateSymbolName returned error: " << error);
}
}
#endif
@ -87,7 +87,7 @@ void printUsage();
* @param sig The code of the signal that needs to be handled.
*/
void signalHandler(int sig) {
LOG4CPLUS_FATAL(logger, "The program received signal " << sig << ". The following backtrace shows the status upon reception of the signal.");
STORM_LOG_ERROR("The program received signal " << sig << ". The following backtrace shows the status upon reception of the signal.");
printUsage();
#ifndef WINDOWS
# define SIZE 128
@ -106,13 +106,13 @@ void signalHandler(int sig) {
// Starting this for-loop at j=2 means that we skip the handler itself. Currently this is not
// done.
for (int j = 1; j < nptrs; j++) {
LOG4CPLUS_FATAL(logger, nptrs-j << ": " << demangle(strings[j]));
STORM_LOG_ERROR(nptrs-j << ": " << demangle(strings[j]));
}
free(strings);
#else
LOG4CPLUS_WARN(logger, "No Backtrace Support available on Platform Windows!");
STORM_LOG_WARN("No Backtrace Support available on Platform Windows!");
#endif
LOG4CPLUS_FATAL(logger, "Exiting.");
STORM_LOG_ERROR("Exiting.");
exit(2);
}

14
src/utility/cstring.cpp

@ -3,11 +3,7 @@
#include <cstring>
#include "src/exceptions/WrongFormatException.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
namespace utility {
@ -25,8 +21,8 @@ namespace cstring {
uint_fast64_t checked_strtol(char const* str, char const** end) {
uint_fast64_t res = strtol(str, const_cast<char**>(end), 10);
if (str == *end) {
LOG4CPLUS_ERROR(logger, "Error while parsing integer. Next input token is not a number.");
LOG4CPLUS_ERROR(logger, "\tUpcoming input is: \"" << std::string(str, 0, 16) << "\"");
STORM_LOG_ERROR("Error while parsing integer. Next input token is not a number.");
STORM_LOG_ERROR("\tUpcoming input is: \"" << std::string(str, 0, 16) << "\"");
throw storm::exceptions::WrongFormatException("Error while parsing integer. Next input token is not a number.");
}
return res;
@ -43,8 +39,8 @@ uint_fast64_t checked_strtol(char const* str, char const** end) {
double checked_strtod(char const* str, char const** end) {
double res = strtod(str, const_cast<char**>(end));
if (str == *end) {
LOG4CPLUS_ERROR(logger, "Error while parsing floating point. Next input token is not a number.");
LOG4CPLUS_ERROR(logger, "\tUpcoming input is: \"" << std::string(str, 0, 16) << "\"");
STORM_LOG_ERROR("Error while parsing floating point. Next input token is not a number.");
STORM_LOG_ERROR("\tUpcoming input is: \"" << std::string(str, 0, 16) << "\"");
throw storm::exceptions::WrongFormatException("Error while parsing floating point. Next input token is not a number.");
}
return res;

12
src/utility/graph.cpp

@ -16,11 +16,7 @@
#include "src/storage/dd/Bdd.h"
#include "src/storage/dd/Add.h"
#include "src/storage/dd/DdManager.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
#include "src/utility/macros.h"
namespace storm {
namespace utility {
@ -829,7 +825,7 @@ namespace storm {
template <typename T>
std::vector<uint_fast64_t> getTopologicalSort(storm::storage::SparseMatrix<T> const& matrix) {
if (matrix.getRowCount() != matrix.getColumnCount()) {
LOG4CPLUS_ERROR(logger, "Provided matrix is required to be square.");
STORM_LOG_ERROR("Provided matrix is required to be square.");
throw storm::exceptions::InvalidArgumentException() << "Provided matrix is required to be square.";
}
@ -903,7 +899,7 @@ namespace storm {
storm::storage::BitVector const& startingStates,
storm::storage::BitVector const* filterStates) {
LOG4CPLUS_INFO(logger, "Performing Dijkstra search.");
STORM_LOG_INFO("Performing Dijkstra search.");
const uint_fast64_t noPredecessorValue = storm::utility::zero<uint_fast64_t>();
std::vector<T> probabilities(model.getNumberOfStates(), storm::utility::zero<T>());
@ -949,7 +945,7 @@ namespace storm {
std::pair<std::vector<T>, std::vector<uint_fast64_t>> result;
result.first = std::move(probabilities);
result.second = std::move(predecessors);
LOG4CPLUS_INFO(logger, "Done performing Dijkstra search.");
STORM_LOG_INFO("Done performing Dijkstra search.");
return result;
}

14
src/utility/initialize.cpp

@ -5,18 +5,29 @@
#include "src/settings/modules/DebugSettings.h"
#ifdef STORM_LOGGING_FRAMEWORK
#include "log4cplus/consoleappender.h"
#include "log4cplus/fileappender.h"
log4cplus::Logger logger;
log4cplus::Logger printer;
#else
int storm_runtime_loglevel = STORM_LOGLEVEL_WARN;
#endif
namespace storm {
namespace utility {
void initializeLogger() {
#ifdef STORM_LOGGING_FRAMEWORK
auto loglevel = storm::settings::debugSettings().isTraceSet() ? log4cplus::TRACE_LOG_LEVEL : storm::settings::debugSettings().isDebugSet() ? log4cplus::DEBUG_LOG_LEVEL : log4cplus::WARN_LOG_LEVEL;
initializeLogger(loglevel);
#endif
}
#ifdef STORM_LOGGING_FRAMEWORK
void initializeLogger(log4cplus::LogLevel const& loglevel) {
logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
log4cplus::SharedAppenderPtr consoleLogAppender(new log4cplus::ConsoleAppender());
@ -26,6 +37,7 @@ namespace storm {
logger.setLogLevel(loglevel);
consoleLogAppender->setThreshold(loglevel);
}
#endif
void setUp() {
initializeLogger();
@ -37,10 +49,12 @@ namespace storm {
}
void initializeFileLogging() {
#ifdef STORM_LOGGING_FRAMEWORK
log4cplus::SharedAppenderPtr fileLogAppender(new log4cplus::FileAppender(storm::settings::debugSettings().getLogfilename()));
fileLogAppender->setName("mainFileAppender");
fileLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M:%S} (%r ms) - %F:%L: %m%n")));
logger.addAppender(fileLogAppender);
#endif
}
}

7
src/utility/initialize.h

@ -4,10 +4,6 @@
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
#include "log4cplus/consoleappender.h"
#include "log4cplus/fileappender.h"
#include "macros.h"
#include "src/settings/SettingsManager.h"
@ -19,8 +15,9 @@ namespace storm {
* Initializes the logging framework and sets up logging to console.
*/
void initializeLogger();
#ifdef STORM_LOGGING_FRAMEWORK
void initializeLogger(log4cplus::LogLevel const&);
#endif
/*!
* Performs some necessary initializations.
*/

179
src/utility/macros.h

@ -2,12 +2,165 @@
#define STORM_UTILITY_MACROS_H_
#include <cassert>
#include "storm-config.h"
#ifndef STORM_LOGGING_FRAMEWORK
#include <iostream>
#include <sstream>
extern int storm_runtime_loglevel;
#define STORM_LOGLEVEL_ERROR 0
#define STORM_LOGLEVEL_WARN 1
#define STORM_LOGLEVEL_INFO 2
#define STORM_LOGLEVEL_DEBUG 3
#define STORM_LOGLEVEL_TRACE 4
#ifdef STORM_LOG_DISABLE_DEBUG
#define STORM_LOG_DISABLE_TRACE
#endif
#define __SHORT_FORM_OF_FILE__ \
(strrchr(__FILE__,'/') \
? strrchr(__FILE__,'/')+1 \
: __FILE__ \
)
#ifndef STORM_LOG_DISABLE_DEBUG
#define STORM_LOG_DEBUG(message) \
do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_DEBUG) { \
std::stringstream __ss; \
__ss << message; \
std::cout << "DEBUG (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << __ss.str() << std::endl; \
} \
} while (false)
#else
#define STORM_LOG_DEBUG(message) \
do { \
} while (false)
#endif
#ifndef STORM_LOG_DISABLE_TRACE
#define STORM_LOG_TRACE(message) \
do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_TRACE) { \
std::stringstream __ss; \
__ss << message; \
std::cout << "TRACE (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << __ss.str() << std::endl; \
} \
} while(false)
#else
#define STORM_LOG_TRACE(message) \
do { \
} while (false)
#endif
// Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set.
#ifndef NDEBUG
#define STORM_LOG_ASSERT(cond, message) \
do { \
if (!(cond)) { \
std::cout << "ASSERT FAILED (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << message << std::endl; \
assert(cond); \
} \
} while (false)
#else
#define STORM_LOG_ASSERT(cond, message)
#endif
// Define STORM_LOG_THROW to always throw the exception with the given message if the condition fails to hold.
#define STORM_LOG_THROW(cond, exception, message) \
do { \
if (!(cond)) { \
std::cout << "ERROR (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << message << std::endl; \
throw exception() << message; \
} \
} while (false)
// Define STORM_LOG_WARN, STORM_LOG_ERROR and STORM_LOG_INFO to log the given message with the corresponding log levels.
#define STORM_LOG_WARN(message) \
do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_WARN) { \
std::stringstream __ss; \
__ss << message; \
std::cout << "WARN (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << __ss.str() << std::endl; \
} \
} while (false)
#define STORM_LOG_WARN_COND(cond, message) \
do { \
if (!(cond)) { \
STORM_LOG_WARN(message); \
} \
} while (false)
#define STORM_LOG_INFO(message) \
do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_INFO) { \
std::stringstream __ss; \
__ss << message; \
std::cout << "INFO (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << __ss.str() << std::endl; \
} \
} while (false)
#define STORM_LOG_INFO_COND(cond, message) \
do { \
if (!(cond)) { \
STORM_LOG_INFO(message); \
} \
} while (false)
#define STORM_LOG_ERROR(message) \
do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_ERROR) { \
std::stringstream __ss; \
__ss << message; \
std::cout << "ERROR (" << __SHORT_FORM_OF_FILE__ << ":" << __LINE__ << "): " << __ss.str() << std::endl; \
} \
} while (false) \
#define STORM_LOG_ERROR_COND(cond, message) \
do { \
if (!(cond)) { \
STORM_LOG_ERROR(message); \
} \
} while (false) \
#define STORM_GLOBAL_LOGLEVEL_INFO() \
do { \
storm_runtime_loglevel = STORM_LOGLEVEL_INFO; \
} while (false)
#ifndef STORM_LOG_DISABLE_DEBUG
#define STORM_GLOBAL_LOGLEVEL_DEBUG() \
do { \
storm_runtime_loglevel = STORM_LOGLEVEL_DEBUG; \
} while(false)
#else
#define STORM_GLOBAL_LOGLEVEL_DEBUG() \
std::cout << "***** warning ***** loglevel debug is not compiled\n"
#endif
#ifndef STORM_LOG_DISABLE_TRACE
#define STORM_GLOBAL_LOGLEVEL_TRACE() \
do { \
storm_runtime_loglevel = STORM_LOGLEVEL_TRACE; \
} while(false)
#else
#define STORM_GLOBAL_LOGLEVEL_TRACE() \
std::cout << "***** warning ***** loglevel trace is not compiled\n"
#endif
#else
// Include the parts necessary for Log4cplus.
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger;
/*!
* Define the macros STORM_LOG_DEBUG and STORM_LOG_TRACE.
*/
@ -81,6 +234,30 @@ do { \
} \
} while (false) \
#define STORM_GLOBAL_LOGLEVEL_INFO() \
do { \
logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::INFO_LOG_LEVEL); \
LOG4CPLUS_INFO(logger, "Enabled verbose mode, log output gets printed to console."); \
} while (false)
#define STORM_GLOBAL_LOGLEVEL_DEBUG() \
do { \
logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); \
logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::DEBUG_LOG_LEVEL); \
LOG4CPLUS_INFO(logger, "Enabled very verbose mode, log output gets printed to console."); \
} while(false)
#define STORM_GLOBAL_LOGLEVEL_TRACE() \
do { \
logger.setLogLevel(log4cplus::TRACE_LOG_LEVEL); \
logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::TRACE_LOG_LEVEL); \
LOG4CPLUS_INFO(logger, "Enabled trace mode, log output gets printed to console."); \
} while(false)
#endif
/*!
* Define the macros that print information and optionally also log it.
*/

3
storm-config.h.in

@ -44,5 +44,8 @@
// Whether smtrat is available and to be used.
#cmakedefine STORM_HAVE_SMTRAT
#cmakedefine STORM_LOGGING_FRAMEWORK
#cmakedefine STORM_LOG_DISABLE_DEBUG
#endif // STORM_GENERATED_STORMCONFIG_H_

17
test/functional/storm-functional-tests.cpp

@ -2,21 +2,25 @@
#include <list>
#include <string>
#include "storm-config.h"
#include "gtest/gtest.h"
#ifdef STORM_LOGGING_FRAMEWORK
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
#include "log4cplus/consoleappender.h"
#include "log4cplus/fileappender.h"
#include "storm-config.h"
#include "src/settings/SettingsManager.h"
log4cplus::Logger logger;
#endif
#include "src/settings/SettingsManager.h"
/*!
* Initializes the logging framework.
*/
void setUpLogging() {
#ifdef STORM_LOGGING_FRAMEWORK
logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
logger.setLogLevel(log4cplus::ERROR_LOG_LEVEL);
log4cplus::SharedAppenderPtr fileLogAppender(new log4cplus::FileAppender("storm-functional-tests.log"));
@ -24,7 +28,7 @@ void setUpLogging() {
fileLogAppender->setThreshold(log4cplus::FATAL_LOG_LEVEL);
fileLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M} (%r ms) - %F:%L : %m%n")));
logger.addAppender(fileLogAppender);
#endif
// Uncomment these lines to enable console logging output
// log4cplus::SharedAppenderPtr consoleLogAppender(new log4cplus::ConsoleAppender());
// consoleLogAppender->setName("mainConsoleAppender");
@ -39,9 +43,10 @@ int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
#ifdef STORM_LOGGING_FRAMEWORK
logger.closeNestedAppenders();
#endif
std::list<std::string> untestedModules;
#ifndef STORM_HAVE_GUROBI
untestedModules.push_back("Gurobi");

2
test/performance/modelchecker/GmmxxDtmcPrctModelCheckerTest.cpp

@ -78,7 +78,7 @@ TEST(GmmxxDtmcPrctlModelCheckerTest, SynchronousLeader) {
EXPECT_NEAR(0.9993949793, quantitativeResult2[0], storm::settings::gmmxxEquationSolverSettings().getPrecision());
labelFormula = std::make_shared<storm::logic::AtomicLabelFormula>("elected");
auto reachabilityRewardFormula = std::make_shared<storm::logic::ReachabilityRewardFormula>(labelFormula);
auto reachabilityRewardFormula = std::make_shared<storm::logic::EventuallyFormula>(labelFormula, storm::logic::FormulaContext::Reward);
result = checker.check(*reachabilityRewardFormula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult3 = result->asExplicitQuantitativeCheckResult<double>();

2
test/performance/modelchecker/NativeDtmcPrctlModelCheckerTest.cpp

@ -79,7 +79,7 @@ TEST(NativeDtmcPrctlModelCheckerTest, SynchronousLeader) {
EXPECT_NEAR(0.9993949793, quantitativeResult2[0], storm::settings::gmmxxEquationSolverSettings().getPrecision());
labelFormula = std::make_shared<storm::logic::AtomicLabelFormula>("elected");
auto reachabilityRewardFormula = std::make_shared<storm::logic::ReachabilityRewardFormula>(labelFormula);
auto reachabilityRewardFormula = std::make_shared<storm::logic::EventuallyFormula>(labelFormula, storm::logic::FormulaContext::Reward);
result = checker.check(*reachabilityRewardFormula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult3 = result->asExplicitQuantitativeCheckResult<double>();

14
test/performance/storm-performance-tests.cpp

@ -1,19 +1,24 @@
#include <iostream>
#include "gtest/gtest.h"
#include "storm-config.h"
#include "src/settings/SettingsManager.h"
#ifdef STORM_LOGGING_FRAMEWORK
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
#include "log4cplus/consoleappender.h"
#include "log4cplus/fileappender.h"
#include "src/settings/SettingsManager.h"
log4cplus::Logger logger;
#endif
/*!
* Initializes the logging framework.
*/
void setUpLogging() {
#ifdef STORM_LOGGING_FRAMEWORK
logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
logger.setLogLevel(log4cplus::WARN_LOG_LEVEL);
log4cplus::SharedAppenderPtr fileLogAppender(new log4cplus::FileAppender("storm-performance-tests.log"));
@ -21,7 +26,7 @@ void setUpLogging() {
fileLogAppender->setThreshold(log4cplus::WARN_LOG_LEVEL);
fileLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M} (%r ms) - %F:%L : %m%n")));
logger.addAppender(fileLogAppender);
#endif
// Uncomment these lines to enable console logging output
// log4cplus::SharedAppenderPtr consoleLogAppender(new log4cplus::ConsoleAppender());
// consoleLogAppender->setName("mainConsoleAppender");
@ -36,7 +41,8 @@ int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
#ifdef STORM_LOGGING_FRAMEWORK
logger.closeNestedAppenders();
#endif
return result;
}
|||||||
100:0
Loading…
Cancel
Save