public class Solutions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
Solutions.Data
local data needed when solving the balance equations
|
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<Actor,Expression> |
solutions
Actor and its mapped solution expression
|
(package private) boolean |
throwException
Should we throw an exception when unable to get solutions?
|
Constructor and Description |
---|
Solutions() |
Modifier and Type | Method and Description |
---|---|
private InconsistencyProof |
checkResults(Solutions.Data data)
Look for rate inconsistency
|
void |
clear()
Clear all the solutions
|
boolean |
contains(Actor actr)
Check if the solutions contain an actor
|
void |
copy(Solutions second) |
void |
dump()
println all solutions to standard input
|
private Actor |
getArbitraryActor(Graph graph)
pick up the first actor we can get
|
Expression |
getSolution(Actor actor)
Gets an expression to solution of an actor
|
(package private) java.util.HashMap<Actor,Expression> |
scaleFractions(Solutions.Data data)
Scale the fractional solutions from the results of the solver
to be non-fractional, using the least common multiple of
the denominators.
|
void |
setThrowExceptionFlag(boolean flag)
Before solving, tell the solver whether we want an exception
if inconsistency is found
|
InconsistencyProof |
solve(Graph graph,
GraphExpressions expressions)
Use method of "Software Synthesis from Dataflow Graphs" book
of Bhattacharrya, generalized to SPDF graphs
If inconsistency is found and throwExpetion==true (default)
then throws am exception.
|
InconsistencyProof |
solve(Graph graph,
GraphExpressions expressions,
Actor startActor)
Solve balance equations.
|
private void |
solveRecursively(Actor actor,
Solutions.Data data)
one step of recursion, from solution for current actor
find solutions of its neighbors, and call this function
for each neighbor
|
java.lang.String |
toString()
print all solutions to a string
|
private java.util.HashMap<Actor,Expression> solutions
boolean throwException
public void clear()
public void copy(Solutions second)
public boolean contains(Actor actr)
actr
- actor to check forpublic void setThrowExceptionFlag(boolean flag)
public Expression getSolution(Actor actor)
actor
- an actor to get a solution forpublic java.lang.String toString()
toString
in class java.lang.Object
public void dump()
public InconsistencyProof solve(Graph graph, GraphExpressions expressions)
graph
- - SPDF graphexpressions
- - GraphExpressions for parsed rate expressionspublic InconsistencyProof solve(Graph graph, GraphExpressions expressions, Actor startActor)
graph
- input graphexpressions
- graph expressionsstartActor
- starting actor to solve the balance equationsprivate InconsistencyProof checkResults(Solutions.Data data)
data
- - solver state after solvingprivate Actor getArbitraryActor(Graph graph)
graph
- input graphprivate void solveRecursively(Actor actor, Solutions.Data data)
actor
- - current actordata
- - context of the solver with (intermediate) resultsjava.util.HashMap<Actor,Expression> scaleFractions(Solutions.Data data)
data
- - contains the results of the solver