Browse Source

prism next state generator, rename actions to reflect labeled choices vs unlabeled choices are sync vs async

tempestpy_adaptions
Sebastian Junges 4 years ago
parent
commit
d144a1776c
  1. 16
      src/storm/generator/PrismNextStateGenerator.cpp
  2. 13
      src/storm/generator/PrismNextStateGenerator.h
  3. 10
      src/storm/storage/prism/Program.h

16
src/storm/generator/PrismNextStateGenerator.cpp

@ -296,16 +296,16 @@ namespace storm {
std::vector<Choice<ValueType>> allChoices;
if (this->getOptions().isApplyMaximalProgressAssumptionSet()) {
// First explore only edges without a rate
allChoices = getUnlabeledChoices(*this->state, stateToIdCallback, CommandFilter::Probabilistic);
addLabeledChoices(allChoices, *this->state, stateToIdCallback, CommandFilter::Probabilistic);
allChoices = getAsynchronousChoices(*this->state, stateToIdCallback, CommandFilter::Probabilistic);
addSynchronousChoices(allChoices, *this->state, stateToIdCallback, CommandFilter::Probabilistic);
if (allChoices.empty()) {
// Expand the Markovian edges if there are no probabilistic ones.
allChoices = getUnlabeledChoices(*this->state, stateToIdCallback, CommandFilter::Markovian);
addLabeledChoices(allChoices, *this->state, stateToIdCallback, CommandFilter::Markovian);
allChoices = getAsynchronousChoices(*this->state, stateToIdCallback, CommandFilter::Markovian);
addSynchronousChoices(allChoices, *this->state, stateToIdCallback, CommandFilter::Markovian);
}
} else {
allChoices = getUnlabeledChoices(*this->state, stateToIdCallback);
addLabeledChoices(allChoices, *this->state, stateToIdCallback);
allChoices = getAsynchronousChoices(*this->state, stateToIdCallback);
addSynchronousChoices(allChoices, *this->state, stateToIdCallback);
}
std::size_t totalNumberOfChoices = allChoices.size();
@ -538,7 +538,7 @@ namespace storm {
}
template<typename ValueType, typename StateType>
std::vector<Choice<ValueType>> PrismNextStateGenerator<ValueType, StateType>::getUnlabeledChoices(CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter) {
std::vector<Choice<ValueType>> PrismNextStateGenerator<ValueType, StateType>::getAsynchronousChoices(CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter) {
std::vector<Choice<ValueType>> result;
// Iterate over all modules.
@ -650,7 +650,7 @@ namespace storm {
}
template<typename ValueType, typename StateType>
void PrismNextStateGenerator<ValueType, StateType>::addLabeledChoices(std::vector<Choice<ValueType>>& choices, CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter) {
void PrismNextStateGenerator<ValueType, StateType>::addSynchronousChoices(std::vector<Choice<ValueType>>& choices, CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter) {
for (uint_fast64_t actionIndex : program.getSynchronizingActionIndices()) {
if (this->actionMask != nullptr) {

13
src/storm/generator/PrismNextStateGenerator.h

@ -86,21 +86,22 @@ namespace storm {
boost::optional<std::vector<std::vector<std::reference_wrapper<storm::prism::Command const>>>> getActiveCommandsByActionIndex(uint_fast64_t const& actionIndex, CommandFilter const& commandFilter = CommandFilter::All);
/*!
* Retrieves all unlabeled choices possible from the given state.
* Retrieves all choices that are definitively asynchronous, possible from the given state.
*
* @param state The state for which to retrieve the unlabeled choices.
* @return The unlabeled choices of the state.
* @return The asynchronous choices of the state.
*/
std::vector<Choice<ValueType>> getUnlabeledChoices(CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter = CommandFilter::All);
std::vector<Choice<ValueType>> getAsynchronousChoices(CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter = CommandFilter::All);
/*!
* Retrieves all labeled choices possible from the given state.
* Retrieves all (potentially) synchronous choices possible from the given state.
* Note that these may include choices that run asynchronously for this state.
*
* @param choices The new choices are inserted in this vector
* @param state The state for which to retrieve the unlabeled choices.
* @return The labeled choices of the state.
* @return The synchronous choices of the state.
*/
void addLabeledChoices(std::vector<Choice<ValueType>>& choices, CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter = CommandFilter::All);
void addSynchronousChoices(std::vector<Choice<ValueType>>& choices, CompressedState const& state, StateToIdCallback stateToIdCallback, CommandFilter const& commandFilter = CommandFilter::All);
/*!
* Extend the Json struct with additional information about the state.

10
src/storm/storage/prism/Program.h

@ -708,8 +708,14 @@ namespace storm {
*/
Program flattenModules(std::shared_ptr<storm::utility::solver::SmtSolverFactory> const& smtSolverFactory = std::shared_ptr<storm::utility::solver::SmtSolverFactory>(new storm::utility::solver::SmtSolverFactory())) const;
Program labelUnlabelledCommands(std::map<uint64_t,std::string> const& nameSuggestions) const;
/*!
* Give commands that do not have an action name an action,
* which can be helpful for debugging and understanding traces.
*
* @param nameSuggestions Optional suggestions that map command indices to names
* @return
*/
Program labelUnlabelledCommands(std::map<uint64_t,std::string> const& nameSuggestions = {}) const;
friend std::ostream& operator<<(std::ostream& stream, Program const& program);

Loading…
Cancel
Save