Browse Source

refined output of deadlock states a bit

Former-commit-id: 4262871295
tempestpy_adaptions
dehnert 9 years ago
parent
commit
36b67a3a38
  1. 4
      src/builder/DdPrismModelBuilder.cpp
  2. 18
      src/storage/expressions/SimpleValuation.cpp
  3. 10
      src/storage/expressions/SimpleValuation.h

4
src/builder/DdPrismModelBuilder.cpp

@ -1055,11 +1055,11 @@ namespace storm {
if (!deadlockStates.isZero()) {
// If we need to fix deadlocks, we do so now.
if (!storm::settings::generalSettings().isDontFixDeadlocksSet()) {
STORM_LOG_WARN("Fixing deadlocks in " << deadlockStates.getNonZeroCount() << " states. For example in");
STORM_LOG_INFO("Fixing deadlocks in " << deadlockStates.getNonZeroCount() << " states. The first three of these states are: ");
uint_fast64_t count = 0;
for (auto it = deadlockStates.begin(), ite = deadlockStates.end(); it != ite && count < 3; ++it, ++count) {
STORM_LOG_WARN((*it).first.toPrettyString() << std::endl);
STORM_LOG_INFO((*it).first.toPrettyString(generationInfo.rowMetaVariables) << std::endl);
}
if (program.getModelType() == storm::prism::Program::ModelType::DTMC) {

18
src/storage/expressions/SimpleValuation.cpp

@ -91,17 +91,17 @@ namespace storm {
rationalValues[rationalVariable.getOffset()] = value;
}
std::string SimpleValuation::toPrettyString() const {
std::string SimpleValuation::toPrettyString(std::set<storm::expressions::Variable> const& selectedVariables) const {
std::vector<std::string> assignments;
for (auto const& variable : this->getManager()) {
for (auto const& variable : selectedVariables) {
std::stringstream stream;
stream << variable.first.getName() << "=";
if (variable.second.isBooleanType()) {
stream << std::boolalpha << this->getBooleanValue(variable.first) << std::noboolalpha;
} else if (variable.second.isIntegerType()) {
stream << this->getIntegerValue(variable.first);
} else if (variable.second.isRationalType()) {
stream << this->getRationalValue(variable.first);
stream << variable.getName() << "=";
if (variable.hasBooleanType()) {
stream << std::boolalpha << this->getBooleanValue(variable) << std::noboolalpha;
} else if (variable.hasIntegerType()) {
stream << this->getIntegerValue(variable);
} else if (variable.hasRationalType()) {
stream << this->getRationalValue(variable);
} else {
STORM_LOG_THROW(false, storm::exceptions::InvalidTypeException, "Unexpected variable type.");
}

10
src/storage/expressions/SimpleValuation.h

@ -3,7 +3,7 @@
#include <cstdint>
#include <vector>
#include <iostream>
#include <set>
#include "src/storage/expressions/Valuation.h"
@ -54,7 +54,13 @@ namespace storm {
virtual double getRationalValue(Variable const& rationalVariable) const override;
virtual void setRationalValue(Variable const& rationalVariable, double value) override;
virtual std::string toPrettyString() const;
/*!
* Returns a string representation of the valuation of the selected variables.
*
* @param selectedVariables The variables to select.
* @return The string representation.
*/
virtual std::string toPrettyString(std::set<storm::expressions::Variable> const& selectedVariables) const;
friend std::ostream& operator<<(std::ostream& out, SimpleValuation const& valuation);

Loading…
Cancel
Save