Browse Source
moved some internal structs from model builder to their own files to make them reusable
moved some internal structs from model builder to their own files to make them reusable
Former-commit-id: a354059fe8
main
9 changed files with 167 additions and 99 deletions
-
66src/builder/ExplicitPrismModelBuilder.cpp
-
51src/builder/ExplicitPrismModelBuilder.h
-
23src/modelchecker/reachability/SparseMdpLearningModelChecker.cpp
-
13src/modelchecker/reachability/SparseMdpLearningModelChecker.h
-
13src/models/sparse/StateAnnotation.h
-
15src/storage/sparse/StateStorage.cpp
-
35src/storage/sparse/StateStorage.h
-
17src/storage/sparse/StateValuations.cpp
-
33src/storage/sparse/StateValuations.h
@ -1,16 +1,19 @@ |
|||
#ifndef STORM_STATEANNOTATION_H |
|||
#define STORM_STATEANNOTATION_H |
|||
#ifndef STORM_MODELS_SPARSE_STATEANNOTATION_H_ |
|||
#define STORM_MODELS_SPARSE_STATEANNOTATION_H_ |
|||
|
|||
#include "src/storage/sparse/StateType.h" |
|||
|
|||
namespace storm { |
|||
namespace models { |
|||
namespace sparse { |
|||
|
|||
class StateAnnotation { |
|||
public: |
|||
virtual std::string stateInfo(uint_fast64_t s) const = 0; |
|||
virtual std::string stateInfo(storm::storage::sparse::state_type const& state) const = 0; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
#endif //STORM_STATEANNOTATION_H |
|||
#endif /* STORM_MODELS_SPARSE_STATEANNOTATION_H_ */ |
@ -0,0 +1,15 @@ |
|||
#include "src/storage/sparse/StateStorage.h"
|
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
namespace sparse { |
|||
|
|||
template <typename StateType> |
|||
StateStorage<StateType>::StateStorage(uint64_t bitsPerState) : stateToId(bitsPerState, 10000000), initialStateIndices(), bitsPerState(bitsPerState), numberOfStates() { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
template class StateStorage<uint32_t>; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
#ifndef STORM_STORAGE_SPARSE_STATESTORAGE_H_ |
|||
#define STORM_STORAGE_SPARSE_STATESTORAGE_H_ |
|||
|
|||
#include <cstdint> |
|||
|
|||
#include "src/storage/BitVectorHashMap.h" |
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
namespace sparse { |
|||
|
|||
// A structure holding information about the reachable state space while building it. |
|||
template <typename StateType> |
|||
struct StateStorage { |
|||
// Creates an empty state storage structure for storing states of the given bit width. |
|||
StateStorage(uint64_t bitsPerState); |
|||
|
|||
// This member stores all the states and maps them to their unique indices. |
|||
storm::storage::BitVectorHashMap<StateType> stateToId; |
|||
|
|||
// A list of initial states in terms of their global indices. |
|||
std::vector<StateType> initialStateIndices; |
|||
|
|||
// The number of bits of each state. |
|||
uint64_t bitsPerState; |
|||
|
|||
// The number of states that were found in the exploration so far. |
|||
uint_fast64_t numberOfStates; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* STORM_STORAGE_SPARSE_STATESTORAGE_H_ */ |
@ -0,0 +1,17 @@ |
|||
#include "src/storage/sparse/StateValuations.h"
|
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
namespace sparse { |
|||
|
|||
StateValuations::StateValuations(state_type const& numberOfStates) : valuations(numberOfStates) { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
std::string StateValuations::stateInfo(state_type const& state) const { |
|||
return valuations[state].toString(); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
#ifndef STORM_STORAGE_SPARSE_STATEVALUATIONS_H_ |
|||
#define STORM_STORAGE_SPARSE_STATEVALUATIONS_H_ |
|||
|
|||
#include <cstdint> |
|||
#include <string> |
|||
|
|||
#include "src/storage/sparse/StateType.h" |
|||
#include "src/storage/expressions/SimpleValuation.h" |
|||
|
|||
#include "src/models/sparse/StateAnnotation.h" |
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
namespace sparse { |
|||
|
|||
// A structure holding information about the reachable state space that can be retrieved from the outside. |
|||
struct StateValuations : public storm::models::sparse::StateAnnotation { |
|||
/*! |
|||
* Constructs a state information object for the given number of states. |
|||
*/ |
|||
StateValuations(state_type const& numberOfStates); |
|||
|
|||
// A mapping from state indices to their variable valuations. |
|||
std::vector<storm::expressions::SimpleValuation> valuations; |
|||
|
|||
virtual std::string stateInfo(state_type const& state) const override; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* STORM_STORAGE_SPARSE_STATEVALUATIONS_H_ */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue