Browse Source

add Path stream print for debug / Python __str__

tempestpy_adaptions
Tom Janson 8 years ago
parent
commit
ee510df4ec
  1. 11
      src/storm/utility/shortestPaths.cpp
  2. 3
      src/storm/utility/shortestPaths.h

11
src/storm/utility/shortestPaths.cpp

@ -1,3 +1,4 @@
#include <ostream>
#include <queue>
#include <set>
#include <string>
@ -373,6 +374,16 @@ namespace storm {
template class ShortestPathsGenerator<double>;
// only prints the info stored in the Path struct;
// does not traverse the actual path (see printKShortestPath for that)
template <typename T>
std::ostream& operator<<(std::ostream& out, Path<T> const& p) {
out << "Path with predecessorNode: " << ((p.predecessorNode) ? std::to_string(p.predecessorNode.get()) : "None");
out << " predecessorK: " << p.predecessorK << " distance: " << p.distance;
return out;
}
template std::ostream& operator<<(std::ostream& out, Path<double> const& p);
}
}
}

3
src/storm/utility/shortestPaths.h

@ -55,6 +55,9 @@ namespace storm {
}
};
template <typename T>
std::ostream& operator<<(std::ostream& out, Path<T> const& p);
// when using the raw matrix/vector invocation, this enum parameter
// forces the caller to declare whether the matrix has the evil I-P
// format, which requires back-conversion of the entries

Loading…
Cancel
Save