Class BackwardFixpoint<G extends Graph<G,​N,​E>,​N extends Node<G,​N,​E>,​E extends Edge<G,​N,​E>,​T>

  • Type Parameters:
    G - the type of the source Graph
    N - the type of the Nodes in the source graph
    E - the type of the Edges in the source graph
    T - the type of data computed by the fixpoint
    Direct Known Subclasses:
    OptimizedBackwardFixpoint

    public class BackwardFixpoint<G extends Graph<G,​N,​E>,​N extends Node<G,​N,​E>,​E extends Edge<G,​N,​E>,​T>
    extends java.lang.Object
    A backward fixpoint algorithm for a Graph, parametric to the Fixpoint.FixpointImplementation that one wants to use to compute the results.
    • Field Detail

      • ERROR

        protected static final java.lang.String ERROR
        Common format for error messages.
        See Also:
        Constant Field Values
      • graph

        protected final G extends Graph<G,​N,​E> graph
        The graph to target.
      • forceFullEvaluation

        protected final boolean forceFullEvaluation
        Whether or not all nodes should be processed at least once.
    • Constructor Detail

      • BackwardFixpoint

        public BackwardFixpoint​(G graph,
                                boolean forceFullEvaluation)
        Builds a fixpoint for the given Graph.
        Parameters:
        graph - the source graph
        forceFullEvaluation - whether or not the fixpoint should evaluate all nodes independently of the fixpoint implementation
    • Method Detail

      • fixpoint

        public java.util.Map<N,​T> fixpoint​(java.util.Map<N,​T> startingPoints,
                                                 WorkingSet<N> ws,
                                                 Fixpoint.FixpointImplementation<N,​E,​T> implementation)
                                          throws FixpointException
        Runs the fixpoint. Invoking this method effectively recomputes the result: no caching on previous runs is executed. It starts with empty result.
        Parameters:
        startingPoints - a map containing all the nodes to start the fixpoint at, each mapped to its entry state.
        ws - the instance of WorkingSet to use for the fixpoint
        implementation - the Fixpoint.FixpointImplementation to use for running the fixpoint
        Returns:
        a mapping from each (reachable) node of the source graph to the fixpoint result computed at that node
        Throws:
        FixpointException - if something goes wrong during the fixpoint execution
      • fixpoint

        public java.util.Map<N,​T> fixpoint​(java.util.Map<N,​T> startingPoints,
                                                 WorkingSet<N> ws,
                                                 Fixpoint.FixpointImplementation<N,​E,​T> implementation,
                                                 java.util.Map<N,​T> initialResult)
                                          throws FixpointException
        Runs the fixpoint. Invoking this method effectively recomputes the result: no caching on previous runs is executed.
        Parameters:
        startingPoints - a map containing all the nodes to start the fixpoint at, each mapped to its entry state.
        ws - the instance of WorkingSet to use for the fixpoint
        implementation - the Fixpoint.FixpointImplementation to use for running the fixpoint
        initialResult - the map of initial result to use for running the fixpoint
        Returns:
        a mapping from each (reachable) node of the source graph to the fixpoint result computed at that node
        Throws:
        FixpointException - if something goes wrong during the fixpoint execution
      • getExitState

        protected T getExitState​(N node,
                                 T startstate,
                                 Fixpoint.FixpointImplementation<N,​E,​T> implementation,
                                 java.util.Map<N,​T> result)
                          throws FixpointException
        Yields the exit state for the given node.
        Parameters:
        node - the node under evaluation
        startstate - a predefined ending state that must be taken into account for the computation
        implementation - the fixpoint implementation that knows how to combine different states
        result - the current approximations for each node
        Returns:
        the computed state
        Throws:
        FixpointException - if something goes wrong during the computation