Browse Source

ksp: forward-declare model

tempestpy_adaptions
Tom Janson 8 years ago
parent
commit
2f7f5eb212
  1. 10
      src/storm/utility/shortestPaths.cpp
  2. 35
      src/storm/utility/shortestPaths.h

10
src/storm/utility/shortestPaths.cpp

@ -2,11 +2,12 @@
#include <set>
#include <string>
#include "storm/models/sparse/Model.h"
#include "storm/models/sparse/StandardRewardModel.h"
#include "storm/storage/sparse/StateType.h"
#include "storm/utility/graph.h"
#include "storm/utility/macros.h"
#include "storm/utility/shortestPaths.h"
#include "storm/utility/graph.h"
#include "storm/models/sparse/StandardRewardModel.h"
// FIXME: I've accidentally used k=0 *twice* now without realizing that k>=1 is required!
// Accessing zero should trigger a warning!
@ -177,7 +178,6 @@ namespace storm {
}
} else {
// node only has one "virtual edge" (with prob as per targetProbMap) to meta-target
// FIXME: double check
T alternateDistance = shortestPathDistances[currentNode] * targetProbMap[currentNode];
if (alternateDistance > shortestPathDistances[metaTarget]) {
shortestPathDistances[metaTarget] = alternateDistance;
@ -252,7 +252,7 @@ namespace storm {
} else {
// edge must be "virtual edge" to meta-target
assert(isMetaTargetPredecessor(tailNode));
return targetProbMap.at(tailNode); // FIXME double check
return targetProbMap.at(tailNode);
}
}

35
src/storm/utility/shortestPaths.h

@ -1,26 +1,33 @@
#ifndef STORM_UTIL_SHORTESTPATHS_H_
#define STORM_UTIL_SHORTESTPATHS_H_
#include <unordered_set>
#include <vector>
#include <boost/optional/optional.hpp>
#include <unordered_set>
#include "storm/models/sparse/Model.h"
#include "storm/storage/sparse/StateType.h"
#include "constants.h"
#include "storm/storage/BitVector.h"
namespace storm {
namespace storage {
template<typename ValueType>
class SparseMatrix;
// NOTE: You'll (eventually) find the usual API documentation below;
// for more information about the purpose, design decisions,
// etc., you may consult `shortestPath.md`. - Tom
namespace sparse {
typedef uint_fast64_t state_type;
}
}
// TODO: test whether using BitVector instead of vector<state_t> is
// faster for storing predecessors etc.
namespace models {
namespace sparse {
template<typename ValueType>
class StandardRewardModel;
// Now using BitVectors instead of vector<state_t> in the API because
// BitVectors are used throughout Storm to represent a (unordered) list
// of states.
// (Even though both initialStates and targets are probably very sparse.)
template<class CValueType, class CRewardModelType>
class Model;
}
}
namespace storm {
namespace utility {
namespace ksp {
using state_t = storage::sparse::state_type;
@ -60,7 +67,7 @@ namespace storm {
public:
using Matrix = storage::SparseMatrix<T>;
using StateProbMap = std::unordered_map<state_t, T>;
using Model = models::sparse::Model<T>;
using Model = models::sparse::Model<T, models::sparse::StandardRewardModel<T>>;
/*!
* Performs precomputations (including meta-target insertion and Dijkstra).

Loading…
Cancel
Save