public abstract class MutualExclusionSolver extends Z3Solver implements ProcessorConstraints, LatencyConstraints, BufferConstraints
Modifier and Type | Class and Description |
---|---|
protected class |
MutualExclusionSolver.LeftEdge
Solve the scheduling problem by using Left-Edge instead of
mutual exclusion.
|
Z3Solver.SatResult
Modifier and Type | Field and Description |
---|---|
boolean |
bufferAnalysis
Enable buffer analysis
|
boolean |
bufferAnalysisWithFunctions
Enable buffer analysis using functions (true)
or with if-else statements (false)
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
bufferDecl
SMT variables for buffer calculation of the channels
|
private java.util.Map<java.lang.String,com.microsoft.z3.FuncDecl> |
bufferFuncDecl
SMT variables for Function declaration for buffer analysis
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
cpuDecl
SMT variables for processor allocation of the tasks
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
durationDecl
SMT variables for duration of the tasks
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
endTimeDecl
SMT variables for end times of the tasks
|
protected Graph |
graph
Application SDF graph
|
boolean |
graphSymmetry
Enable task symmetry constraints
|
protected Graph |
hsdf
Equivalent HSDF graph of application graph
|
protected java.util.List<Actor> |
lastActorList
list of actors which finish in the end.
|
protected com.microsoft.z3.IntExpr |
latencyDecl
SMT variable for latency calculation
|
boolean |
leftEdgeAlgorithm
Solve by using left-edge algorithm
|
boolean |
mutualExclusionGraphAnalysis
Use graph analysis to generate mutual exclusion
constraints.
|
protected java.util.Map<Actor,java.util.HashSet<Actor>> |
overlappingActorList
List of overlapping actors
|
protected java.util.Map<Actor,java.util.List<java.util.HashSet<Actor>>> |
overlappingActorWithGraphSymList |
boolean |
processorSymmetry
Enable processor symmetry constraints
|
protected Solutions |
solutions
Solutions of application graph
|
protected java.util.List<Actor> |
startActorList
list of actors which can start at time zero.
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
startTimeDecl
SMT variables for start times of the tasks
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
symmetryDecl
SMT variable for processor symmetry
|
protected com.microsoft.z3.IntExpr |
totalBufDecl
SMT variable for buffer size calculation
|
protected com.microsoft.z3.IntExpr |
totalProcDecl
SMT variable for total processors used
|
contextStatements, pushedContext, statementCountAfterPush, z3Solver
Constructor and Description |
---|
MutualExclusionSolver(Graph inputGraph)
Initialize the mutual exclusion solver
|
Modifier and Type | Method and Description |
---|---|
protected void |
allProcessorUtilisedConstraints(int numProcessors)
Generate constraints to make sure at least one task is allocated to a processor.
|
protected void |
assertBuffer(java.lang.String srcActor,
java.lang.String dstActor,
int srcRepCount,
int dstRepCount,
int maxBufIndex)
Generate constraints to calculate the buffer at each index
|
protected void |
assertBufferBounds(java.lang.String srcActor,
java.lang.String dstActor,
int maxBufIndex,
int upperBound)
Generate constraints for lower and upper bounds on buffer size of a channel.
|
protected void |
assertBufferBoundsLinear(java.lang.String srcActor,
java.lang.String dstActor,
int srcRepCount,
int bound)
Generate constraints for upper and lower bounds on the buffer size at every index and maximum buffer size
of a channel.
|
protected void |
assertIndexLimits(java.lang.String srcActor,
java.lang.String dstActor,
int maxBufIndex)
Generate constraints for lower and upper bounds on the index allocation
|
protected void |
assertMaxBuffer(java.lang.String srcActor,
java.lang.String dstActor,
int maxBufIndex)
Generate constraints to calculate maximum buffer size for a channel.
|
protected void |
assertMaxBufferLinear(java.lang.String srcActor,
java.lang.String dstActor,
int srcRepCount,
com.microsoft.z3.Expr initialTokensId)
Generate constraints to calculate the maximum size of the buffer.
|
private void |
assertMutualExclusion()
Generate mutual exclusion constraints for all the tasks.
|
private void |
assertMutualExclusionWithGraphAnalysis()
Assert mutual exclusion constraints by performing graph analysis
to form a list of tasks which can potentially execute in parallel
and apply mutual exclusion only on such tasks.
|
void |
assertNonPipelineConstraints()
Generate constraints for solving non-pipelined scheduling problem.
|
void |
assertPipelineConstraints()
Generate constraints for solving pipelined scheduling problem.
|
protected void |
assertStartTimeBounds()
Generate constraints for lower and upper bounds on the start times of tasks
|
protected void |
assertUniqueIndex(java.lang.String indexName,
int maxBufIndex)
Generate constraints to specify that all the indices are unique.
|
protected com.microsoft.z3.IntExpr |
bufferAtId(java.lang.String srcActor,
java.lang.String dstActor,
int index)
Get SMT variable for buffer size at a producer of a channel connecting two actors
|
protected com.microsoft.z3.Expr |
buffId(java.lang.String name,
com.microsoft.z3.Expr indexId)
Get SMT variable for buffer size at a given index of the producer for a channel.
|
protected com.microsoft.z3.Expr |
buffId(java.lang.String name,
int index)
Get SMT variable for buffer size at a given index of the producer for a channel.
|
protected void |
buildOverlappingActorList()
Build a list of actors which can execute in parallel.
|
protected com.microsoft.z3.IntExpr |
consRateId(java.lang.String name)
Get SMT variable for a consumption rate on a channel.
|
protected com.microsoft.z3.IntExpr |
cpuId(java.lang.String name)
Get SMT variable for processor allocated to a task.
|
protected com.microsoft.z3.IntExpr |
cpuId(java.lang.String name,
int index)
Get SMT variable for processor allocated to an actor instance
|
private void |
defineActorDuration()
Define SMT variables for actor duration
|
private void |
defineChannelBuffers()
Define all the variables for calculating communication buffer size
|
private void |
defineConsumptionRates()
Define variables for consumption rates
|
private void |
defineEndTimes()
Define all end time SMT variables
|
private void |
defineProductionRates()
Define variables for production rates
|
private void |
defineStartTimes()
Define all start time SMT variables
|
protected com.microsoft.z3.IntExpr |
durationId(java.lang.String name)
Get SMT variable for duration of an actor.
|
void |
generateActorPrecedences()
Generate constraints for task precedences
|
void |
generateActorTimeDefinitions()
Generate start times, end times and duration of tasks / actors.
|
void |
generateBufferAnalysisDefinitions()
Generate all the definitions required for buffer size calculation
|
void |
generateBufferConstraint(int bufferConstraint)
Set the buffer size for exploration query.
|
void |
generateCpuBounds()
Generate constraints for lower and upper bounds on processor allocated to tasks.
|
void |
generateCpuDefinitions()
Define variables for processor allocation of tasks
|
protected void |
generateLatencyCalculation()
Generate constraints to calculate latency of the schedule
|
void |
generateLatencyConstraint(int latencyConstraint)
Set the latency constraint for exploration query.
|
void |
generateMutualExclusion()
Generate the mutual exclusion constraints
|
void |
generatePeriodConstraint(int periodConstraint)
Generate period cost for a problem
|
void |
generateProcessorConstraint(int numProcessors)
Set an upper bound on number of processors to be used in the schedule.
|
protected void |
generateProcessorSymmetryDefinitions()
Generate Processor symmetry definitions
|
com.microsoft.z3.IntExpr |
getBufDeclId()
Get SMT variable for total buffer size of the schedule
|
java.util.List<Actor> |
getLastActors()
Get list of actors without any successors.
|
int |
getLatency(java.util.Map<java.lang.String,java.lang.String> model)
Get the latency of the application graph calculated by the solver and returned in the model.
|
com.microsoft.z3.IntExpr |
getLatencyDeclId()
Get SMT variable for latency of the schedule.
|
private java.util.List<Actor> |
getPredecessors(Actor actr)
Get all the predecessors which do not have any initial tokens
on the channels connecting to it.
|
com.microsoft.z3.IntExpr |
getProcDeclId()
Get SMT variable for total processors used in the schedule
|
int |
getProcessors(java.util.Map<java.lang.String,java.lang.String> model)
Get the number of processors used in the schedule represented in the model.
|
java.util.List<Actor> |
getStartActors()
Get list of actors without any predecessors.
|
private java.util.List<Actor> |
getSuccessors(Actor actr)
Get all the successors which do not have any initial tokens
on the channels connecting to it.
|
int |
getTotalBufferSize(java.util.Map<java.lang.String,java.lang.String> model)
Get Total Buffer Size from the model.
|
protected void |
graphSymmetryLexicographic()
Generate Task symmetry constraints
|
protected com.microsoft.z3.Expr |
idxId(java.lang.String name,
int index)
Get SMT variable for index function application at a given value.
|
protected com.microsoft.z3.IntExpr |
maxBufferId(java.lang.String srcActor,
java.lang.String dstActor)
Get SMT variable for maximum buffer size for a channel.
|
protected com.microsoft.z3.IntExpr |
maxCpuId(java.lang.String name)
Get SMT variable for maximum index of processor on which a task can run.
|
protected com.microsoft.z3.IntExpr |
maxCpuId(java.lang.String name,
int index)
Get SMT variable for maximum processor index on which a task can run for processor symmetry constraints.
|
protected void |
minLatencyBound()
Generate lower bound for latency of the schedule
|
protected void |
processorOverlapSymmetryConstraints()
Generate constraint to decide an order processor allocation for the tasks.
|
protected void |
processorSymmetryConstraints()
Generate processor symmetry constraints
|
protected com.microsoft.z3.IntExpr |
procUtilId(java.lang.String actorName,
int instanceId)
Get SMT variable to calculate processor utilization at this actor instance
Required for left-edge algorithm
|
protected com.microsoft.z3.IntExpr |
prodRateId(java.lang.String name)
Get SMT variable for a production rate on a channel.
|
void |
resetSolver()
Reset the Z3 Solver.
|
void |
setRandomSeed(int seed)
Set a random seed for Z3 solver.
|
protected com.microsoft.z3.IntExpr |
tasksEndedBeforeId(java.lang.String actorName,
int instanceId)
Get SMT variable to calculate tasks ended before this task.
|
protected com.microsoft.z3.IntExpr |
tasksStartedBeforeId(java.lang.String actorName,
int instanceId)
Get SMT variable to calculate tasks started before this task.
|
protected com.microsoft.z3.IntExpr |
xId(java.lang.String name)
Get SMT variable for start time of a task.
|
protected com.microsoft.z3.IntExpr |
xId(java.lang.String name,
int index)
Get SMT variable for start time of an actor instance.
|
protected com.microsoft.z3.IntExpr |
yId(java.lang.String name)
Get SMT variable for end time of a task.
|
protected com.microsoft.z3.IntExpr |
yId(java.lang.String name,
int index)
Get SMT variable for end time of an actor instance.
|
addVariableDeclaration, checkSat, declareFunction, generateAssertion, generateSatCode, getModel, getStatistics, popContext, printContext, pushContext, setTacTicSolver
check, getModel, getVersion, setRandomSeed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkSat, getModel, popContext, pushContext
protected Graph graph
protected Graph hsdf
public boolean processorSymmetry
public boolean graphSymmetry
public boolean bufferAnalysisWithFunctions
public boolean bufferAnalysis
public boolean leftEdgeAlgorithm
public boolean mutualExclusionGraphAnalysis
protected java.util.List<Actor> lastActorList
protected java.util.List<Actor> startActorList
protected java.util.Map<Actor,java.util.HashSet<Actor>> overlappingActorList
protected java.util.Map<Actor,java.util.List<java.util.HashSet<Actor>>> overlappingActorWithGraphSymList
protected Solutions solutions
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> startTimeDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> endTimeDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> durationDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> cpuDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> bufferDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> symmetryDecl
private java.util.Map<java.lang.String,com.microsoft.z3.FuncDecl> bufferFuncDecl
protected com.microsoft.z3.IntExpr latencyDecl
protected com.microsoft.z3.IntExpr totalBufDecl
protected com.microsoft.z3.IntExpr totalProcDecl
public MutualExclusionSolver(Graph inputGraph)
inputGraph
- application SDF graphpublic com.microsoft.z3.IntExpr getLatencyDeclId()
public com.microsoft.z3.IntExpr getBufDeclId()
public com.microsoft.z3.IntExpr getProcDeclId()
private java.util.List<Actor> getSuccessors(Actor actr)
actr
- actorprivate java.util.List<Actor> getPredecessors(Actor actr)
actr
- actorprotected void buildOverlappingActorList()
public java.util.List<Actor> getStartActors()
public java.util.List<Actor> getLastActors()
public void assertPipelineConstraints()
public void assertNonPipelineConstraints()
public void generatePeriodConstraint(int periodConstraint)
periodConstraint
- period cost constraintprotected com.microsoft.z3.IntExpr xId(java.lang.String name)
name
- name of the taskprotected com.microsoft.z3.IntExpr xId(java.lang.String name, int index)
name
- name of the actorindex
- instance idprotected com.microsoft.z3.IntExpr yId(java.lang.String name)
name
- name of the taskprotected com.microsoft.z3.IntExpr yId(java.lang.String name, int index)
name
- name of the actorindex
- instance idprotected com.microsoft.z3.IntExpr cpuId(java.lang.String name)
name
- name of the taskprotected com.microsoft.z3.IntExpr cpuId(java.lang.String name, int index)
name
- name of the actorindex
- instance idprotected com.microsoft.z3.IntExpr prodRateId(java.lang.String name)
name
- name of the channelprotected com.microsoft.z3.IntExpr consRateId(java.lang.String name)
name
- name of the channelprotected com.microsoft.z3.IntExpr durationId(java.lang.String name)
name
- name of the actorprotected com.microsoft.z3.IntExpr maxCpuId(java.lang.String name, int index)
name
- name of the actorindex
- instance idprotected com.microsoft.z3.IntExpr maxBufferId(java.lang.String srcActor, java.lang.String dstActor)
srcActor
- producer actor of the channeldstActor
- consumer actor of the channelprotected com.microsoft.z3.IntExpr tasksStartedBeforeId(java.lang.String actorName, int instanceId)
actorName
- name of the actorinstanceId
- instance idprotected com.microsoft.z3.IntExpr tasksEndedBeforeId(java.lang.String actorName, int instanceId)
actorName
- name of the actorinstanceId
- instance idprotected com.microsoft.z3.IntExpr procUtilId(java.lang.String actorName, int instanceId)
actorName
- name of the actorinstanceId
- instance idprotected com.microsoft.z3.IntExpr maxCpuId(java.lang.String name)
name
- name of the taskprotected com.microsoft.z3.IntExpr bufferAtId(java.lang.String srcActor, java.lang.String dstActor, int index)
srcActor
- producer actordstActor
- consumer actorindex
- index of the buffer, <= repetition count of srcActorprotected com.microsoft.z3.Expr buffId(java.lang.String name, int index)
name
- name of the channelindex
- instance id of the producerprotected com.microsoft.z3.Expr buffId(java.lang.String name, com.microsoft.z3.Expr indexId)
name
- name of the channelindexId
- index expressionprotected com.microsoft.z3.Expr idxId(java.lang.String name, int index)
name
- name of the index variableindex
- location index for the functionpublic void setRandomSeed(int seed)
seed
- integer value as a seed.protected void allProcessorUtilisedConstraints(int numProcessors)
numProcessors
- total number of processors.protected void processorOverlapSymmetryConstraints()
protected void graphSymmetryLexicographic()
protected void generateProcessorSymmetryDefinitions()
protected void processorSymmetryConstraints()
private void assertMutualExclusionWithGraphAnalysis()
private void assertMutualExclusion()
protected void assertStartTimeBounds()
protected void assertBufferBounds(java.lang.String srcActor, java.lang.String dstActor, int maxBufIndex, int upperBound)
srcActor
- source actor of a channeldstActor
- sink actor of a channelmaxBufIndex
- maximum buffer index of a channelupperBound
- upper bound on the buffer sizeprotected void assertIndexLimits(java.lang.String srcActor, java.lang.String dstActor, int maxBufIndex)
srcActor
- source actor of a channeldstActor
- sink actor of a channelmaxBufIndex
- maximum buffer index of a channelprotected void assertUniqueIndex(java.lang.String indexName, int maxBufIndex)
indexName
- name of the index variablemaxBufIndex
- maximum buffer indexprotected void assertBuffer(java.lang.String srcActor, java.lang.String dstActor, int srcRepCount, int dstRepCount, int maxBufIndex)
srcActor
- source actor of the channeldstActor
- sink actor of the channelsrcRepCount
- repetition count of the source actordstRepCount
- repetition count of the sink actormaxBufIndex
- maximum value of indexprotected void assertMaxBufferLinear(java.lang.String srcActor, java.lang.String dstActor, int srcRepCount, com.microsoft.z3.Expr initialTokensId)
srcActor
- source actor of the channeldstActor
- sink actor of the channelsrcRepCount
- source repetition countinitialTokensId
- expression pointing to initial tokens on the channelprotected void assertBufferBoundsLinear(java.lang.String srcActor, java.lang.String dstActor, int srcRepCount, int bound)
srcActor
- source actor of the channeldstActor
- sink actor of the channelsrcRepCount
- source repetition countbound
- upper bound on the buffer sizeprotected void assertMaxBuffer(java.lang.String srcActor, java.lang.String dstActor, int maxBufIndex)
srcActor
- source actor of the channeldstActor
- sink actor of the channelmaxBufIndex
- maximum value of index for the bufferprotected void generateLatencyCalculation()
public void generateActorPrecedences()
private void defineEndTimes()
private void defineStartTimes()
private void defineActorDuration()
private void defineProductionRates()
private void defineConsumptionRates()
private void defineChannelBuffers()
public void generateCpuDefinitions()
public void generateProcessorConstraint(int numProcessors)
ProcessorConstraints
generateProcessorConstraint
in interface ProcessorConstraints
numProcessors
- number of processors to be used as a constraint.public void generateLatencyConstraint(int latencyConstraint)
LatencyConstraints
generateLatencyConstraint
in interface LatencyConstraints
latencyConstraint
- upper bound on the latency value for the exploration.public void generateBufferConstraint(int bufferConstraint)
BufferConstraints
generateBufferConstraint
in interface BufferConstraints
bufferConstraint
- total buffer size for the query.public void resetSolver()
Z3Solver
resetSolver
in class Z3Solver
public void generateActorTimeDefinitions()
public void generateBufferAnalysisDefinitions()
public void generateCpuBounds()
protected void minLatencyBound()
public void generateMutualExclusion()
public int getLatency(java.util.Map<java.lang.String,java.lang.String> model)
LatencyConstraints
getLatency
in interface LatencyConstraints
model
- model returned by the Solver on a SAT result.public int getProcessors(java.util.Map<java.lang.String,java.lang.String> model)
ProcessorConstraints
getProcessors
in interface ProcessorConstraints
model
- model returned by the Solver on a SAT result.public int getTotalBufferSize(java.util.Map<java.lang.String,java.lang.String> model)
BufferConstraints
getTotalBufferSize
in interface BufferConstraints
model
- model returned by the Solver on a SAT result.