42template<
typename ValueType>
46 bool preprocessingPerformed =
false;
47 if (pomdpSettings.isSelfloopReductionSet()) {
51 uint64_t oldChoiceCount =
pomdp->getNumberOfChoices();
53 STORM_PRINT_AND_LOG(oldChoiceCount -
pomdp->getNumberOfChoices() <<
" choices eliminated through self-loop elimination.\n");
54 preprocessingPerformed =
true;
56 STORM_PRINT_AND_LOG(
"Not eliminating self-loop choices as it does not preserve the formula.\n");
63 std::cout << prob0States <<
'\n';
73 preprocessingPerformed =
true;
75 return preprocessingPerformed;
78template<
typename ValueType>
79void printResult(ValueType
const& lowerBound, ValueType
const& upperBound) {
80 if (lowerBound == upperBound) {
96 STORM_PRINT_AND_LOG(
"[" << lowerBound <<
", " << upperBound <<
"] (width=" << ValueType(upperBound - lowerBound) <<
")");
100 double roundedLowerBound =
102 double roundedUpperBound =
114 uint64_t loglevel = 0;
129 if (qualSettings.isExportSATCallsSet()) {
136template<
typename ValueType>
141 std::stringstream sstr;
142 origpomdp->printModelInformationToStream(sstr);
145 "Qualitative memoryless scheduler search is not implemented for this property type.");
151 pomdp.getTransitionMatrix().makeRowGroupsAbsorbing(surelyNotAlmostSurelyReachTarget);
153 bool computedSomething =
false;
154 if (qualSettings.isMemlessSearchSet()) {
155 computedSomething =
true;
156 std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>();
157 uint64_t lookahead = qualSettings.getLookahead();
158 if (lookahead == 0) {
159 lookahead =
pomdp.getNumberOfStates();
161 if (qualSettings.getMemlessSearchMethod() ==
"one-shot") {
163 if (qualSettings.isWinningRegionSet()) {
164 STORM_LOG_ERROR(
"Computing winning regions is not supported by the one-shot method.");
173 }
else if (qualSettings.getMemlessSearchMethod() ==
"iterative") {
176 if (qualSettings.isWinningRegionSet()) {
188 if (qualSettings.isPrintWinningRegionSet()) {
192 if (qualSettings.isExportWinningRegionSet()) {
193 std::size_t hash =
pomdp.hash();
198 if (
pomdp.getInitialStates().getNumberOfSetBits() == 1) {
199 uint64_t initialState =
pomdp.getInitialStates().getNextSetIndex(0);
200 uint64_t initialObservation =
pomdp.getObservation(initialState);
203 for (uint64_t state = 0; state <
pomdp.getNumberOfStates(); ++state) {
204 if (state == initialState) {
207 if (
pomdp.getObservation(state) == initialObservation) {
218 STORM_LOG_WARN(
"Output for multiple initial states is incomplete");
221 if (coreSettings.isShowStatisticsSet()) {
223 if (qualSettings.computeExpensiveStats()) {
225 STORM_PRINT_AND_LOG(
"#STATS Number of winning belief support states: [" << wbss.first <<
"," << wbss.second <<
"]");
234 if (qualSettings.isComputeOnBeliefSupportSet()) {
235 computedSomething =
true;
237 janicreator.
generate(targetStates, surelyNotAlmostSurelyReachTarget);
238 bool initialOnly = !qualSettings.isWinningRegionSet();
240 STORM_LOG_WARN(
"Using a default environment (and therefore default settings) for the symbolic analysis.");
244 STORM_LOG_THROW(computedSomething, storm::exceptions::InvalidSettingsException,
"Nothing to be done, did you forget to set a method?");
247template<
typename ValueType,
typename BeliefType = ValueType>
251 bool analysisPerformed =
false;
252 if (pomdpSettings.isBeliefExplorationSet()) {
255 pomdpSettings.isBeliefExplorationUnfoldSet());
257 beliefExplorationSettings.setValuesInOptionsStruct(options);
259 auto result = checker.
check(formula);
268 analysisPerformed =
true;
270 if (pomdpSettings.isQualitativeAnalysisSet()) {
272 analysisPerformed =
true;
274 if (pomdpSettings.isCheckFullyObservableSet()) {
279 auto result = resultPtr->template asExplicitQuantitativeCheckResult<ValueType>();
291 analysisPerformed =
true;
293 return analysisPerformed;
296template<
typename ValueType>
301 bool transformationPerformed =
false;
302 bool memoryUnfolded =
false;
303 if (pomdpSettings.getMemoryBound() > 1) {
304 STORM_PRINT_AND_LOG(
"Computing the unfolding for memory bound " << pomdpSettings.getMemoryBound() <<
" and memory pattern '"
307 std::cout << memory.
toString() <<
'\n';
311 pomdp->printModelInformationToStream(std::cout);
312 transformationPerformed =
true;
313 memoryUnfolded =
true;
318 if (transformSettings.isMecReductionSet()) {
321 uint64_t oldChoiceCount =
pomdp->getNumberOfChoices();
325 STORM_PRINT_AND_LOG(oldChoiceCount -
pomdp->getNumberOfChoices() <<
" choices eliminated through MEC choice elimination.\n");
326 pomdp->printModelInformationToStream(std::cout);
327 transformationPerformed =
true;
330 if (transformSettings.isTransformBinarySet() || transformSettings.isTransformSimpleSet()) {
331 if (transformSettings.isTransformSimpleSet()) {
338 pomdp->printModelInformationToStream(std::cout);
340 transformationPerformed =
true;
343 if (pomdpSettings.isExportToParametricSet()) {
346 std::string transformMode = transformSettings.getFscApplicationTypeString();
349 if (transformSettings.allowPostSimplifications()) {
353 ->template as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
355 pmc->printModelInformationToStream(std::cout);
360 std::vector<storm::RationalFunctionVariable> parameters(parameterSet.begin(), parameterSet.end());
361 std::vector<std::string> parameterNames;
362 for (
auto const& parameter : parameters) {
363 parameterNames.push_back(parameter.name());
366 !ioSettings.isExplicitExportPlaceholdersDisabled());
368 transformationPerformed =
true;
370 if (transformationPerformed && !memoryUnfolded) {
371 STORM_PRINT_AND_LOG(
"Implicitly assumed restriction to memoryless schedulers for at least one transformation.\n");
373 return transformationPerformed;
376template<
typename ValueType>
380 if (!pomdpSettings.isNoCanonicSet()) {
385 if (pomdpSettings.isAnalyzeUniqueObservationsSet()) {
388 std::cout << uniqueAnalysis.
analyse() <<
'\n';
392template<
typename ValueType>
395 STORM_LOG_THROW(!formulaInfo.isUnsupported(), storm::exceptions::InvalidPropertyException,
396 "The formula '" << *formula <<
"' is not supported by storm-pomdp.");
403 pomdp->printModelInformationToStream(std::cout);
419template<
typename ValueType>
427 STORM_LOG_WARN(
"Nothing to be done. Did you forget to specify a formula?");
437 storm::exceptions::UnexpectedException,
"Unexpected ValueType for model building.");
445 "Expected a POMDP in sparse representation.");
447 std::shared_ptr<storm::logic::Formula const> formula;
448 if (!symbolicInput.properties.empty()) {
449 formula = symbolicInput.properties.front().getRawFormula();
452 "There is currently no support for multiple properties. All other properties will be ignored.");
455 if (model->isExact()) {
473int main(
const int argc,
const char** argv) {
477 STORM_LOG_ERROR(
"An exception caused Storm-pomdp to terminate. The message of the exception is: " << exception.
what());
479 }
catch (std::exception
const& exception) {
480 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.
bool isInitialWinning() const
void generate(storm::storage::BitVector const &targetStates, storm::storage::BitVector const &badStates)
void verifySymbolic(storm::Environment const &env, bool onlyInitial=true)
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)
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, std::optional< double > const &tolerance=std::nullopt)
storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > createTask(std::shared_ptr< const storm::logic::Formula > const &formula, bool onlyInitialStatesRelevant=false)
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.
#define STORM_PRINT_AND_LOG(message)
int main(const int argc, const char **argv)
Entry point for the pomdp backend.
static const bool IsExact