Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
model-handling.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/algorithm/string/join.hpp>
4#include <type_traits>
5
10#include "storm/api/storm.h"
16#include "storm/io/file.h"
33#include "storm/storage/Qvbs.h"
42
43namespace storm {
44namespace cli {
45
47 // The symbolic model description.
48 boost::optional<storm::storage::SymbolicModelDescription> model;
49
50 // The original properties to check.
51 std::vector<storm::jani::Property> properties;
52
53 // The preprocessed properties to check (in case they needed amendment).
54 boost::optional<std::vector<storm::jani::Property>> preprocessedProperties;
55};
56
59 if (ioSettings.isPrismOrJaniInputSet()) {
60 storm::utility::Stopwatch modelParsingWatch(true);
61 if (ioSettings.isPrismInputSet()) {
62 input.model =
63 storm::api::parseProgram(ioSettings.getPrismInputFilename(), buildSettings.isPrismCompatibilityEnabled(), !buildSettings.isNoSimplifySet());
64 } else {
65 boost::optional<std::vector<std::string>> propertyFilter;
66 if (ioSettings.isJaniPropertiesSet()) {
67 if (ioSettings.areJaniPropertiesSelected()) {
68 propertyFilter = ioSettings.getSelectedJaniProperties();
69 } else {
70 propertyFilter = boost::none;
71 }
72 } else {
73 propertyFilter = std::vector<std::string>();
74 }
75 auto janiInput = storm::api::parseJaniModel(ioSettings.getJaniInputFilename(), propertyFilter);
76 input.model = std::move(janiInput.first);
77 if (ioSettings.isJaniPropertiesSet()) {
78 input.properties = std::move(janiInput.second);
79 }
80 }
81 modelParsingWatch.stop();
82 STORM_PRINT("Time for model input parsing: " << modelParsingWatch << ".\n\n");
83 }
84}
85
87 boost::optional<std::set<std::string>> const& propertyFilter) {
88 if (ioSettings.isPropertySet()) {
89 std::vector<storm::jani::Property> newProperties;
90 if (input.model) {
91 newProperties = storm::api::parsePropertiesForSymbolicModelDescription(ioSettings.getProperty(), input.model.get(), propertyFilter);
92 } else {
93 newProperties = storm::api::parseProperties(ioSettings.getProperty(), propertyFilter);
94 }
95
96 input.properties.insert(input.properties.end(), newProperties.begin(), newProperties.end());
97 }
98}
99
101 // Parse the model input
102 SymbolicInput input;
103 storm::storage::QvbsBenchmark benchmark(ioSettings.getQvbsModelName());
104 STORM_PRINT_AND_LOG(benchmark.getInfo(ioSettings.getQvbsInstanceIndex(), ioSettings.getQvbsPropertyFilter()));
105 storm::utility::Stopwatch modelParsingWatch(true);
106 auto janiInput = storm::api::parseJaniModel(benchmark.getJaniFile(ioSettings.getQvbsInstanceIndex()), ioSettings.getQvbsPropertyFilter());
107 input.model = std::move(janiInput.first);
108 input.properties = std::move(janiInput.second);
109 modelParsingWatch.stop();
110 STORM_PRINT("Time for model input parsing: " << modelParsingWatch << ".\n\n");
111
112 // Parse additional properties
113 boost::optional<std::set<std::string>> propertyFilter = storm::api::parsePropertyFilter(ioSettings.getPropertyFilter());
114 parseProperties(ioSettings, input, propertyFilter);
115
116 // Substitute constant definitions
117 auto constantDefinitions = input.model.get().parseConstantDefinitions(benchmark.getConstantDefinition(ioSettings.getQvbsInstanceIndex()));
118 input.model = input.model.get().preprocess(constantDefinitions);
119 if (!input.properties.empty()) {
120 input.properties = storm::api::substituteConstantsInProperties(input.properties, constantDefinitions);
121 }
122
123 return input;
124}
125
128 if (ioSettings.isQvbsInputSet()) {
129 return parseSymbolicInputQvbs(ioSettings);
130 } else {
131 // Parse the property filter, if any is given.
132 boost::optional<std::set<std::string>> propertyFilter = storm::api::parsePropertyFilter(ioSettings.getPropertyFilter());
133
134 SymbolicInput input;
135 parseSymbolicModelDescription(ioSettings, input);
136 parseProperties(ioSettings, input, propertyFilter);
137 return input;
138 }
139}
140
142 // The engine to use
144
145 // If set, bisimulation will be applied.
147
148 // If set, a transformation to Jani will be enforced
150
151 // Which data type is to be used for numbers ...
153 ValueType buildValueType; // ... during model building
154 ValueType verificationValueType; // ... during model verification
155
156 // The Dd library to be used
158
159 // The environment used during model checking
161
162 // A flag which is set to true, if the settings were detected to be compatible.
163 // If this is false, it could be that the query can not be handled.
165};
166
169
170 STORM_LOG_THROW(input.model.is_initialized(), storm::exceptions::InvalidArgumentException, "Automatic engine requires a JANI input model.");
171 STORM_LOG_THROW(input.model->isJaniModel(), storm::exceptions::InvalidArgumentException, "Automatic engine requires a JANI input model.");
172 std::vector<storm::jani::Property> const& properties =
173 input.preprocessedProperties.is_initialized() ? input.preprocessedProperties.get() : input.properties;
174 STORM_LOG_THROW(!properties.empty(), storm::exceptions::InvalidArgumentException, "Automatic engine requires a property.");
175 STORM_LOG_WARN_COND(properties.size() == 1,
176 "Automatic engine does not support decisions based on multiple properties. Only the first property will be considered.");
177
179 if (hints.isNumberStatesSet()) {
180 as.predict(input.model->asJaniModel(), properties.front(), hints.getNumberStates());
181 } else {
182 as.predict(input.model->asJaniModel(), properties.front());
183 }
184
185 mpi.engine = as.getEngine();
186 if (as.enableBisimulation()) {
187 mpi.applyBisimulation = true;
188 }
191 }
192 STORM_PRINT_AND_LOG("Automatic engine picked the following settings: \n"
193 << "\tengine=" << mpi.engine << std::boolalpha << "\t bisimulation=" << mpi.applyBisimulation
194 << "\t exact=" << (mpi.verificationValueType != ModelProcessingInformation::ValueType::FinitePrecision) << std::noboolalpha << '\n');
195}
196
203 std::shared_ptr<SymbolicInput> const& transformedJaniInput = nullptr) {
209
210 // Set the engine.
211 mpi.engine = coreSettings.getEngine();
212
213 // Set whether bisimulation is to be used.
214 mpi.applyBisimulation = generalSettings.isBisimulationSet();
215
216 // Set the value type used for numeric values
217 if (generalSettings.isParametricSet()) {
219 } else if (generalSettings.isExactSet()) {
221 } else {
223 }
224 auto originalVerificationValueType = mpi.verificationValueType;
225
226 // Since the remaining settings could depend on the ones above, we need apply the automatic engine now.
227 bool useAutomatic = input.model.is_initialized() && mpi.engine == storm::utility::Engine::Automatic;
228 if (useAutomatic) {
229 if (input.model->isJaniModel()) {
230 // This can potentially overwrite the settings above, but will not overwrite settings that were explicitly set by the user (e.g. we will not disable
231 // bisimulation or disable exact arithmetic)
233 } else {
234 // Transform Prism to jani first
235 STORM_LOG_ASSERT(input.model->isPrismProgram(), "Unexpected type of input.");
236 SymbolicInput janiInput;
237 janiInput.properties = input.properties;
238 storm::prism::Program const& prog = input.model.get().asPrismProgram();
239 auto modelAndProperties = prog.toJani(input.preprocessedProperties.is_initialized() ? input.preprocessedProperties.get() : input.properties);
240 janiInput.model = modelAndProperties.first;
241 if (!modelAndProperties.second.empty()) {
242 janiInput.preprocessedProperties = std::move(modelAndProperties.second);
243 }
244 // This can potentially overwrite the settings above, but will not overwrite settings that were explicitly set by the user (e.g. we will not disable
245 // bisimulation or disable exact arithmetic)
247 if (transformedJaniInput) {
248 // We cache the transformation result.
249 *transformedJaniInput = std::move(janiInput);
250 }
251 }
252 }
253
254 // Check whether these settings are compatible with the provided input.
255 if (input.model) {
256 auto checkCompatibleSettings = [&mpi, &input] {
257 switch (mpi.verificationValueType) {
260 mpi.engine, input.preprocessedProperties.is_initialized() ? input.preprocessedProperties.get() : input.properties, input.model.get());
263 mpi.engine, input.preprocessedProperties.is_initialized() ? input.preprocessedProperties.get() : input.properties, input.model.get());
264 break;
267 mpi.engine, input.preprocessedProperties.is_initialized() ? input.preprocessedProperties.get() : input.properties, input.model.get());
268 }
269 return false;
270 };
271 mpi.isCompatible = checkCompatibleSettings();
272 if (!mpi.isCompatible) {
273 if (useAutomatic) {
275 STORM_LOG_WARN("The settings picked by the automatic engine (engine="
276 << mpi.engine << ", bisim=" << mpi.applyBisimulation << ", exact=" << useExact
277 << ") are incompatible with this model. Falling back to default settings.");
279 mpi.applyBisimulation = false;
280 mpi.verificationValueType = originalVerificationValueType;
281 // Retry check with new settings
282 mpi.isCompatible = checkCompatibleSettings();
283 }
284 }
285 } else {
286 // If there is no input model, nothing has to be done, actually
287 mpi.isCompatible = true;
288 }
289
290 // Set whether a transformation to jani is required or necessary
291 mpi.transformToJani = ioSettings.isPrismToJaniSet();
292 if (input.model) {
293 auto builderType = storm::utility::getBuilderType(mpi.engine);
294 bool transformToJaniForDdMA = (builderType == storm::builder::BuilderType::Dd) &&
295 (input.model->getModelType() == storm::storage::SymbolicModelDescription::ModelType::MA) && (!input.model->isJaniModel());
296 STORM_LOG_WARN_COND(mpi.transformToJani || !transformToJaniForDdMA,
297 "Dd-based model builder for Markov Automata is only available for JANI models, automatically converting the input model.");
298 mpi.transformToJani |= transformToJaniForDdMA;
299 }
300
301 // Set the Valuetype used during model building
303 if (bisimulationSettings.useExactArithmeticInDdBisimulation()) {
307 }
308 } else {
309 STORM_LOG_WARN("Requested using exact arithmetic in Dd bisimulation but no dd bisimulation is applied.");
310 }
311 }
312
313 // Set the Dd library
314 mpi.ddType = coreSettings.getDdLibraryType();
315 if (mpi.ddType == storm::dd::DdType::CUDD && coreSettings.isDdLibraryTypeSetFromDefaultValue()) {
318 STORM_LOG_INFO("Switching to DD library sylvan to allow for rational arithmetic.");
320 }
321 }
322 return mpi;
323}
324
325auto castAndApply(std::shared_ptr<storm::models::ModelBase> const& model, auto const& callback) {
326 STORM_LOG_ASSERT(model, "Tried to cast a model that does not exist.");
327
328 // Helper to actually perform the cast once value type and model representation type is known
329 auto castAndApplyImpl = [&model, &callback]<typename TargetModelType> {
330 auto res = model->template as<TargetModelType>();
331 STORM_LOG_ASSERT(res, "Casting model pointer failed unexpectedly.");
332 return callback(res);
333 };
334
335 // Helper to branch on type of model representation
336 auto castAndApplyVT = [&]<typename ValueType> {
337 if (model->isSparseModel()) {
338 return castAndApplyImpl.template operator()<storm::models::sparse::Model<ValueType>>();
339 } else {
340 auto ddType = model->getDdType();
341 STORM_LOG_ASSERT(model->isSymbolicModel() && ddType.has_value(), "Unexpected model representation.");
342 if constexpr (storm::IsIntervalType<ValueType>) {
343 // Avoiding a couple of unnecessary template instantiations
344 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Symbolic interval models are currently not supported.");
345 } else {
346 using enum storm::dd::DdType;
347 if (*ddType == CUDD) {
348 if constexpr (std::is_same_v<ValueType, double>) {
349 return castAndApplyImpl.template operator()<storm::models::symbolic::Model<CUDD, ValueType>>();
350 }
351 }
352 STORM_LOG_ASSERT(*ddType == Sylvan, "Unexpected Dd type.");
353 return castAndApplyImpl.template operator()<storm::models::symbolic::Model<Sylvan, ValueType>>();
354 }
355 }
356 };
357
358 // branch on type of value representation
359 if (model->supportsParameters()) {
360 return castAndApplyVT.template operator()<storm::RationalFunction>();
361 } else if (model->supportsUncertainty()) {
362 if (model->isExact()) {
363 return castAndApplyVT.template operator()<storm::RationalInterval>();
364 } else {
365 return castAndApplyVT.template operator()<storm::Interval>();
366 }
367 } else {
368 if (model->isExact()) {
369 return castAndApplyVT.template operator()<storm::RationalNumber>();
370 } else {
371 return castAndApplyVT.template operator()<double>();
372 }
373 }
374}
375
378 switch (vt) {
379 case FinitePrecision:
380 return callback.template operator()<double>();
381 case Exact:
382 return callback.template operator()<storm::RationalNumber>();
383 case Parametric:
384 return callback.template operator()<storm::RationalFunction>();
385 }
386 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Unexpected value type.");
387}
388
390 using enum storm::dd::DdType;
392 switch (dd) {
393 case CUDD:
394 STORM_LOG_THROW(vt == FinitePrecision, storm::exceptions::UnexpectedException, "Unexpected value type for DD library Cudd.");
395 return callback.template operator()<CUDD, double>();
396 case Sylvan:
397 switch (vt) {
398 case FinitePrecision:
399 return callback.template operator()<Sylvan, double>();
400 case Exact:
401 return callback.template operator()<Sylvan, storm::RationalNumber>();
402 case Parametric:
403 return callback.template operator()<Sylvan, storm::RationalFunction>();
404 }
405 }
406 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Unexpected DDType or value type.");
407}
408
409inline void ensureNoUndefinedPropertyConstants(std::vector<storm::jani::Property> const& properties) {
410 // Make sure there are no undefined constants remaining in any property.
411 for (auto const& property : properties) {
412 std::set<storm::expressions::Variable> usedUndefinedConstants = property.getUndefinedConstants();
413 if (!usedUndefinedConstants.empty()) {
414 std::vector<std::string> undefinedConstantsNames;
415 for (auto const& constant : usedUndefinedConstants) {
416 undefinedConstantsNames.emplace_back(constant.getName());
417 }
419 false, storm::exceptions::InvalidArgumentException,
420 "The property '" << property << " still refers to the undefined constants " << boost::algorithm::join(undefinedConstantsNames, ",") << ".");
421 }
422 }
423}
424
425inline std::pair<SymbolicInput, ModelProcessingInformation> preprocessSymbolicInput(SymbolicInput const& input) {
427
428 SymbolicInput output = input;
429
430 // Preprocess properties (if requested)
431 if (ioSettings.isPropertiesAsMultiSet()) {
432 STORM_LOG_THROW(!input.properties.empty(), storm::exceptions::InvalidArgumentException,
433 "Can not translate properties to multi-objective formula because no properties were specified.");
434 // If we come from storm-pars, the following fails as multiObjectiveSettings are not loaded
437 }
438
439 // Substitute constant definitions in symbolic input.
440 std::string constantDefinitionString = ioSettings.getConstantDefinitionString();
441 std::map<storm::expressions::Variable, storm::expressions::Expression> constantDefinitions;
442 if (output.model) {
443 constantDefinitions = output.model.get().parseConstantDefinitions(constantDefinitionString);
444 output.model = output.model.get().preprocess(constantDefinitions);
445 }
446 if (!output.properties.empty()) {
447 output.properties = storm::api::substituteConstantsInProperties(output.properties, constantDefinitions);
448 }
450 auto transformedJani = std::make_shared<SymbolicInput>();
451 ModelProcessingInformation mpi = getModelProcessingInformation(output, transformedJani);
452
453 // Check whether conversion for PRISM to JANI is requested or necessary.
454 if (output.model && output.model.get().isPrismProgram()) {
455 if (mpi.transformToJani) {
456 if (transformedJani->model) {
457 // Use the cached transformation if possible
458 output = std::move(*transformedJani);
459 } else {
460 storm::prism::Program const& model = output.model.get().asPrismProgram();
461 auto modelAndProperties = model.toJani(output.properties);
462
463 output.model = modelAndProperties.first;
464
465 if (!modelAndProperties.second.empty()) {
466 output.preprocessedProperties = std::move(modelAndProperties.second);
467 }
468 }
469 }
470 }
471
472 if (output.model && output.model.get().isJaniModel()) {
474 storm::api::simplifyJaniModel(output.model.get().asJaniModel(), output.properties, supportedFeatures);
475
477 if (buildSettings.isLocationEliminationSet()) {
478 auto locationHeuristic = buildSettings.getLocationEliminationLocationHeuristic();
479 auto edgesHeuristic = buildSettings.getLocationEliminationEdgesHeuristic();
480 output.model->setModel(storm::jani::JaniLocalEliminator::eliminateAutomatically(output.model.get().asJaniModel(), output.properties,
481 locationHeuristic, edgesHeuristic));
482 }
483 }
484
485 return {output, mpi};
486}
487
488inline std::vector<std::shared_ptr<storm::logic::Formula const>> createFormulasToRespect(std::vector<storm::jani::Property> const& properties) {
489 std::vector<std::shared_ptr<storm::logic::Formula const>> result = storm::api::extractFormulasFromProperties(properties);
490
491 for (auto const& property : properties) {
492 if (!property.getFilter().getStatesFormula()->isInitialFormula()) {
493 result.push_back(property.getFilter().getStatesFormula());
494 }
495 }
496
497 return result;
498}
499
500template<storm::dd::DdType DdType, typename ValueType>
501std::shared_ptr<storm::models::ModelBase> buildModelDd(storm::Environment const& env, SymbolicInput const& input) {
502 if (DdType == storm::dd::DdType::Sylvan) {
503 auto numThreads = env.dd().sylvan().getNumberOfThreads();
504 STORM_PRINT_AND_LOG("Using Sylvan with " << numThreads << " parallel threads.\n");
505 }
508 buildSettings.isBuildFullModelSet(), !buildSettings.isApplyNoMaximumProgressAssumptionSet(),
509 !buildSettings.isDontFixDeadlocksSet());
510}
511
515 options.setBuildChoiceLabels(options.isBuildChoiceLabelsSet() || buildSettings.isBuildChoiceLabelsSet());
516 options.setBuildStateValuations(options.isBuildStateValuationsSet() || buildSettings.isBuildStateValuationsSet());
517 options.setBuildAllLabels(options.isBuildAllLabelsSet() || buildSettings.isBuildAllLabelsSet());
518 options.setBuildObservationValuations(options.isBuildObservationValuationsSet() || buildSettings.isBuildObservationValuationsSet());
519 bool buildChoiceOrigins = options.isBuildChoiceOriginsSet() || buildSettings.isBuildChoiceOriginsSet();
522 if (counterexampleGeneratorSettings.isCounterexampleSet()) {
523 buildChoiceOrigins |= counterexampleGeneratorSettings.isMinimalCommandSetGenerationSet();
524 }
525 }
526 options.setBuildChoiceOrigins(buildChoiceOrigins);
527
528 if (buildSettings.isApplyNoMaximumProgressAssumptionSet()) {
530 }
531
532 if (buildSettings.isExplorationChecksSet()) {
533 options.setExplorationChecks();
534 }
535 options.setReservedBitsForUnboundedVariables(buildSettings.getBitsForUnboundedVariables());
536
537 options.setAddOutOfBoundsState(buildSettings.isBuildOutOfBoundsStateSet());
538 if (buildSettings.isBuildFullModelSet()) {
539 options.clearTerminalStates();
541 options.setBuildAllLabels(true);
542 options.setBuildAllRewardModels(true);
543 }
544
545 if (buildSettings.isAddOverlappingGuardsLabelSet()) {
546 options.setAddOverlappingGuardsLabel(true);
547 }
548
550 if (ioSettings.isComputeExpectedVisitingTimesSet() || ioSettings.isComputeSteadyStateDistributionSet()) {
551 options.clearTerminalStates();
552 }
553
555 options.setStochasticTolerance(generalSettings.getPrecision());
556 options.setShowProgress(generalSettings.isVerboseSet());
557 options.setShowProgressDelay(generalSettings.getShowProgressDelay());
558
559 return options;
560}
561
562template<typename ValueType>
566 explorationOptions.explorationOrder = buildSettings.getExplorationOrder();
567 explorationOptions.fixDeadlocks = !buildSettings.isDontFixDeadlocksSet();
568 if (buildSettings.isExplorationStateLimitSet()) {
569 explorationOptions.explorationStateLimit = buildSettings.getExplorationStateLimit();
570 }
571 return explorationOptions;
572}
573
574template<typename ValueType>
575std::shared_ptr<storm::models::ModelBase> buildModelSparse(SymbolicInput const& input, storm::builder::BuilderOptions const& options) {
576 // If the input is an interval model, we might need to change the ValueType to an interval type.
577 if (!storm::IsIntervalType<ValueType> && input.model.is_initialized() && input.model->isPrismProgram() &&
578 input.model->asPrismProgram().hasIntervalUpdates()) {
579 // Get the right interval type for the given ValueType
580 bool constexpr IsDoubleInterval = std::is_same_v<ValueType, storm::IntervalBaseType<storm::Interval>>;
581 bool constexpr IsRationalInterval = std::is_same_v<ValueType, storm::IntervalBaseType<storm::RationalInterval>>;
582 STORM_LOG_THROW(IsDoubleInterval || IsRationalInterval, storm::exceptions::NotSupportedException,
583 "Can not build interval model for the provided value type.");
584 using IntervalType = std::conditional_t<IsDoubleInterval, storm::Interval, storm::RationalInterval>;
586 } else {
588 }
589}
590
591template<typename ValueType>
592std::shared_ptr<storm::models::ModelBase> buildModelExplicit(storm::settings::modules::IOSettings const& ioSettings,
593 storm::settings::modules::BuildSettings const& buildSettings) {
594 std::shared_ptr<storm::models::ModelBase> result;
595 if (ioSettings.isExplicitSet()) {
596 storm::parser::ExplicitModelParserOptions explicitModelParserOptions;
597 explicitModelParserOptions.fixDeadlocks = !buildSettings.isDontFixDeadlocksSet();
598 explicitModelParserOptions.buildChoiceLabels = buildSettings.isBuildChoiceLabelsSet();
600 ioSettings.getTransitionFilename(), ioSettings.getLabelingFilename(),
601 ioSettings.isStateRewardsSet() ? boost::optional<std::string>(ioSettings.getStateRewardsFilename()) : boost::none,
602 ioSettings.isTransitionRewardsSet() ? boost::optional<std::string>(ioSettings.getTransitionRewardsFilename()) : boost::none,
603 ioSettings.isChoiceLabelingSet() ? boost::optional<std::string>(ioSettings.getChoiceLabelingFilename()) : boost::none, explicitModelParserOptions);
604 } else if (ioSettings.isExplicitDRNSet()) {
606 options.buildChoiceLabeling = buildSettings.isBuildChoiceLabelsSet();
609 if constexpr (std::is_same_v<ValueType, double>) {
610 valueType = Double;
611 } else if constexpr (std::is_same_v<ValueType, storm::RationalNumber>) {
612 valueType = Rational;
613 } else {
614 static_assert(std::is_same_v<ValueType, storm::RationalFunction>, "Unexpected value type.");
615 valueType = Parametric;
616 }
617 result = storm::api::buildExplicitDRNModel(ioSettings.getExplicitDRNFilename(), valueType, options);
618 } else if (ioSettings.isExplicitUmbSet()) {
620 options.buildChoiceLabeling = buildSettings.isBuildChoiceLabelsSet();
621 options.buildStateValuations = buildSettings.isBuildStateValuationsSet();
623 if constexpr (std::is_same_v<ValueType, storm::RationalFunction>) {
624 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "RationalFunction currently not supported for UMB models.");
625 } else if constexpr (std::is_same_v<ValueType, storm::RationalNumber>) {
626 options.valueType = umb::ImportOptions::ValueType::Rational;
627 } else {
628 static_assert(std::is_same_v<ValueType, double>, "Unhandled value type.");
629 options.valueType = umb::ImportOptions::ValueType::Double;
630 }
631 result = storm::api::buildExplicitUmbModel(ioSettings.getExplicitUmbFilename(), options);
632 } else {
633 STORM_LOG_THROW(ioSettings.isExplicitIMCASet(), storm::exceptions::InvalidSettingsException, "Unexpected explicit model input type.");
634 storm::parser::ExplicitModelParserOptions explicitModelParserOptions;
635 explicitModelParserOptions.fixDeadlocks = !buildSettings.isDontFixDeadlocksSet();
636 explicitModelParserOptions.buildChoiceLabels = buildSettings.isBuildChoiceLabelsSet();
637 result = storm::api::buildExplicitIMCAModel<ValueType>(ioSettings.getExplicitIMCAFilename(), explicitModelParserOptions);
638 }
639 return result;
640}
641
642inline std::shared_ptr<storm::models::ModelBase> buildModel(SymbolicInput const& input, storm::settings::modules::IOSettings const& ioSettings,
643 ModelProcessingInformation const& mpi) {
644 storm::utility::Stopwatch modelBuildingWatch(true);
645
646 std::shared_ptr<storm::models::ModelBase> result;
647 if (input.model) {
648 auto builderType = storm::utility::getBuilderType(mpi.engine);
649 if (builderType == storm::builder::BuilderType::Dd) {
650 result = applyDdLibValueType(mpi.ddType, mpi.buildValueType,
651 [&input, &mpi]<storm::dd::DdType DD, typename VT>() { return buildModelDd<DD, VT>(mpi.env, input); });
652 } else if (builderType == storm::builder::BuilderType::Explicit) {
653 result = applyValueType(mpi.buildValueType, [&input]<typename VT>() {
654 auto options = createBuildOptionsSparseFromSettings(input);
655 return buildModelSparse<VT>(input, options);
656 });
657 }
658 } else if (ioSettings.isExplicitSet() || ioSettings.isExplicitDRNSet() || ioSettings.isExplicitUmbSet() || ioSettings.isExplicitIMCASet()) {
659 STORM_LOG_THROW(mpi.engine == storm::utility::Engine::Sparse, storm::exceptions::InvalidSettingsException,
660 "Can only use sparse engine with explicit input.");
661 result = applyValueType(mpi.buildValueType, [&ioSettings]<typename VT>() {
662 return buildModelExplicit<VT>(ioSettings, storm::settings::getModule<storm::settings::modules::BuildSettings>());
663 });
664 }
665
666 modelBuildingWatch.stop();
667 if (result) {
668 STORM_PRINT("Time for model construction: " << modelBuildingWatch << ".\n\n");
669 }
670
671 return result;
672}
673
674template<typename ValueType>
675std::shared_ptr<storm::models::sparse::Model<ValueType>> preprocessSparseMarkovAutomaton(
676 std::shared_ptr<storm::models::sparse::MarkovAutomaton<ValueType>> const& model) {
679
680 std::shared_ptr<storm::models::sparse::Model<ValueType>> result = model;
681 model->close();
682 STORM_LOG_WARN_COND(!buildSettings.isCheckZenoSet() || !model->containsZenoCycle(), "MA contains a Zeno cycle. Model checking results cannot be trusted.");
683
684 if (model->isConvertibleToCtmc()) {
685 STORM_LOG_WARN_COND(false, "MA is convertible to a CTMC, consider using a CTMC instead.");
686 result = model->convertToCtmc();
687 }
688
689 if (transformationSettings.isChainEliminationSet()) {
690 if constexpr (storm::IsIntervalType<ValueType>) {
691 // Currently not enabling this for interval models, as this would require a number of additional template instantiations.
692 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Chain elimination not supported for interval models.");
693 } else {
694 // TODO: we should also transform the properties at this point.
696 transformationSettings.getLabelBehavior())
697 .first;
698 }
699 }
700
701 return result;
702}
703
704template<typename ValueType>
705std::shared_ptr<storm::models::sparse::Model<ValueType>> preprocessSparseModelBisimulation(
706 std::shared_ptr<storm::models::sparse::Model<ValueType>> const& model, SymbolicInput const& input,
707 storm::settings::modules::BisimulationSettings const& bisimulationSettings, bool graphPreserving = true) {
709 if (bisimulationSettings.isWeakBisimulationSet()) {
711 }
712 std::optional<double> tolerance = storm::settings::getModule<storm::settings::modules::GeneralSettings>().getPrecision();
713
714 STORM_LOG_INFO("Performing bisimulation minimization...");
715 return storm::api::performBisimulationMinimization<ValueType>(model, createFormulasToRespect(input.properties), bisimType, graphPreserving, tolerance);
716}
717
718template<typename ValueType>
719std::pair<std::shared_ptr<storm::models::ModelBase>, bool> preprocessModel(std::shared_ptr<storm::models::sparse::Model<ValueType>> const& model,
720 SymbolicInput const& input, ModelProcessingInformation const& mpi) {
721 STORM_LOG_THROW(mpi.buildValueType == mpi.verificationValueType, storm::exceptions::NotSupportedException,
722 "Converting value types for sparse engine is not supported.");
726
727 std::pair<std::shared_ptr<storm::models::sparse::Model<ValueType>>, bool> result = std::make_pair(model, false);
728
729 if (auto order = transformationSettings.getModelPermutation(); order.has_value()) {
730 auto seed = transformationSettings.getModelPermutationSeed();
731 STORM_PRINT_AND_LOG("Permuting model states using " << storm::utility::permutation::orderKindtoString(order.value()) << " order"
732 << (seed.has_value() ? " with seed " + std::to_string(seed.value()) : "") << ".\n");
733 result.first = storm::api::permuteModelStates(result.first, order.value(), seed);
734 result.second = true;
735 STORM_PRINT_AND_LOG("Transition matrix hash after permuting: " << result.first->getTransitionMatrix().hash() << ".\n");
736 }
737
738 if (result.first->isOfType(storm::models::ModelType::MarkovAutomaton)) {
740 result.second = true;
741 }
742
743 if (mpi.applyBisimulation) {
744 if constexpr (storm::IsIntervalType<ValueType>) {
745 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Bisimulation not supported for interval models.");
746 } else {
747 result.first = preprocessSparseModelBisimulation(result.first, input, bisimulationSettings);
748 result.second = true;
749 }
750 }
751
752 if (transformationSettings.isToDiscreteTimeModelSet()) {
753 if constexpr (storm::IsIntervalType<ValueType>) {
754 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Transformation to discrete time model not supported for interval models.");
755 } else {
756 // TODO: we should also transform the properties at this point.
758 !model->hasRewardModel("_time"),
759 "Scheduled transformation to discrete time model, but a reward model named '_time' is already present in this model. We might take "
760 "the wrong reward model later.");
761 result.first =
763 .first;
764 result.second = true;
765 }
766 }
767
768 if (transformationSettings.isToNondeterministicModelSet()) {
769 result.first = storm::api::transformToNondeterministicModel<ValueType>(std::move(*result.first));
770 result.second = true;
771 }
772
773 return result;
774}
775
776template<typename ValueType>
777void exportModel(std::shared_ptr<storm::models::sparse::Model<ValueType>> const& model, SymbolicInput const& input) {
779
780 if (ioSettings.isExportBuildSet()) {
781 storm::utility::Stopwatch modelExportWatch;
782 modelExportWatch.start();
783 STORM_PRINT("\nExporting model to '" << ioSettings.getExportBuildFilename() << "'.\n");
784 switch (ioSettings.getExportBuildFormat()) {
786 storm::api::exportSparseModelAsDot(model, ioSettings.getExportBuildFilename(), ioSettings.getExportDotMaxWidth());
787 break;
790 options.allowPlaceholders = !ioSettings.isExplicitExportPlaceholdersDisabled();
791 options.compression = ioSettings.getCompressionMode();
792 if (ioSettings.isExportDigitsSet()) {
793 options.outputPrecision = ioSettings.getExportDigits();
794 }
795 storm::api::exportSparseModelAsDrn(model, ioSettings.getExportBuildFilename(), options,
796 input.model ? input.model.get().getParameterNames() : std::vector<std::string>());
797 break;
798 }
800 storm::api::exportSparseModelAsJson(model, ioSettings.getExportBuildFilename());
801 break;
804 options.compression = ioSettings.getCompressionMode();
805 storm::api::exportSparseModelAsUmb(model, ioSettings.getExportBuildFilename(), options);
806 break;
807 }
808 default:
809 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException,
810 "Exporting sparse models in " << storm::io::toString(ioSettings.getExportBuildFormat()) << " format is not supported.");
811 }
812 modelExportWatch.stop();
813 STORM_PRINT("Time for model export: " << modelExportWatch << ".\n\n");
814 }
815
816 // TODO: The following options are depreciated and shall be removed at some point:
817
818 if (ioSettings.isExportExplicitSet()) {
819 storm::api::exportSparseModelAsDrn(model, ioSettings.getExportExplicitFilename(),
820 input.model ? input.model.get().getParameterNames() : std::vector<std::string>(),
821 !ioSettings.isExplicitExportPlaceholdersDisabled());
822 }
823
824 STORM_LOG_THROW(!ioSettings.isExportDdSet(), storm::exceptions::NotSupportedException, "Exporting in drdd format is only supported for DDs.");
825
826 if (ioSettings.isExportDotSet()) {
827 storm::api::exportSparseModelAsDot(model, ioSettings.getExportDotFilename(), ioSettings.getExportDotMaxWidth());
828 }
829}
830
831template<storm::dd::DdType DdType, typename ValueType>
834
835 if (ioSettings.isExportBuildSet()) {
836 switch (ioSettings.getExportBuildFormat()) {
838 storm::api::exportSymbolicModelAsDot(model, ioSettings.getExportBuildFilename());
839 break;
841 storm::api::exportSymbolicModelAsDrdd(model, ioSettings.getExportBuildFilename());
842 break;
843 default:
844 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException,
845 "Exporting symbolic models in " << storm::io::toString(ioSettings.getExportBuildFormat()) << " format is not supported.");
846 }
847 }
848
849 // TODO: The following options are depreciated and shall be removed at some point:
850
851 STORM_LOG_THROW(!ioSettings.isExportExplicitSet(), storm::exceptions::NotSupportedException,
852 "Exporting in drn format is only supported for sparse models.");
853
854 if (ioSettings.isExportDdSet()) {
855 storm::api::exportSymbolicModelAsDrdd(model, ioSettings.getExportDdFilename());
856 }
857
858 if (ioSettings.isExportDotSet()) {
859 storm::api::exportSymbolicModelAsDot(model, ioSettings.getExportDotFilename());
860 }
861}
862
863template<storm::dd::DdType DdType, typename ValueType>
864typename std::enable_if<DdType != storm::dd::DdType::Sylvan && !std::is_same<ValueType, double>::value, std::shared_ptr<storm::models::Model<ValueType>>>::type
866 return model;
867}
868
869template<storm::dd::DdType DdType, typename ValueType>
870typename std::enable_if<DdType == storm::dd::DdType::Sylvan || std::is_same<ValueType, double>::value, std::shared_ptr<storm::models::Model<ValueType>>>::type
872 auto ma = model->template as<storm::models::symbolic::MarkovAutomaton<DdType, ValueType>>();
873 if (!ma->isClosed()) {
874 return std::make_shared<storm::models::symbolic::MarkovAutomaton<DdType, ValueType>>(ma->close());
875 } else {
876 return model;
877 }
878}
879
880template<storm::dd::DdType DdType, typename ValueType, typename ExportValueType = ValueType>
881std::shared_ptr<storm::models::Model<ExportValueType>> preprocessDdModelBisimulation(
882 std::shared_ptr<storm::models::symbolic::Model<DdType, ValueType>> const& model, SymbolicInput const& input,
883 storm::settings::modules::BisimulationSettings const& bisimulationSettings, ModelProcessingInformation const& mpi) {
884 STORM_LOG_WARN_COND(!bisimulationSettings.isWeakBisimulationSet(),
885 "Weak bisimulation is currently not supported on DDs. Falling back to strong bisimulation.");
886
887 auto quotientFormat = bisimulationSettings.getQuotientFormat();
889 bisimulationSettings.isQuotientFormatSetFromDefaultValue()) {
890 STORM_LOG_INFO("Setting bisimulation quotient format to 'sparse'.");
892 }
893
895 ddBisimulationOptions.reuseMode = bisimulationSettings.getReuseMode();
896 ddBisimulationOptions.refinementMode = bisimulationSettings.getRefinementMode();
897 ddBisimulationOptions.initialPartitionMode = bisimulationSettings.getInitialPartitionMode();
898 ddBisimulationOptions.useRepresentatives = bisimulationSettings.isUseRepresentativesSet();
899 ddBisimulationOptions.useOriginalVariables = bisimulationSettings.isUseOriginalVariablesSet();
900
901 STORM_LOG_INFO("Performing bisimulation minimization...");
903 model, createFormulasToRespect(input.properties), storm::storage::BisimulationType::Strong, bisimulationSettings.getSignatureMode(), quotientFormat,
904 ddBisimulationOptions);
905}
906
907template<typename ExportValueType, storm::dd::DdType DdType, typename ValueType>
908std::pair<std::shared_ptr<storm::models::ModelBase>, bool> preprocessDdModelImpl(
909 std::shared_ptr<storm::models::symbolic::Model<DdType, ValueType>> const& model, SymbolicInput const& input, ModelProcessingInformation const& mpi) {
911 std::pair<std::shared_ptr<storm::models::Model<ValueType>>, bool> intermediateResult = std::make_pair(model, false);
912
913 if (model->isOfType(storm::models::ModelType::MarkovAutomaton)) {
914 intermediateResult.first = preprocessDdMarkovAutomaton(intermediateResult.first->template as<storm::models::symbolic::Model<DdType, ValueType>>());
915 intermediateResult.second = true;
916 }
917
918 std::unique_ptr<std::pair<std::shared_ptr<storm::models::Model<ExportValueType>>, bool>> result;
919 auto symbolicModel = intermediateResult.first->template as<storm::models::symbolic::Model<DdType, ValueType>>();
920 if (mpi.applyBisimulation) {
921 std::shared_ptr<storm::models::Model<ExportValueType>> newModel =
922 preprocessDdModelBisimulation<DdType, ValueType, ExportValueType>(symbolicModel, input, bisimulationSettings, mpi);
923 result = std::make_unique<std::pair<std::shared_ptr<storm::models::Model<ExportValueType>>, bool>>(newModel, true);
924 } else {
925 result = std::make_unique<std::pair<std::shared_ptr<storm::models::Model<ExportValueType>>, bool>>(
926 symbolicModel->template toValueType<ExportValueType>(), !std::is_same<ValueType, ExportValueType>::value);
927 }
928
929 if (result && result->first->isSymbolicModel() && mpi.engine == storm::utility::Engine::DdSparse) {
930 // Mark as changed.
931 result->second = true;
932
933 std::shared_ptr<storm::models::symbolic::Model<DdType, ExportValueType>> symbolicModel =
934 result->first->template as<storm::models::symbolic::Model<DdType, ExportValueType>>();
935 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas;
936 for (auto const& property : input.properties) {
937 formulas.emplace_back(property.getRawFormula());
938 }
939 result->first = storm::api::transformSymbolicToSparseModel(symbolicModel, formulas);
940 STORM_LOG_THROW(result, storm::exceptions::NotSupportedException, "The translation to a sparse model is not supported for the given model type.");
941 }
942
943 return *result;
944}
945
946template<storm::dd::DdType DdType, typename ValueType>
947std::pair<std::shared_ptr<storm::models::ModelBase>, bool> preprocessModel(std::shared_ptr<storm::models::symbolic::Model<DdType, ValueType>> const& model,
948 SymbolicInput const& input, ModelProcessingInformation const& mpi) {
949 return applyValueType(mpi.verificationValueType, [&model, &input, &mpi]<typename VT>() -> std::pair<std::shared_ptr<storm::models::ModelBase>, bool> {
950 // To safe a few template instantiations, we only consider those combinations that actually occur in the CLI
951 if constexpr (std::is_same_v<ValueType, VT> ||
952 (DdType == storm::dd::DdType::Sylvan && std::is_same_v<ValueType, storm::RationalNumber> && std::is_same_v<VT, double>)) {
953 return preprocessDdModelImpl<VT>(model, input, mpi);
954 } else {
955 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException,
956 "Unexpected combination of DD library, build value type, and verification value type.");
957 }
958 });
959}
960
962 STORM_PRINT("\nModel checking property \"" << property.getName() << "\": " << *property.getRawFormula() << " ...\n");
963}
964
965inline std::shared_ptr<storm::models::ModelBase> buildPreprocessModel(SymbolicInput const& input, ModelProcessingInformation const& mpi) {
968
969 std::shared_ptr<storm::models::ModelBase> model;
970 if (!buildSettings.isNoBuildModelSet()) {
971 model = buildModel(input, ioSettings, mpi);
972 }
973 if (!model) {
974 STORM_LOG_THROW(input.properties.empty(), storm::exceptions::InvalidSettingsException, "No input model.");
975 return nullptr;
976 }
977 model->printModelInformationToStream(std::cout);
978
979 storm::utility::Stopwatch preprocessingWatch(true);
980 auto preprocessingResult = castAndApply(model, [&input, &mpi](auto const& m) { return preprocessModel(m, input, mpi); });
981 preprocessingWatch.stop();
982 if (preprocessingResult.second) {
983 STORM_PRINT("\nTime for model preprocessing: " << preprocessingWatch << ".\n\n");
984 model = preprocessingResult.first;
985 model->printModelInformationToStream(std::cout);
986 }
987
988 return model;
989}
990
991inline std::shared_ptr<storm::models::ModelBase> buildPreprocessExportModel(SymbolicInput const& input, ModelProcessingInformation const& mpi) {
992 auto model = buildPreprocessModel(input, mpi);
993 if (model) {
994 castAndApply(model, [&input](auto const& m) { exportModel(m, input); });
995 }
996 return model;
997}
998} // namespace cli
999} // namespace storm
SylvanDdManagerEnvironment & sylvan()
DdEnvironment & dd()
uint64_t getNumberOfThreads() const
Retrieves the number of threads used by Sylvan.
BuilderOptions & setBuildAllLabels(bool newValue=true)
Should all reward models be built?
BuilderOptions & setExplorationChecks(bool newValue=true)
Should extra checks be performed during exploration.
BuilderOptions & setAddOutOfBoundsState(bool newValue=true)
Should a state for out of bounds be constructed.
BuilderOptions & setReservedBitsForUnboundedVariables(uint64_t value)
Sets the number of bits that will be reserved for unbounded integer variables.
BuilderOptions & setBuildChoiceLabels(bool newValue=true)
Should the choice labels be built?
BuilderOptions & setBuildAllRewardModels(bool newValue=true)
Should all reward models be built?
BuilderOptions & setBuildChoiceOrigins(bool newValue=true)
Should the origins the different choices be built?
BuilderOptions & setShowProgressDelay(uint64_t newValue)
Sets the delay (in seconds) between progress reports during state space exploration.
BuilderOptions & setBuildStateValuations(bool newValue=true)
Should the state valuation mapping be built?
BuilderOptions & setApplyMaximalProgressAssumption(bool newValue=true)
Should the maximal progress assumption be applied when building a Markov Automaton?
BuilderOptions & setStochasticTolerance(double newValue)
Sets the tolerance used for checking whether a distribution sums to one.
BuilderOptions & setBuildObservationValuations(bool newValue=true)
Should a observation valuation mapping be built?
BuilderOptions & setAddOverlappingGuardsLabel(bool newValue=true)
Should a state be labelled for overlapping guards.
BuilderOptions & setShowProgress(bool newValue=true)
Sets whether the progress of state space exploration should be printed.
static Model eliminateAutomatically(const Model &model, std::vector< jani::Property > properties, uint64_t locationHeuristic, uint64_t edgesHeuristic)
std::shared_ptr< storm::logic::Formula const > getRawFormula() const
Definition Property.cpp:92
std::string const & getName() const
Get the provided name.
Definition Property.cpp:23
This class represents a Markov automaton.
Base class for all sparse models.
Definition Model.h:30
Base class for all symbolic models.
Definition Model.h:42
storm::jani::Model toJani(bool allVariablesGlobal=true, std::string suffix="") const
Converts the PRISM model into an equivalent JANI model.
Definition Program.cpp:2350
This class represents the bisimulation settings.
storm::dd::bisimulation::ReuseMode getReuseMode() const
Retrieves the selected reuse mode.
storm::dd::bisimulation::QuotientFormat getQuotientFormat() const
Retrieves the format in which the quotient is to be extracted.
storm::dd::bisimulation::SignatureMode getSignatureMode() const
Retrieves the mode to compute signatures.
bool isUseOriginalVariablesSet() const
Retrieves whether the extracted quotient model is supposed to use the same variables as the original ...
storm::dd::bisimulation::InitialPartitionMode getInitialPartitionMode() const
Retrieves the initial partition mode.
bool isQuotientFormatSetFromDefaultValue() const
Retrieves whether the format in which the quotient is to be extracted has been set from its default v...
bool isUseRepresentativesSet() const
Retrieves whether representatives for blocks are to be used instead of the block numbers.
storm::dd::bisimulation::RefinementMode getRefinementMode() const
Retrieves the refinement mode to use.
bool isWeakBisimulationSet() const
Retrieves whether weak bisimulation is to be used.
bool isBuildStateValuationsSet() const
Retrieves whether the choice labels should be build.
bool isDontFixDeadlocksSet() const
Retrieves whether the dont-fix-deadlocks option was set.
bool isBuildObservationValuationsSet() const
Retrieves whether the observation valuations should be build.
bool isBuildChoiceLabelsSet() const
Retrieves whether the choice labels should be build.
This class represents the markov chain settings.
Definition IOSettings.h:20
bool isJaniPropertiesSet() const
Retrieves whether the jani-property option was set.
std::string getExplicitIMCAFilename() const
Retrieves the name of the file that contains the model in the IMCA format.
bool areJaniPropertiesSelected() const
Retrieves whether one or more jani-properties have been selected.
std::string getChoiceLabelingFilename() const
Retrieves the name of the file that contains the choice labeling if the model was given using the exp...
bool isStateRewardsSet() const
Retrieves whether the state reward option was set.
std::string getProperty() const
Retrieves the property specified with the property option.
std::string getJaniInputFilename() const
Retrieves the name of the file that contains the JANI model specification if the model was given usin...
bool isChoiceLabelingSet() const
Retrieves whether the choice labeling option was set.
bool isPrismOrJaniInputSet() const
Retrieves whether the JANI or PRISM input option was set.
std::string getPropertyFilter() const
Retrieves the property filter.
std::string getPrismInputFilename() const
Retrieves the name of the file that contains the PRISM model specification if the model was given usi...
bool isExplicitDRNSet() const
Retrieves whether the explicit option with DRN was set.
std::string getExplicitDRNFilename() const
Retrieves the name of the file that contains the model in the DRN format.
std::string getLabelingFilename() const
Retrieves the name of the file that contains the state labeling if the model was given using the expl...
boost::optional< std::vector< std::string > > getQvbsPropertyFilter() const
Retrieves the selected property names.
std::string getStateRewardsFilename() const
Retrieves the name of the file that contains the state rewards if the model was given using the expli...
bool isExplicitUmbSet() const
Retrieves whether the explicit option with UMB was set.
std::string getTransitionRewardsFilename() const
Retrieves the name of the file that contains the transition rewards if the model was given using the ...
bool isPropertySet() const
Retrieves whether the property option was set.
std::string getQvbsModelName() const
Retrieves the specified model (short-)name of the QVBS.
std::vector< std::string > getSelectedJaniProperties() const
std::string getTransitionFilename() const
Retrieves the name of the file that contains the transitions if the model was given using the explici...
uint64_t getQvbsInstanceIndex() const
Retrieves the selected model instance (file + open parameters of the model).
bool isExplicitIMCASet() const
Retrieves whether the explicit option with IMCA was set.
bool isPrismInputSet() const
Retrieves whether the PRISM language option was set.
bool isTransitionRewardsSet() const
Retrieves whether the transition reward option was set.
std::string getExplicitUmbFilename() const
Retrieves the name of the file that contains the model in the UMB format.
bool isExplicitSet() const
Retrieves whether the explicit option was set.
This class provides easy access to a benchmark of the Quantitative Verification Benchmark Set http://...
Definition Qvbs.h:18
std::string const & getJaniFile(uint64_t instanceIndex=0) const
Definition Qvbs.cpp:108
std::string getInfo(uint64_t instanceIndex=0, boost::optional< std::vector< std::string > > propertyFilter=boost::none) const
Definition Qvbs.cpp:119
std::string const & getConstantDefinition(uint64_t instanceIndex=0) const
Definition Qvbs.cpp:113
storm::utility::Engine getEngine() const
Retrieve "good" settings after calling predict.
void predict(storm::jani::Model const &model, storm::jani::Property const &property)
Predicts "good" settings for the provided model checking query.
A class that provides convenience operations to display run times.
Definition Stopwatch.h:13
void start()
Start stopwatch (again) and start measuring time.
Definition Stopwatch.cpp:48
void stop()
Stop stopwatch and add measured time to total time.
Definition Stopwatch.cpp:42
#define STORM_LOG_INFO(message)
Definition logging.h:27
#define STORM_LOG_WARN(message)
Definition logging.h:28
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_WARN_COND(cond, message)
Definition macros.h:36
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
std::shared_ptr< storm::models::sparse::Model< ValueType > > transformToNondeterministicModel(storm::models::sparse::Model< ValueType > &&model)
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)
void exportSymbolicModelAsDot(std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > const &model, std::string const &filename)
Definition export.h:75
void exportSparseModelAsUmb(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, storm::umb::ExportOptions const &options={})
Definition export.h:65
storm::prism::Program parseProgram(std::string const &filename, bool prismCompatibility, bool simplify)
std::shared_ptr< storm::models::ModelBase > buildExplicitUmbModel(std::string const &umbLocation, storm::umb::ImportOptions const &options={})
std::shared_ptr< storm::models::sparse::Model< ValueType > > permuteModelStates(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, storm::utility::permutation::OrderKind order, std::optional< uint64_t > seed=std::nullopt)
Permutes the order of the states of the model according to the given order.
storm::jani::Property createMultiObjectiveProperty(std::vector< storm::jani::Property > const &properties, bool lexicographic)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildExplicitIMCAModel(std::string const &imcaFile, storm::parser::ExplicitModelParserOptions const &options=storm::parser::ExplicitModelParserOptions())
std::pair< std::shared_ptr< storm::models::sparse::Model< ValueType > >, std::vector< std::shared_ptr< storm::logic::Formula const > > > eliminateNonMarkovianChains(std::shared_ptr< storm::models::sparse::MarkovAutomaton< ValueType > > const &ma, std::vector< std::shared_ptr< storm::logic::Formula const > > const &formulas, storm::transformer::EliminationLabelBehavior labelBehavior)
Eliminates chains of non-Markovian states from a given Markov Automaton.
std::pair< storm::jani::Model, std::vector< storm::jani::Property > > parseJaniModel(std::string const &filename, boost::optional< std::vector< std::string > > const &propertyFilter)
std::vector< storm::jani::Property > parseProperties(storm::parser::FormulaParser &formulaParser, std::string const &inputString, boost::optional< std::set< std::string > > const &propertyFilter)
std::shared_ptr< storm::models::sparse::Model< ValueType > > transformSymbolicToSparseModel(std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > const &symbolicModel, std::vector< std::shared_ptr< storm::logic::Formula const > > const &formulas=std::vector< std::shared_ptr< storm::logic::Formula const > >())
Transforms the given symbolic model to a sparse model.
std::pair< std::shared_ptr< storm::models::sparse::Model< ValueType > >, std::vector< std::shared_ptr< storm::logic::Formula const > > > transformContinuousToDiscreteTimeSparseModel(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::vector< std::shared_ptr< storm::logic::Formula const > > const &formulas)
Transforms the given continuous model to a discrete time model.
void exportSymbolicModelAsDrdd(std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > const &model, std::string const &filename)
Definition export.h:44
std::shared_ptr< storm::models::symbolic::Model< LibraryType, ValueType > > buildSymbolicModel(storm::Environment const &env, storm::storage::SymbolicModelDescription const &model, std::vector< std::shared_ptr< storm::logic::Formula const > > const &formulas, bool buildFullModel=false, bool applyMaximumProgress=true, bool fixDeadlocks=true)
Definition builder.h:37
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::storage::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options, typename storm::builder::ExplicitModelBuilder< ValueType >::Options const &explorationOptions=typename storm::builder::ExplicitModelBuilder< ValueType >::Options())
Definition builder.h:117
std::vector< storm::jani::Property > parsePropertiesForSymbolicModelDescription(std::string const &inputString, storm::storage::SymbolicModelDescription const &modelDescription, boost::optional< std::set< std::string > > const &propertyFilter)
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
void simplifyJaniModel(storm::jani::Model &model, std::vector< storm::jani::Property > &properties, storm::jani::ModelFeatures const &supportedFeatures)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildExplicitDRNModel(std::string const &drnFile, storm::parser::DirectEncodingParserOptions const &options=storm::parser::DirectEncodingParserOptions())
boost::optional< std::set< std::string > > parsePropertyFilter(std::string const &propertyFilter)
storm::jani::ModelFeatures getSupportedJaniFeatures(storm::builder::BuilderType const &builderType)
Definition builder.h:32
void exportSparseModelAsDrn(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, std::vector< std::string > const &parameterNames={}, bool allowPlaceholders=true)
Definition export.h:30
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildExplicitModel(std::string const &transitionsFile, std::string const &labelingFile, boost::optional< std::string > const &stateRewardsFile, boost::optional< std::string > const &transitionRewardsFile, boost::optional< std::string > const &choiceLabelingFile, storm::parser::ExplicitModelParserOptions const &options=storm::parser::ExplicitModelParserOptions())
void exportSparseModelAsJson(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename)
Definition export.h:57
void exportSparseModelAsDot(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, size_t maxWidth=30)
Definition export.h:49
std::vector< storm::jani::Property > substituteConstantsInProperties(std::vector< storm::jani::Property > const &properties, std::map< storm::expressions::Variable, storm::expressions::Expression > const &substitution)
void exportModel(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, SymbolicInput const &input)
void parseSymbolicModelDescription(storm::settings::modules::IOSettings const &ioSettings, SymbolicInput &input)
std::shared_ptr< storm::models::ModelBase > buildModelExplicit(storm::settings::modules::IOSettings const &ioSettings, storm::settings::modules::BuildSettings const &buildSettings)
auto castAndApply(std::shared_ptr< storm::models::ModelBase > const &model, auto const &callback)
SymbolicInput parseSymbolicInputQvbs(storm::settings::modules::IOSettings const &ioSettings)
void getModelProcessingInformationAutomatic(SymbolicInput const &input, ModelProcessingInformation &mpi)
std::shared_ptr< storm::models::sparse::Model< ValueType > > preprocessSparseModelBisimulation(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, SymbolicInput const &input, storm::settings::modules::BisimulationSettings const &bisimulationSettings, bool graphPreserving=true)
auto applyValueType(ModelProcessingInformation::ValueType vt, auto const &callback)
std::shared_ptr< storm::models::ModelBase > buildPreprocessExportModel(SymbolicInput const &input, ModelProcessingInformation const &mpi)
SymbolicInput parseSymbolicInput()
std::shared_ptr< storm::models::ModelBase > buildModelSparse(SymbolicInput const &input, storm::builder::BuilderOptions const &options)
std::enable_if< DdType!=storm::dd::DdType::Sylvan &&!std::is_same< ValueType, double >::value, std::shared_ptr< storm::models::Model< ValueType > > >::type preprocessDdMarkovAutomaton(std::shared_ptr< storm::models::symbolic::Model< DdType, ValueType > > const &model)
std::shared_ptr< storm::models::sparse::Model< ValueType > > preprocessSparseMarkovAutomaton(std::shared_ptr< storm::models::sparse::MarkovAutomaton< ValueType > > const &model)
std::shared_ptr< storm::models::ModelBase > buildModelDd(storm::Environment const &env, SymbolicInput const &input)
std::pair< SymbolicInput, ModelProcessingInformation > preprocessSymbolicInput(SymbolicInput const &input)
std::shared_ptr< storm::models::ModelBase > buildModel(SymbolicInput const &input, storm::settings::modules::IOSettings const &ioSettings, ModelProcessingInformation const &mpi)
void printModelCheckingProperty(storm::jani::Property const &property)
void parseProperties(storm::settings::modules::IOSettings const &ioSettings, SymbolicInput &input, boost::optional< std::set< std::string > > const &propertyFilter)
ModelProcessingInformation getModelProcessingInformation(SymbolicInput const &input, std::shared_ptr< SymbolicInput > const &transformedJaniInput=nullptr)
Sets the model processing information based on the given input.
std::shared_ptr< storm::models::Model< ExportValueType > > preprocessDdModelBisimulation(std::shared_ptr< storm::models::symbolic::Model< DdType, ValueType > > const &model, SymbolicInput const &input, storm::settings::modules::BisimulationSettings const &bisimulationSettings, ModelProcessingInformation const &mpi)
auto applyDdLibValueType(storm::dd::DdType dd, ModelProcessingInformation::ValueType vt, auto const &callback)
std::shared_ptr< storm::models::ModelBase > buildPreprocessModel(SymbolicInput const &input, ModelProcessingInformation const &mpi)
storm::builder::BuilderOptions createBuildOptionsSparseFromSettings(SymbolicInput const &input)
void ensureNoUndefinedPropertyConstants(std::vector< storm::jani::Property > const &properties)
std::vector< std::shared_ptr< storm::logic::Formula const > > createFormulasToRespect(std::vector< storm::jani::Property > const &properties)
std::pair< std::shared_ptr< storm::models::ModelBase >, bool > preprocessModel(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, SymbolicInput const &input, ModelProcessingInformation const &mpi)
std::pair< std::shared_ptr< storm::models::ModelBase >, bool > preprocessDdModelImpl(std::shared_ptr< storm::models::symbolic::Model< DdType, ValueType > > const &model, SymbolicInput const &input, ModelProcessingInformation const &mpi)
storm::builder::ExplicitModelBuilder< ValueType >::Options createExplorationOptionsFromSettings()
std::string toString(CompressionMode const &input)
SettingsType const & getModule()
Get module.
SettingsManager const & manager()
Retrieves the settings manager.
std::string orderKindtoString(OrderKind order)
Converts the given order to a string.
bool canHandle< storm::RationalFunction >(storm::utility::Engine const &engine, storm::storage::SymbolicModelDescription::ModelType const &modelType, storm::modelchecker::CheckTask< storm::logic::Formula, storm::RationalFunction > const &checkTask)
Definition Engine.cpp:196
Engine
An enumeration of all engines.
Definition Engine.h:31
template bool canHandle< storm::RationalNumber >(storm::utility::Engine const &, std::vector< storm::jani::Property > const &, storm::storage::SymbolicModelDescription const &)
template bool canHandle< double >(storm::utility::Engine const &, std::vector< storm::jani::Property > const &, storm::storage::SymbolicModelDescription const &)
storm::builder::BuilderType getBuilderType(Engine const &engine)
Returns the builder type used for the given engine.
Definition Engine.cpp:78
carl::Interval< storm::RationalNumber > RationalInterval
carl::Interval< double > Interval
Interval type.
constexpr bool IsIntervalType
Helper to check if a type is an interval.
carl::RationalFunction< Polynomial, true > RationalFunction
#define STORM_PRINT_AND_LOG(message)
Definition print.h:20
#define STORM_PRINT(message)
Define the macros that print information to stdout and optionally also log it.
Definition print.h:14
std::vector< storm::jani::Property > properties
boost::optional< storm::storage::SymbolicModelDescription > model
boost::optional< std::vector< storm::jani::Property > > preprocessedProperties
bool allowPlaceholders
Allow placeholders for rational functions in the exported DRN file.
storm::io::CompressionMode compression
The type of compression used for the exported DRN file.
std::optional< std::size_t > outputPrecision
If set, the output precision for floating point numbers in the exported DRN file is set to the given ...
storm::io::CompressionMode compression
The type of compression used for the exported UMB model.
bool buildChoiceLabeling
Controls building of choice labelings.
bool buildObservationValuations
Controls building of observation valuations.
bool buildStateValuations
Controls building of state valuations.