21namespace expressions {
22class ExpressionManager;
30class SynchronizationVector;
31struct ArrayEliminatorData;
33struct InformationObject;
47 Model(std::string
const& name,
ModelType const& modelType, uint64_t version = 1,
48 boost::optional<std::shared_ptr<storm::expressions::ExpressionManager>>
const& expressionManager = boost::none);
97 std::string
const&
getName()
const;
102 void setName(std::string
const& newName);
111 std::shared_ptr<storm::utility::solver::SmtSolverFactory>
const& smtSolverFactory = std::make_shared<storm::utility::solver::SmtSolverFactory>())
const;
118 bool hasAction(std::string
const& name)
const;
147 std::vector<Action>
const&
getActions()
const;
398 std::set<std::string>
getActionNames(
bool includeSilent =
true)
const;
442 void substitute(std::map<storm::expressions::Variable, storm::expressions::Expression>
const& substitution,
bool const substituteTranscendentalNumbers);
544 std::vector<std::reference_wrapper<storm::jani::Automaton const>>
const& automata = {})
const;
574 std::vector<std::reference_wrapper<Automaton const>>
const& automata)
const;
663 std::shared_ptr<storm::expressions::ExpressionManager> expressionManager;
666 std::vector<Action> actions;
669 std::unordered_map<std::string, uint64_t> actionToIndex;
673 std::unordered_map<std::string, storm::expressions::Expression> nonTrivialRewardModels;
679 std::vector<Constant> constants;
682 std::unordered_map<std::string, uint64_t> constantToIndex;
689 std::unordered_map<std::string, FunctionDefinition> globalFunctions;
692 std::vector<Automaton> automata;
695 std::unordered_map<std::string, size_t> automatonToIndex;
698 std::shared_ptr<Composition> composition;
This class is responsible for managing a set of typed variables and all expressions using these varia...
void setInitialStatesRestriction(storm::expressions::Expression const &initialStatesRestriction)
Sets the expression restricting the legal initial values of the global variables.
bool hasUndefinedConstants() const
Retrieves whether the model still has undefined constants.
storm::expressions::ExpressionManager & getManager() const
Retrieves the expression manager responsible for the expressions in the model.
std::set< std::string > getActionNames(bool includeSilent=true) const
Retrieves the set of action names.
std::size_t getNumberOfEdges() const
Retrieves the total number of edges in this model.
Model & replaceUnassignedVariablesWithConstants()
Replaces each variable to which we never assign a value with a constant.
storm::storage::FlatSet< uint64_t > const & getNonsilentActionIndices() const
Retrieves all non-silent action indices of the model.
bool hasAction(std::string const &name) const
Checks whether the model has an action with the given name.
Variable const & getGlobalVariable(std::string const &name) const
Retrieves the global variable with the given name if one exists.
std::vector< storm::expressions::Expression > getAllRangeExpressions(std::vector< std::reference_wrapper< storm::jani::Automaton const > > const &automata={}) const
Retrieves a list of expressions that characterize the legal values of the variables in this model.
VariableSet & getGlobalVariables()
Retrieves the variables of this automaton.
Model()
Creates an uninitialized model.
storm::expressions::ExpressionManager & getExpressionManager() const
Retrieves the manager responsible for the expressions in the JANI model.
std::unordered_map< std::string, storm::expressions::Expression > const & getNonTrivialRewardExpressions() const
Retrieves all available non-trivial reward model names and expressions of the model.
bool hasInitialStatesRestriction() const
Retrieves whether there is an expression restricting the legal initial values of the global variables...
Model & substituteConstantsInPlace(bool const substituteTranscendentalNumbers)
Substitutes all constants in all expressions of the model.
bool addNonTrivialRewardExpression(std::string const &identifier, storm::expressions::Expression const &rewardExpression)
Adds a reward expression, i.e., a reward model that does not consist of a single, global,...
storm::expressions::Expression getRewardModelExpression(std::string const &identifier) const
Retrieves the defining reward expression of the reward model with the given identifier.
bool reusesActionsInComposition() const
Checks whether in the composition, actions are reused: That is, if the model is put in parallel compo...
void setSystemComposition(std::shared_ptr< Composition > const &composition)
Sets the system composition expression of the JANI model.
static uint64_t encodeAutomatonAndEdgeIndices(uint64_t automatonIndex, uint64_t edgeIndex)
Encode and decode a tuple of automaton and edge index in one 64-bit index.
Composition const & getSystemComposition() const
Retrieves the system composition expression.
bool hasTransientEdgeDestinationAssignments() const
Retrieves whether there is any transient edge destination assignment in the model.
storm::expressions::Expression const & getInitialStatesRestriction() const
Gets the expression restricting the legal initial values of the global variables.
void liftTransientEdgeDestinationAssignments(int64_t maxLevel=0)
Lifts the common edge destination assignments of transient variables to edge assignments.
void replaceAutomaton(uint64_t index, Automaton const &newAutomaton)
Replaces the automaton at index with a new automaton.
std::shared_ptr< Composition > getStandardSystemComposition() const
Gets the system composition as the standard, fully-synchronizing parallel composition.
InformationObject getModelInformation() const
Returns various information of this model.
std::set< storm::expressions::Variable > getAllExpressionVariables(bool includeLocationExpressionVariables=false) const
Retrieves all expression variables used by this model.
storm::expressions::Expression getInitialStatesExpression() const
Retrieves the expression defining the legal initial values of the variables.
bool hasStandardComposition() const
Retrieves whether this model has the standard composition, that is it composes all automata in parall...
static const uint64_t SILENT_ACTION_INDEX
The index of the silent action.
std::vector< Automaton > & getAutomata()
Retrieves the automata of the model.
ModelType const & getModelType() const
Retrieves the type of the model.
bool hasNonTrivialRewardExpression() const
Returns true iff there is a non-trivial reward model, i.e., a reward model that does not consist of a...
std::vector< Constant > const & getConstants() const
Retrieves the constants of the model.
std::vector< Action > const & getActions() const
Retrieves the actions of the model.
bool undefinedConstantsAreGraphPreserving() const
Checks that undefined constants (parameters) of the model preserve the graph of the underlying model.
void pushEdgeAssignmentsToDestinations()
Model substituteConstants() const
Substitutes all constants in all expressions of the model.
std::size_t getTotalNumberOfNonTransientVariables() const
Number of global and local variables.
storm::expressions::Expression getLabelExpression(Variable const &transientVariable, std::vector< std::reference_wrapper< Automaton const > > const &automata) const
Creates the expression that characterizes all states in which the provided transient boolean variable...
void addConstant(Constant const &constant)
Adds the given constant to the model.
void substitute(std::map< storm::expressions::Variable, storm::expressions::Expression > const &substitution, bool const substituteTranscendentalNumbers)
Substitutes all expression variables in all expressions of the model.
uint64_t getJaniVersion() const
Retrieves the JANI-version of the model.
void substituteFunctions()
Substitutes all function calls with the corresponding function definition.
void setStandardSystemComposition()
Sets the system composition to be the fully-synchronizing parallel composition of all automat.
Variable const & addVariable(Variable const &variable)
Adds the given variable to this model.
Action const & getAction(uint64_t index) const
Retrieves the action with the given index.
std::vector< std::pair< std::string, storm::expressions::Expression > > getAllRewardModelExpressions() const
Retrieves all available reward model names and expressions of the model.
void checkValid() const
Checks if the model is valid JANI, which should be verified before any further operations are applied...
std::string const & getName() const
Retrieves the name of the model.
bool hasConstant(std::string const &name) const
Retrieves whether the model has a constant with the given name.
void removeConstant(std::string const &name)
Removes (without checks) a constant from the model.
bool isNonTrivialRewardModelExpression(std::string const &identifier) const
Returns true iff the given identifier corresponds to a non-trivial reward expression i....
bool isDeterministicModel() const
Determines whether this model is a deterministic one in the sense that each state only has one choice...
bool hasNonGlobalTransientVariable() const
Retrieves whether this model has a non-global transient variable.
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...
void writeDotToStream(std::ostream &outStream=std::cout) const
FunctionDefinition const & addFunctionDefinition(FunctionDefinition const &functionDefinition)
Adds the given function definition.
Model defineUndefinedConstants(std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions) const
Defines the undefined constants of the model by the given expressions.
static const std::string SILENT_ACTION_NAME
The name of the silent action.
bool containsArrayVariables() const
Returns true if at least one array variable occurs in the model.
Constant const & getConstant(std::string const &name) const
Retrieves the constant with the given name (if any).
std::unordered_map< std::string, uint64_t > const & getActionToIndexMap() const
Retrieves the mapping from action names to their indices.
uint64_t addAction(Action const &action)
Adds an action to the model.
void makeStandardJaniCompliant()
std::size_t getNumberOfAutomata() const
Retrieves the number of automata in this model.
bool isDiscreteTimeModel() const
Determines whether this model is a discrete-time model.
bool hasGlobalVariable(std::string const &name) const
Retrieves whether this model has a global variable with the given name.
ModelFeatures const & getModelFeatures() const
Retrieves the enabled model features.
std::map< storm::expressions::Variable, storm::expressions::Expression > getConstantsSubstitution() const
Retrieves a mapping from expression variables associated with defined constants of the model to their...
bool hasAutomaton(std::string const &name) const
Rerieves whether there exists an automaton with the given name.
Model restrictEdges(storm::storage::FlatSet< uint_fast64_t > const &automataAndEdgeIndices) const
Creates a new model that only contains the selected edges.
uint64_t addAutomaton(Automaton const &automaton)
Adds the given automaton to the automata of this model.
Automaton & getAutomaton(std::string const &name)
Retrieves the automaton with the given name.
bool hasNonTrivialInitialStates() const
Retrieves whether there are non-trivial initial states in the model or any of the contained automata.
void setModelType(ModelType const &)
Changes (only) the type declaration of the model.
bool isLinear() const
Checks the model for linearity.
void setName(std::string const &newName)
Sets the name of the model.
std::map< uint64_t, std::string > getActionIndexToNameMap() const
Builds a map with action indices mapped to their names.
uint64_t getActionIndex(std::string const &name) const
Get the index of the action.
bool usesAssignmentLevels(bool onlyTransient=false) const
Retrieves whether the model uses an assignment level other than zero.
void finalize()
After adding all components to the model, this method has to be called.
std::set< storm::expressions::Variable > getAllLocationExpressionVariables() const
Retrieves all location expression variables used by this model.
bool hasStandardCompliantComposition() const
Checks whether the composition has no nesting.
uint64_t getAutomatonIndex(std::string const &name) const
Retrieves the index of the given automaton.
Model & operator=(Model &&other)
ModelFeatures restrictToFeatures(ModelFeatures const &modelFeatures)
Attempts to eliminate all features of this model that are not in the given set of features.
bool hasTrivialInitialStatesExpression() const
Retrieves whether the initial states expression is trivial in the sense that no automaton has an init...
Model & operator=(Model const &other)
Copy-assigns the given model.
std::unordered_map< std::string, FunctionDefinition > const & getGlobalFunctionDefinitions() const
Retrieves all global function definitions.
ArrayEliminatorData eliminateArrays(bool keepNonTrivialArrayAccess=false)
Eliminates occurring array variables and expressions by replacing array variables by multiple basic v...
Model substituteConstantsFunctionsTranscendentals() const
std::vector< std::reference_wrapper< Constant const > > getUndefinedConstants() const
Retrieves all undefined constants of the model.
static std::pair< uint64_t, uint64_t > decodeAutomatonAndEdgeIndices(uint64_t index)
std::ostream & operator<<(std::ostream &stream, Assignment const &assignment)
boost::container::flat_set< Key, std::less< Key >, boost::container::new_allocator< Key > > FlatSet
Redefinition of flat_set was needed, because from Boost 1.70 on the default allocator is set to void.