Browse Source

renamed files

tempestpy_adaptions
Sebastian Junges 5 years ago
parent
commit
0791fc723e
  1. 8
      src/storm-pomdp-cli/storm-pomdp.cpp
  2. 36
      src/storm-pomdp/analysis/IterativePolicySearch.cpp
  3. 12
      src/storm-pomdp/analysis/IterativePolicySearch.h
  4. 10
      src/storm-pomdp/analysis/OneShotPolicySearch.cpp
  5. 10
      src/storm-pomdp/analysis/OneShotPolicySearch.h

8
src/storm-pomdp-cli/storm-pomdp.cpp

@ -24,8 +24,8 @@
#include "storm-pomdp/analysis/QualitativeAnalysisOnGraphs.h" #include "storm-pomdp/analysis/QualitativeAnalysisOnGraphs.h"
#include "storm-pomdp/modelchecker/BeliefExplorationPomdpModelChecker.h" #include "storm-pomdp/modelchecker/BeliefExplorationPomdpModelChecker.h"
#include "storm-pomdp/analysis/FormulaInformation.h" #include "storm-pomdp/analysis/FormulaInformation.h"
#include "storm-pomdp/analysis/MemlessStrategySearchQualitative.h"
#include "storm-pomdp/analysis/QualitativeStrategySearchNaive.h"
#include "storm-pomdp/analysis/IterativePolicySearch.h"
#include "storm-pomdp/analysis/OneShotPolicySearch.h"
#include "storm/api/storm.h" #include "storm/api/storm.h"
#include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h" #include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h"
@ -163,14 +163,14 @@ namespace storm {
lookahead = pomdp.getNumberOfStates(); lookahead = pomdp.getNumberOfStates();
} }
if (qualSettings.getMemlessSearchMethod() == "one-shot") { if (qualSettings.getMemlessSearchMethod() == "one-shot") {
storm::pomdp::QualitativeStrategySearchNaive<ValueType> memlessSearch(pomdp, targetStates, surelyNotAlmostSurelyReachTarget, smtSolverFactory);
storm::pomdp::OneShotPolicySearch<ValueType> memlessSearch(pomdp, targetStates, surelyNotAlmostSurelyReachTarget, smtSolverFactory);
if (qualSettings.isWinningRegionSet()) { if (qualSettings.isWinningRegionSet()) {
STORM_LOG_ERROR("Computing winning regions is not supported by ccd-memless."); STORM_LOG_ERROR("Computing winning regions is not supported by ccd-memless.");
} else { } else {
memlessSearch.analyzeForInitialStates(lookahead); memlessSearch.analyzeForInitialStates(lookahead);
} }
} else if (qualSettings.getMemlessSearchMethod() == "iterative") { } else if (qualSettings.getMemlessSearchMethod() == "iterative") {
storm::pomdp::MemlessStrategySearchQualitative<ValueType> search(pomdp, targetStates, surelyNotAlmostSurelyReachTarget, smtSolverFactory, options);
storm::pomdp::IterativePolicySearch<ValueType> search(pomdp, targetStates, surelyNotAlmostSurelyReachTarget, smtSolverFactory, options);
if (qualSettings.isWinningRegionSet()) { if (qualSettings.isWinningRegionSet()) {
search.computeWinningRegion(lookahead); search.computeWinningRegion(lookahead);
} else { } else {

36
src/storm-pomdp/analysis/MemlessStrategySearchQualitative.cpp → src/storm-pomdp/analysis/IterativePolicySearch.cpp

@ -1,7 +1,7 @@
#include "storm-pomdp/analysis/MemlessStrategySearchQualitative.h"
#include "storm-pomdp/analysis/IterativePolicySearch.h"
#include "storm/utility/file.h" #include "storm/utility/file.h"
#include "storm-pomdp/analysis/QualitativeStrategySearchNaive.h"
#include "storm-pomdp/analysis/OneShotPolicySearch.h"
#include "storm-pomdp/analysis/QualitativeAnalysis.h" #include "storm-pomdp/analysis/QualitativeAnalysis.h"
#include "storm-pomdp/analysis/QualitativeAnalysisOnGraphs.h" #include "storm-pomdp/analysis/QualitativeAnalysisOnGraphs.h"
@ -34,7 +34,7 @@ namespace storm {
} }
template <typename ValueType> template <typename ValueType>
void MemlessStrategySearchQualitative<ValueType>::Statistics::print() const {
void IterativePolicySearch<ValueType>::Statistics::print() const {
STORM_PRINT_AND_LOG("Total time: " << totalTimer); STORM_PRINT_AND_LOG("Total time: " << totalTimer);
STORM_PRINT_AND_LOG("SAT Calls " << satCalls); STORM_PRINT_AND_LOG("SAT Calls " << satCalls);
STORM_PRINT_AND_LOG("SAT Calls time: " << smtCheckTimer); STORM_PRINT_AND_LOG("SAT Calls time: " << smtCheckTimer);
@ -48,11 +48,11 @@ namespace storm {
} }
template <typename ValueType> template <typename ValueType>
MemlessStrategySearchQualitative<ValueType>::MemlessStrategySearchQualitative(storm::models::sparse::Pomdp<ValueType> const& pomdp,
storm::storage::BitVector const& targetStates,
storm::storage::BitVector const& surelyReachSinkStates,
std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory,
MemlessSearchOptions const& options) :
IterativePolicySearch<ValueType>::IterativePolicySearch(storm::models::sparse::Pomdp<ValueType> const& pomdp,
storm::storage::BitVector const& targetStates,
storm::storage::BitVector const& surelyReachSinkStates,
std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory,
MemlessSearchOptions const& options) :
pomdp(pomdp), pomdp(pomdp),
surelyReachSinkStates(surelyReachSinkStates), surelyReachSinkStates(surelyReachSinkStates),
targetStates(targetStates), targetStates(targetStates),
@ -83,7 +83,7 @@ namespace storm {
} }
template <typename ValueType> template <typename ValueType>
bool MemlessStrategySearchQualitative<ValueType>::initialize(uint64_t k) {
bool IterativePolicySearch<ValueType>::initialize(uint64_t k) {
STORM_LOG_INFO("Start intializing solver..."); STORM_LOG_INFO("Start intializing solver...");
bool lookaheadConstraintsRequired; bool lookaheadConstraintsRequired;
@ -377,7 +377,7 @@ namespace storm {
} }
template<typename ValueType> template<typename ValueType>
uint64_t MemlessStrategySearchQualitative<ValueType>::getOffsetFromObservation(uint64_t state, uint64_t observation) const {
uint64_t IterativePolicySearch<ValueType>::getOffsetFromObservation(uint64_t state, uint64_t observation) const {
if(!useFindOffset) { if(!useFindOffset) {
STORM_LOG_WARN("This code is slow and should only be used for debugging."); STORM_LOG_WARN("This code is slow and should only be used for debugging.");
useFindOffset = true; useFindOffset = true;
@ -394,7 +394,7 @@ namespace storm {
} }
template <typename ValueType> template <typename ValueType>
bool MemlessStrategySearchQualitative<ValueType>::analyze(uint64_t k, storm::storage::BitVector const& oneOfTheseStates, storm::storage::BitVector const& allOfTheseStates) {
bool IterativePolicySearch<ValueType>::analyze(uint64_t k, storm::storage::BitVector const& oneOfTheseStates, storm::storage::BitVector const& allOfTheseStates) {
STORM_LOG_DEBUG("Surely reach sink states: " << surelyReachSinkStates); STORM_LOG_DEBUG("Surely reach sink states: " << surelyReachSinkStates);
STORM_LOG_DEBUG("Target states " << targetStates); STORM_LOG_DEBUG("Target states " << targetStates);
STORM_LOG_DEBUG("Questionmark states " << (~surelyReachSinkStates & ~targetStates)); STORM_LOG_DEBUG("Questionmark states " << (~surelyReachSinkStates & ~targetStates));
@ -897,7 +897,7 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
void MemlessStrategySearchQualitative<ValueType>::printCoveredStates(storm::storage::BitVector const &remaining) const {
void IterativePolicySearch<ValueType>::printCoveredStates(storm::storage::BitVector const &remaining) const {
STORM_LOG_DEBUG("states that are okay"); STORM_LOG_DEBUG("states that are okay");
for (uint64_t state = 0; state < pomdp.getNumberOfStates(); ++state) { for (uint64_t state = 0; state < pomdp.getNumberOfStates(); ++state) {
if (!remaining.get(state)) { if (!remaining.get(state)) {
@ -908,22 +908,22 @@ namespace storm {
} }
template<typename ValueType> template<typename ValueType>
void MemlessStrategySearchQualitative<ValueType>::printScheduler(std::vector<InternalObservationScheduler> const& ) {
void IterativePolicySearch<ValueType>::printScheduler(std::vector<InternalObservationScheduler> const& ) {
} }
template<typename ValueType> template<typename ValueType>
void MemlessStrategySearchQualitative<ValueType>::finalizeStatistics() {
void IterativePolicySearch<ValueType>::finalizeStatistics() {
} }
template<typename ValueType> template<typename ValueType>
typename MemlessStrategySearchQualitative<ValueType>::Statistics const& MemlessStrategySearchQualitative<ValueType>::getStatistics() const{
typename IterativePolicySearch<ValueType>::Statistics const& IterativePolicySearch<ValueType>::getStatistics() const{
return stats; return stats;
} }
template <typename ValueType> template <typename ValueType>
bool MemlessStrategySearchQualitative<ValueType>::smtCheck(uint64_t iteration, std::set<storm::expressions::Expression> const& assumptions) {
bool IterativePolicySearch<ValueType>::smtCheck(uint64_t iteration, std::set<storm::expressions::Expression> const& assumptions) {
if(options.isExportSATSet()) { if(options.isExportSATSet()) {
STORM_LOG_DEBUG("Export SMT Solver Call (" <<iteration << ")"); STORM_LOG_DEBUG("Export SMT Solver Call (" <<iteration << ")");
std::string filepath = options.getExportSATCallsPath() + "call_" + std::to_string(iteration) + ".smt2"; std::string filepath = options.getExportSATCallsPath() + "call_" + std::to_string(iteration) + ".smt2";
@ -957,8 +957,8 @@ namespace storm {
return true; return true;
} }
template class MemlessStrategySearchQualitative<double>;
template class MemlessStrategySearchQualitative<storm::RationalNumber>;
template class IterativePolicySearch<double>;
template class IterativePolicySearch<storm::RationalNumber>;
} }

12
src/storm-pomdp/analysis/MemlessStrategySearchQualitative.h → src/storm-pomdp/analysis/IterativePolicySearch.h

@ -114,7 +114,7 @@ namespace pomdp {
}; };
template<typename ValueType> template<typename ValueType>
class MemlessStrategySearchQualitative {
class IterativePolicySearch {
// Implements an extension to the Chatterjee, Chmelik, Davies (AAAI-16) paper. // Implements an extension to the Chatterjee, Chmelik, Davies (AAAI-16) paper.
public: public:
@ -162,12 +162,12 @@ namespace pomdp {
uint64_t graphBasedAnalysisWinOb = 0; uint64_t graphBasedAnalysisWinOb = 0;
}; };
MemlessStrategySearchQualitative(storm::models::sparse::Pomdp<ValueType> const& pomdp,
storm::storage::BitVector const& targetStates,
storm::storage::BitVector const& surelyReachSinkStates,
IterativePolicySearch(storm::models::sparse::Pomdp<ValueType> const& pomdp,
storm::storage::BitVector const& targetStates,
storm::storage::BitVector const& surelyReachSinkStates,
std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory,
MemlessSearchOptions const& options);
std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory,
MemlessSearchOptions const& options);
void analyzeForInitialStates(uint64_t k) { void analyzeForInitialStates(uint64_t k) {
stats.totalTimer.start(); stats.totalTimer.start();

10
src/storm-pomdp/analysis/QualitativeStrategySearchNaive.cpp → src/storm-pomdp/analysis/OneShotPolicySearch.cpp

@ -1,13 +1,13 @@
#include "storm/utility/file.h" #include "storm/utility/file.h"
#include "storm-pomdp/analysis/QualitativeStrategySearchNaive.h"
#include "storm-pomdp/analysis/OneShotPolicySearch.h"
namespace storm { namespace storm {
namespace pomdp { namespace pomdp {
template <typename ValueType> template <typename ValueType>
void QualitativeStrategySearchNaive<ValueType>::initialize(uint64_t k) {
void OneShotPolicySearch<ValueType>::initialize(uint64_t k) {
if (maxK == std::numeric_limits<uint64_t>::max()) { if (maxK == std::numeric_limits<uint64_t>::max()) {
// not initialized at all. // not initialized at all.
// Create some data structures. // Create some data structures.
@ -116,7 +116,7 @@ namespace storm {
} }
template <typename ValueType> template <typename ValueType>
bool QualitativeStrategySearchNaive<ValueType>::analyze(uint64_t k, storm::storage::BitVector const& oneOfTheseStates, storm::storage::BitVector const& allOfTheseStates) {
bool OneShotPolicySearch<ValueType>::analyze(uint64_t k, storm::storage::BitVector const& oneOfTheseStates, storm::storage::BitVector const& allOfTheseStates) {
STORM_LOG_TRACE("Use lookahead of "<<k); STORM_LOG_TRACE("Use lookahead of "<<k);
if (k < maxK) { if (k < maxK) {
@ -183,7 +183,7 @@ namespace storm {
} }
template class QualitativeStrategySearchNaive<double>;
template class QualitativeStrategySearchNaive<storm::RationalNumber>;
template class OneShotPolicySearch<double>;
template class OneShotPolicySearch<storm::RationalNumber>;
} }
} }

10
src/storm-pomdp/analysis/QualitativeStrategySearchNaive.h → src/storm-pomdp/analysis/OneShotPolicySearch.h

@ -20,7 +20,7 @@ namespace storm {
} }
template<typename ValueType> template<typename ValueType>
class QualitativeStrategySearchNaive {
class OneShotPolicySearch {
// Implements to the Chatterjee, Chmelik, Davies (AAAI-16) paper. // Implements to the Chatterjee, Chmelik, Davies (AAAI-16) paper.
class Statistics { class Statistics {
public: public:
@ -32,10 +32,10 @@ namespace storm {
}; };
public: public:
QualitativeStrategySearchNaive(storm::models::sparse::Pomdp<ValueType> const& pomdp,
storm::storage::BitVector const& targetStates,
storm::storage::BitVector const& surelyReachSinkStates,
std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory) :
OneShotPolicySearch(storm::models::sparse::Pomdp<ValueType> const& pomdp,
storm::storage::BitVector const& targetStates,
storm::storage::BitVector const& surelyReachSinkStates,
std::shared_ptr<storm::utility::solver::SmtSolverFactory>& smtSolverFactory) :
pomdp(pomdp), pomdp(pomdp),
targetObservations(extractObservations(pomdp, targetStates)), targetObservations(extractObservations(pomdp, targetStates)),
targetStates(targetStates), targetStates(targetStates),
Loading…
Cancel
Save