Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
prism.cpp
Go to the documentation of this file.
2
6#include "storm/utility/cli.h"
8
9namespace storm {
10namespace utility {
11namespace prism {
12
14 std::map<storm::expressions::Variable, storm::expressions::Expression> const& constantDefinitions) {
15 storm::prism::Program result = program.defineUndefinedConstants(constantDefinitions);
16 result = result.substituteConstantsFormulas();
17 return result;
18}
19
20storm::prism::Program preprocess(storm::prism::Program const& program, std::string const& constantDefinitionString) {
21 return preprocess(program, storm::utility::cli::parseConstantDefinitionString(program.getManager(), constantDefinitionString));
22}
23
25 if (program.hasUndefinedConstants()) {
26 std::vector<std::reference_wrapper<storm::prism::Constant const>> undefinedConstants = program.getUndefinedConstants();
27 std::stringstream stream;
28 bool printComma = false;
29 for (auto const& constant : undefinedConstants) {
30 if (printComma) {
31 stream << ", ";
32 } else {
33 printComma = true;
34 }
35 stream << constant.get().getName() << " (" << constant.get().getType() << ")";
36 }
37 stream << ".";
38 STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "Program still contains these undefined constants: " + stream.str());
39 }
40}
41} // namespace prism
42} // namespace utility
43} // namespace storm
Program defineUndefinedConstants(std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions) const
Defines the undefined constants according to the given map and returns the resulting program.
Definition Program.cpp:997
std::vector< std::reference_wrapper< Constant const > > getUndefinedConstants() const
Retrieves the undefined constants in the program.
Definition Program.cpp:368
Program substituteConstantsFormulas(bool substituteConstants=true, bool substituteFormulas=true) const
Substitutes all constants and/or formulas appearing in the expressions of the program by their defini...
Definition Program.cpp:1091
storm::expressions::ExpressionManager & getManager() const
Retrieves the manager responsible for the expressions of this program.
Definition Program.cpp:2378
bool hasUndefinedConstants() const
Retrieves whether there are undefined constants of any type in the program.
Definition Program.cpp:285
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
std::map< storm::expressions::Variable, storm::expressions::Expression > parseConstantDefinitionString(storm::expressions::ExpressionManager const &manager, std::string const &constantDefinitionString)
Definition cli.cpp:20
storm::prism::Program preprocess(storm::prism::Program const &program, std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions)
Definition prism.cpp:13
void requireNoUndefinedConstants(storm::prism::Program const &program)
Definition prism.cpp:24