43 STORM_LOG_ERROR(
"Can not transform variable " << pair.second <<
" into locations since it can not be made local to automaton " << pair.first
66 std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory;
68 smtSolverFactory = std::make_shared<storm::utility::solver::SmtSolverFactory>();
70 smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>();
80 STORM_LOG_WARN_COND(uneliminatedFeatures.empty(),
"The following model features could not be eliminated: " << uneliminatedFeatures.toString());
87 for (
auto& f : properties) {
88 for (
auto const& constant : f.getUndefinedConstants()) {
117 std::vector<storm::jani::Property>
const& properties,
121 if (res.second.empty()) {
122 std::vector<storm::jani::Property> clonedProperties;
123 for (
auto const& p : properties) {
124 clonedProperties.push_back(p.clone());
126 res.second = std::move(clonedProperties);
144 std::ofstream stream;
146 stream << program <<
'\n';
149 if (!properties.empty()) {
151 for (
auto const& prop : properties) {
152 stream << prop.asPrismSyntax() <<
'\n';
153 STORM_LOG_WARN_COND(!prop.containsUndefinedConstants(),
"A property contains undefined constants. These might not be exported correctly.");
159 ostream << program <<
'\n';
160 for (
auto const& prop : properties) {
161 STORM_LOG_WARN_COND(!prop.containsUndefinedConstants(),
"A property contains undefined constants. These might not be exported correctly.");
162 ostream << prop.asPrismSyntax() <<
'\n';
static Model eliminateAutomatically(const Model &model, std::vector< jani::Property > properties, uint64_t locationHeuristic, uint64_t edgesHeuristic)
ReturnType transform(std::string const &automatonName, std::string const &variableName)
void makeVariablesGlobal(Model &model) const
Moves as many variables to the global scope as possible.
void makeVariablesLocal(Model &model, storm::OptionalRef< std::vector< Property > const > properties=storm::NullRef) const
Moves as many variables to a local scope as possible.
void makeVariableLocal(storm::expressions::Variable const &variable, Model &model, uint64_t automatonIndex) const
Moves the given variable into the local scope of the automaton with the given index.
std::pair< bool, uint64_t > canMakeVariableLocal(storm::expressions::Variable const &variable, Model const &model, storm::OptionalRef< std::vector< Property > const > properties=storm::NullRef, std::optional< uint64_t > automatonIndex=std::nullopt) const
Checks whether this variable can be made local without introducing out-of-scope accesses.
static void toFile(storm::jani::Model const &janiModel, std::vector< storm::jani::Property > const &formulas, std::string const &filepath, bool checkValid=true, bool compact=false)
static void toStream(storm::jani::Model const &janiModel, std::vector< storm::jani::Property > const &formulas, std::ostream &ostream, bool checkValid=false, bool compact=false)
Model & replaceUnassignedVariablesWithConstants()
Replaces each variable to which we never assign a value with a constant.
Variable const & getGlobalVariable(std::string const &name) const
Retrieves the global variable with the given name if one exists.
Model & substituteConstantsInPlace(bool const substituteTranscendentalNumbers)
Substitutes all constants in all expressions of the model.
void pushEdgeAssignmentsToDestinations()
void addConstant(Constant const &constant)
Adds the given constant to the model.
bool hasConstant(std::string const &name) const
Retrieves whether the model has a constant with the given name.
void simplifyComposition()
Attempts to simplify the composition.
Model flattenComposition(std::shared_ptr< storm::utility::solver::SmtSolverFactory > const &smtSolverFactory=std::make_shared< storm::utility::solver::SmtSolverFactory >()) const
Flatten the composition to obtain an equivalent model that contains exactly one automaton that has th...
bool hasGlobalVariable(std::string const &name) const
Retrieves whether this model has a global variable with the given name.
void setName(std::string const &newName)
Sets the name of the model.
uint64_t getAutomatonIndex(std::string const &name) const
Retrieves the index of the given automaton.
ModelFeatures restrictToFeatures(ModelFeatures const &modelFeatures)
Attempts to eliminate all features of this model that are not in the given set of features.
storm::expressions::Variable const & getExpressionVariable() const
Retrieves the associated expression variable.
std::map< storm::expressions::Variable, storm::expressions::Expression > getConstantsFormulasSubstitution(bool getConstantsSubstitution=true, bool getFormulasSubstitution=true) const
Retrieves a mapping of all defined constants and formula variables to their defining expressions.
Program flattenModules(std::shared_ptr< storm::utility::solver::SmtSolverFactory > const &smtSolverFactory=std::shared_ptr< storm::utility::solver::SmtSolverFactory >(new storm::utility::solver::SmtSolverFactory())) const
Creates an equivalent program that contains exactly one module.
Program simplify()
Entry point for static analysis for simplify.
storm::jani::Model toJani(bool allVariablesGlobal=true, std::string suffix="") const
Converts the PRISM model into an equivalent JANI model.
#define STORM_LOG_ERROR(message)
#define STORM_LOG_WARN_COND(cond, message)
void transformPrism(storm::prism::Program &prismProgram, std::vector< storm::jani::Property > &properties, bool simplify, bool flatten)
void exportJaniToFile(storm::jani::Model const &model, std::vector< storm::jani::Property > const &properties, std::string const &filename, bool compact)
void transformJani(storm::jani::Model &janiModel, std::vector< storm::jani::Property > &properties, storm::converter::JaniConversionOptions const &options)
void printPrismToStream(storm::prism::Program const &program, std::vector< storm::jani::Property > const &properties, std::ostream &ostream)
std::pair< storm::jani::Model, std::vector< storm::jani::Property > > convertPrismToJani(storm::prism::Program const &program, storm::converter::PrismToJaniConverterOptions options)
void exportPrismToFile(storm::prism::Program const &program, std::vector< storm::jani::Property > const &properties, std::string const &filename)
std::vector< storm::jani::Property > substituteConstantsInProperties(std::vector< storm::jani::Property > const &properties, std::map< storm::expressions::Variable, storm::expressions::Expression > const &substitution)
void printJaniToStream(storm::jani::Model const &model, std::vector< storm::jani::Property > const &properties, std::ostream &ostream, bool compact)
void closeFile(std::ofstream &stream)
Close the given file after writing.
void openFile(std::string const &filepath, std::ofstream &filestream, bool append=false, bool silent=false)
Open the given file for writing.
SettingsType const & getModule()
Get module.
uint64_t locationEliminationLocationHeuristic
Controls which locations are eliminated if location elimination is enabled.
boost::optional< std::string > modelName
If given, the model will get this name.
bool globalVars
If set, variables will be made global wherever possible.
bool replaceUnassignedVariablesWithConstants
If set, local and global variables that are (a) not assigned to some value and (b) have a known initi...
uint64_t locationEliminationEdgeHeuristic
bool addPropertyConstants
Add constants that are defined in the properties to the model.
bool localVars
If set, variables will be made local wherever possible.
bool locationElimination
If set, attempts to perform location elimination of states to reduce the state space of the final mod...
storm::jani::ModelFeatures allowedModelFeatures
Only these model features are allowed in the output.
bool substituteConstants
If set, constants in expressions are substituted with their definition.
std::vector< std::pair< std::string, std::string > > locationVariables
(Automaton,Variable)-pairs that will be transformed to location variables of the respective automaton...
bool simplifyComposition
If set, attempts to simplify the system composition.
bool flatten
If set, the model is transformed into a single automaton.
bool edgeAssignments
If set, the model might have transient assignments to the edges.
JaniConversionOptions janiOptions