Browse Source

StateActionPair to index should be part of nondeterministicmodel

tempestpy_adaptions
sjunges 7 years ago
parent
commit
b120b74fa9
  1. 4
      src/storm/models/sparse/Mdp.cpp
  2. 8
      src/storm/models/sparse/Mdp.h
  3. 7
      src/storm/models/sparse/NondeterministicModel.cpp
  4. 8
      src/storm/models/sparse/NondeterministicModel.h

4
src/storm/models/sparse/Mdp.cpp

@ -38,10 +38,6 @@ namespace storm {
}
template<typename ValueType, typename RewardModelType>
uint_least64_t Mdp<ValueType, RewardModelType>::getChoiceIndex(storm::storage::StateActionPair const& stateactPair) const {
return this->getNondeterministicChoiceIndices()[stateactPair.getState()]+stateactPair.getAction();
}
template class Mdp<double>;

8
src/storm/models/sparse/Mdp.h

@ -1,9 +1,7 @@
#ifndef STORM_MODELS_SPARSE_MDP_H_
#define STORM_MODELS_SPARSE_MDP_H_
#include "storm/storage/StateActionPair.h"
#include "storm/models/sparse/NondeterministicModel.h"
#include "storm/utility/OsDetection.h"
namespace storm {
namespace models {
@ -50,12 +48,6 @@ namespace storm {
Mdp(Mdp<ValueType, RewardModelType>&& other) = default;
Mdp& operator=(Mdp<ValueType, RewardModelType>&& other) = default;
/*!
* For a state/action pair, get the choice index referring to the state-action pair.
*/
uint_fast64_t getChoiceIndex(storm::storage::StateActionPair const& stateactPair) const;
};
} // namespace sparse

7
src/storm/models/sparse/NondeterministicModel.cpp

@ -185,7 +185,12 @@ namespace storm {
outStream << "}" << std::endl;
}
}
template<typename ValueType, typename RewardModelType>
uint_least64_t NondeterministicModel<ValueType, RewardModelType>::getChoiceIndex(storm::storage::StateActionPair const& stateactPair) const {
return this->getNondeterministicChoiceIndices()[stateactPair.getState()]+stateactPair.getAction();
}
template class NondeterministicModel<double>;
#ifdef STORM_HAVE_CARL

8
src/storm/models/sparse/NondeterministicModel.h

@ -2,7 +2,7 @@
#define STORM_MODELS_SPARSE_NONDETERMINISTICMODEL_H_
#include "storm/models/sparse/Model.h"
#include "storm/utility/OsDetection.h"
#include "storm/storage/StateActionPair.h"
namespace storm {
@ -54,7 +54,11 @@ namespace storm {
uint_fast64_t getNumberOfChoices(uint_fast64_t state) const;
virtual void reduceToStateBasedRewards() override;
/*!
* For a state/action pair, get the choice index referring to the state-action pair.
*/
uint_fast64_t getChoiceIndex(storm::storage::StateActionPair const& stateactPair) const;
/*!
* Applies the given scheduler to this model.
* @param scheduler the considered scheduler.

Loading…
Cancel
Save