40template<
typename ValueType>
44 bool preprocessingPerformed =
false;
45 if (pomdpSettings.isSelfloopReductionSet()) {
49 uint64_t oldChoiceCount =
pomdp->getNumberOfChoices();
51 STORM_PRINT_AND_LOG(oldChoiceCount -
pomdp->getNumberOfChoices() <<
" choices eliminated through self-loop elimination.\n");
52 preprocessingPerformed =
true;
54 STORM_PRINT_AND_LOG(
"Not eliminating self-loop choices as it does not preserve the formula.\n");
61 std::cout << prob0States <<
'\n';
71 preprocessingPerformed =
true;
73 return preprocessingPerformed;
76template<
typename ValueType>
77void printResult(ValueType
const& lowerBound, ValueType
const& upperBound) {
78 if (lowerBound == upperBound) {
94 STORM_PRINT_AND_LOG(
"[" << lowerBound <<
", " << upperBound <<
"] (width=" << ValueType(upperBound - lowerBound) <<
")");
98 double roundedLowerBound =
100 double roundedUpperBound =
112 uint64_t loglevel = 0;
127 if (qualSettings.isExportSATCallsSet()) {
134template<
typename ValueType>
139 std::stringstream sstr;
140 origpomdp->printModelInformationToStream(sstr);
143 "Qualitative memoryless scheduler search is not implemented for this property type.");
149 pomdp.getTransitionMatrix().makeRowGroupsAbsorbing(surelyNotAlmostSurelyReachTarget);
151 bool computedSomething =
false;
152 if (qualSettings.isMemlessSearchSet()) {
153 computedSomething =
true;
154 std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>();
155 uint64_t lookahead = qualSettings.getLookahead();
156 if (lookahead == 0) {
157 lookahead =
pomdp.getNumberOfStates();
159 if (qualSettings.getMemlessSearchMethod() ==
"one-shot") {
161 if (qualSettings.isWinningRegionSet()) {
162 STORM_LOG_ERROR(
"Computing winning regions is not supported by the one-shot method.");
171 }
else if (qualSettings.getMemlessSearchMethod() ==
"iterative") {
174 if (qualSettings.isWinningRegionSet()) {
186 if (qualSettings.isPrintWinningRegionSet()) {
190 if (qualSettings.isExportWinningRegionSet()) {
191 std::size_t hash =
pomdp.hash();
196 if (
pomdp.getInitialStates().getNumberOfSetBits() == 1) {
197 uint64_t initialState =
pomdp.getInitialStates().getNextSetIndex(0);
198 uint64_t initialObservation =
pomdp.getObservation(initialState);
201 for (uint64_t state = 0; state <
pomdp.getNumberOfStates(); ++state) {
202 if (state == initialState) {
205 if (
pomdp.getObservation(state) == initialObservation) {
216 STORM_LOG_WARN(
"Output for multiple initial states is incomplete");
219 if (coreSettings.isShowStatisticsSet()) {
221 if (qualSettings.computeExpensiveStats()) {
223 STORM_PRINT_AND_LOG(
"#STATS Number of winning belief support states: [" << wbss.first <<
"," << wbss.second <<
"]");
232 if (qualSettings.isComputeOnBeliefSupportSet()) {
233 computedSomething =
true;
235 janicreator.
generate(targetStates, surelyNotAlmostSurelyReachTarget);
236 bool initialOnly = !qualSettings.isWinningRegionSet();
240 STORM_LOG_THROW(computedSomething, storm::exceptions::InvalidSettingsException,
"Nothing to be done, did you forget to set a method?");
243template<
typename ValueType,
typename BeliefType = ValueType>
247 bool analysisPerformed =
false;
248 if (pomdpSettings.isBeliefExplorationSet()) {
251 pomdpSettings.isBeliefExplorationUnfoldSet());
253 beliefExplorationSettings.setValuesInOptionsStruct(options);
255 auto result = checker.
check(formula);
264 analysisPerformed =
true;
266 if (pomdpSettings.isQualitativeAnalysisSet()) {
268 analysisPerformed =
true;
270 if (pomdpSettings.isCheckFullyObservableSet()) {
275 auto result = resultPtr->template asExplicitQuantitativeCheckResult<ValueType>();
287 analysisPerformed =
true;
289 return analysisPerformed;
292template<
typename ValueType>
297 bool transformationPerformed =
false;
298 bool memoryUnfolded =
false;
299 if (pomdpSettings.getMemoryBound() > 1) {
300 STORM_PRINT_AND_LOG(
"Computing the unfolding for memory bound " << pomdpSettings.getMemoryBound() <<
" and memory pattern '"
303 std::cout << memory.
toString() <<
'\n';
307 pomdp->printModelInformationToStream(std::cout);
308 transformationPerformed =
true;
309 memoryUnfolded =
true;
314 if (transformSettings.isMecReductionSet()) {
317 uint64_t oldChoiceCount =
pomdp->getNumberOfChoices();
321 STORM_PRINT_AND_LOG(oldChoiceCount -
pomdp->getNumberOfChoices() <<
" choices eliminated through MEC choice elimination.\n");
322 pomdp->printModelInformationToStream(std::cout);
323 transformationPerformed =
true;
326 if (transformSettings.isTransformBinarySet() || transformSettings.isTransformSimpleSet()) {
327 if (transformSettings.isTransformSimpleSet()) {
334 pomdp->printModelInformationToStream(std::cout);
336 transformationPerformed =
true;
339 if (pomdpSettings.isExportToParametricSet()) {
342 std::string transformMode = transformSettings.getFscApplicationTypeString();
345 if (transformSettings.allowPostSimplifications()) {
349 ->template as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
351 pmc->printModelInformationToStream(std::cout);
356 std::vector<storm::RationalFunctionVariable> parameters(parameterSet.begin(), parameterSet.end());
357 std::vector<std::string> parameterNames;
358 for (
auto const& parameter : parameters) {
359 parameterNames.push_back(parameter.name());
362 !ioSettings.isExplicitExportPlaceholdersDisabled());
364 transformationPerformed =
true;
366 if (transformationPerformed && !memoryUnfolded) {
367 STORM_PRINT_AND_LOG(
"Implicitly assumed restriction to memoryless schedulers for at least one transformation.\n");
369 return transformationPerformed;
372template<
typename ValueType>
376 if (!pomdpSettings.isNoCanonicSet()) {
381 if (pomdpSettings.isAnalyzeUniqueObservationsSet()) {
384 std::cout << uniqueAnalysis.
analyse() <<
'\n';
388template<
typename ValueType>
391 STORM_LOG_THROW(!formulaInfo.isUnsupported(), storm::exceptions::InvalidPropertyException,
392 "The formula '" << *formula <<
"' is not supported by storm-pomdp.");
399 pomdp->printModelInformationToStream(std::cout);
415template<
typename ValueType>
423 STORM_LOG_WARN(
"Nothing to be done. Did you forget to specify a formula?");
433 storm::exceptions::UnexpectedException,
"Unexpected ValueType for model building.");
441 "Expected a POMDP in sparse representation.");
443 std::shared_ptr<storm::logic::Formula const> formula;
444 if (!symbolicInput.properties.empty()) {
445 formula = symbolicInput.properties.front().getRawFormula();
448 "There is currently no support for multiple properties. All other properties will be ignored.");
451 if (model->isExact()) {
469int main(
const int argc,
const char** argv) {
473 STORM_LOG_ERROR(
"An exception caused Storm-pomdp to terminate. The message of the exception is: " << exception.
what());
475 }
catch (std::exception
const& exception) {
476 STORM_LOG_ERROR(
"An unexpected exception occurred and caused Storm-pomdp to terminate. The message of this exception is: " << exception.
what());
Class to collect constraints on parametric Markov chains.
std::set< storm::RationalFunctionVariable > const & getVariables() const
Returns the set of variables in the model.
storm::storage::BitVector analyseProb0(storm::logic::ProbabilityOperatorFormula const &formula) const
storm::storage::BitVector analyseProbSmaller1(storm::logic::ProbabilityOperatorFormula const &formula) const
storm::storage::BitVector analyseProb1(storm::logic::ProbabilityOperatorFormula const &formula) const
storm::storage::BitVector analyse() const
This class represents the base class of all exception classes.
virtual const char * what() const noexcept override
Retrieves the message associated with this exception.
This class represents a discrete-time Markov chain.
This class represents a (discrete-time) Markov decision process.
This class represents a partially observable Markov decision process.
bool analyzeForInitialStates(uint64_t k)
void computeWinningRegion(uint64_t k)
Statistics const & getStatistics() const
void finalizeStatistics()
WinningRegion const & getLastWinningRegion() const
void setDebugLevel(uint64_t level=1)
void setExportSATCalls(std::string const &path)
bool onlyDeterministicStrategies
MemlessSearchPathVariables pathVariableType
bool analyzeForInitialStates(uint64_t k)
Check if you can find a memoryless policy from the initial states.
std::pair< storm::RationalNumber, storm::RationalNumber > computeNrWinningBeliefs() const
storm::RationalNumber beliefSupportStates() const
bool isWinning(uint64_t observation, uint64_t offset) const
void storeToFile(std::string const &path, std::string const &preamble="", bool append=false) const
Model checker for checking reachability queries on POMDPs using approximations based on exploration o...
Result check(storm::Environment const &env, storm::logic::Formula const &formula, storm::Environment const &preProcEnv, std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > > const &additionalUnderApproximationBounds=std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > >())
Performs model checking of the given POMDP with regards to a formula using the previously specified o...
void printStatisticsToStream(std::ostream &stream) const
Prints statistics of the process to a given output stream.
void verifySymbolic(bool onlyInitial=true)
bool isInitialWinning() const
void generate(storm::storage::BitVector const &targetStates, storm::storage::BitVector const &badStates)
A bit vector that is internally represented as a vector of 64-bit values.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
PomdpMemory build(PomdpMemoryPattern pattern, uint64_t numStates) const
std::string toString() const
A class that provides convenience operations to display run times.
void restart()
Reset the stopwatch and immediately start it.
void stop()
Stop stopwatch and add measured time to total time.
#define STORM_LOG_INFO(message)
#define STORM_LOG_WARN(message)
#define STORM_LOG_TRACE(message)
#define STORM_LOG_ERROR(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
#define STORM_PRINT_AND_LOG(message)
storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > createTask(std::shared_ptr< const storm::logic::Formula > const &formula, bool onlyInitialStatesRelevant=false)
std::shared_ptr< storm::models::sparse::Model< ValueType > > performBisimulationMinimization(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::vector< std::shared_ptr< storm::logic::Formula const > > const &formulas, storm::storage::BisimulationType type=storm::storage::BisimulationType::Strong, bool graphPreserving=true)
void exportSparseModelAsDrn(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, std::vector< std::string > const ¶meterNames={}, bool allowPlaceholders=true)
std::unique_ptr< storm::modelchecker::CheckResult > verifyWithSparseEngine(storm::Environment const &env, std::shared_ptr< storm::models::sparse::Dtmc< ValueType > > const &dtmc, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task)
std::shared_ptr< storm::models::ModelBase > buildPreprocessExportModel(SymbolicInput const &input, ModelProcessingInformation const &mpi)
SymbolicInput parseSymbolicInput()
int process(std::string const &name, std::string const &executableName, std::function< void(std::string const &, std::string const &)> initSettingsFunc, std::function< void(void)> processOptionsFunc, const int argc, const char **argv)
Processes the options and returns the exit code.
std::pair< SymbolicInput, ModelProcessingInformation > preprocessSymbolicInput(SymbolicInput const &input)
FormulaInformation getFormulaInformation(PomdpType const &pomdp, storm::logic::ProbabilityOperatorFormula const &formula)
bool performPreprocessing(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > &pomdp, storm::pomdp::analysis::FormulaInformation &formulaInfo, storm::logic::Formula const &formula)
Perform preprocessings based on the graph structure (if requested or necessary). Return true,...
void processPomdp(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > &pomdp)
bool performTransformation(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > &pomdp, storm::logic::Formula const &formula)
MemlessSearchOptions fillMemlessSearchOptionsFromSettings()
void performQualitativeAnalysis(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > const &origpomdp, storm::pomdp::analysis::FormulaInformation const &formulaInfo, storm::logic::Formula const &formula)
void printResult(ValueType const &lowerBound, ValueType const &upperBound)
bool performAnalysis(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > const &pomdp, storm::pomdp::analysis::FormulaInformation const &formulaInfo, storm::logic::Formula const &formula)
void processPomdpFormula(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > &&pomdp, std::shared_ptr< storm::logic::Formula const > const &formula)
void processFormula(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > &&pomdp, std::shared_ptr< storm::logic::Formula const > const &formula)
MemlessSearchPathVariables pathVariableTypeFromString(std::string const &in)
void initializePomdpSettings(std::string const &name, std::string const &executableName)
Initialize the settings manager.
SettingsType const & getModule()
Get module.
std::string toString(PomdpMemoryPattern const &pattern)
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
bool isInfinity(ValueType const &a)
TargetType convertNumber(SourceType const &number)
l3pp::LogLevel getLogLevel()
Gets the global log level.
int main(const int argc, const char **argv)
Entry point for the pomdp backend.
static const bool IsExact