#pragma once #include #include #include #include "storm/storage/jani/EdgeDestination.h" #include "storm/storage/jani/OrderedAssignments.h" namespace storm { namespace jani { class TemplateEdge; class Edge { public: Edge() = default; Edge(uint64_t sourceLocationIndex, uint64_t actionIndex, boost::optional const& rate, std::shared_ptr const& templateEdge, std::vector> const& destinationTargetLocationsAndProbabilities); Edge(uint64_t sourceLocationIndex, uint64_t actionIndex, boost::optional const& rate, std::shared_ptr const& templateEdge, std::vector const& destinationLocations, std::vector const& destinationProbabilities); /*! * Retrieves the index of the source location. */ uint64_t getSourceLocationIndex() const; /*! * Retrieves the id of the action with which this edge is labeled. */ uint64_t getActionIndex() const; /*! * Returns whether it contains the silent action. */ bool hasSilentAction() const; /*! * Retrieves whether this edge has an associated rate. */ bool hasRate() const; /*! * Retrieves the rate of this edge. Note that calling this is only valid if the edge has an associated rate. */ storm::expressions::Expression const& getRate() const; /*! * Retrieves an optional that stores the rate if there is any and none otherwise. */ boost::optional const& getOptionalRate() const; /*! * Sets a new rate for this edge. */ void setRate(storm::expressions::Expression const& rate); /*! * Retrieves the guard of this edge. */ storm::expressions::Expression const& getGuard() const; /*! * Retrieves the destination with the given index. */ EdgeDestination const& getDestination(uint64_t index) const; /*! * Retrieves the destinations of this edge. */ std::vector const& getDestinations() const; /*! * Retrieves the destinations of this edge. */ std::vector& getDestinations(); /*! * Retrieves the number of destinations of this edge. */ std::size_t getNumberOfDestinations() const; /*! * Substitutes all variables in all expressions according to the given substitution. */ void substitute(std::map const& substitution); /*! * Retrieves a set of (global) variables that are written by at least one of the edge's destinations. */ boost::container::flat_set const& getWrittenGlobalVariables() const; /*! * Retrieves the assignments of this edge. */ OrderedAssignments const& getAssignments() const; /*! * Checks whether the provided variables appear on the right-hand side of non-transient assignments. */ bool usesVariablesInNonTransientAssignments(std::set const& variables) const; /*! * Retrieves whether there is any transient edge destination assignment in the edge. */ bool hasTransientEdgeDestinationAssignments() const; /*! * Retrieves whether the edge uses an assignment level other than zero. */ bool usesAssignmentLevels(bool onlyTransient = false) const; /*! * * @param localVars */ void simplifyIndexedAssignments(VariableSet const& localVars); std::shared_ptr const& getTemplateEdge(); void setTemplateEdge(std::shared_ptr const& newTe); /*! * Retrieves the lowest assignment level occurring in each assignment. * If no assignment exists, this value is the highest possible integer */ uint64_t const& getLowestAssignmentLevel() const; /*! * Retrieves the highest assignment level occurring in each assignment * If no assignment exists, this value is always zero */ uint64_t const& getHighestAssignmentLevel() const; void assertValid() const; private: /// The index of the source location. uint64_t sourceLocationIndex; /// The index of the action with which this edge is labeled. uint64_t actionIndex; /// The rate with which this edge is taken. This only applies to continuous-time models. For discrete-time /// models, this must be set to none. boost::optional rate; /// The template of this edge: guards and destinations. Notice that after finalizing, the template edge might be reused; changing it is not permitted. std::shared_ptr templateEdge; /// The concrete destination objects. std::vector destinations; }; } }