- java.lang.Object
-
- it.unive.lisa.util.datastructures.graph.algorithms.Fixpoint<G,N,E,T>
-
- Type Parameters:
G- the type of the sourceGraphN- the type of theNodes in the source graphE- the type of theEdges in the source graphT- the type of data computed by the fixpoint
- Direct Known Subclasses:
OptimizedFixpoint
public class Fixpoint<G extends Graph<G,N,E>,N extends Node<G,N,E>,E extends Edge<G,N,E>,T> extends java.lang.ObjectA fixpoint algorithm for aGraph, parametric to theFixpoint.FixpointImplementationthat one wants to use to compute the results.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFixpoint.FixpointImplementation<N,E,T>Concrete implementation of the general methods used by a fixpoint algorithm to perform.
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringERRORCommon format for error messages.protected booleanforceFullEvaluationWhether or not all nodes should be processed at least once.protected GgraphThe graph to target.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<N,T>fixpoint(java.util.Map<N,T> startingPoints, WorkingSet<N> ws, Fixpoint.FixpointImplementation<N,E,T> implementation)Runs the fixpoint.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)Runs the fixpoint.protected TgetEntryState(N node, T startstate, Fixpoint.FixpointImplementation<N,E,T> implementation, java.util.Map<N,T> result)Yields the entry state for the given node.
-
-
-
Field Detail
-
ERROR
protected static final java.lang.String ERROR
Common format for error messages.- See Also:
- Constant Field Values
-
forceFullEvaluation
protected final boolean forceFullEvaluation
Whether or not all nodes should be processed at least once.
-
-
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 ofWorkingSetto use for the fixpointimplementation- theFixpoint.FixpointImplementationto 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 ofWorkingSetto use for the fixpointimplementation- theFixpoint.FixpointImplementationto use for running the fixpointinitialResult- 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
-
getEntryState
protected T getEntryState(N node, T startstate, Fixpoint.FixpointImplementation<N,E,T> implementation, java.util.Map<N,T> result) throws FixpointException
Yields the entry state for the given node.- Parameters:
node- the node under evaluationstartstate- a predefined starting state that must be taken into account for the computationimplementation- the fixpoint implementation that knows how to combine different statesresult- the current approximations for each node- Returns:
- the computed state
- Throws:
FixpointException- if something goes wrong during the computation
-
-