public class MatrixSolver extends Z3Solver implements LatencyConstraints, ProcessorConstraints, LatProcConstraints
Z3Solver.SatResult
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
cpuDecl
SMT variables for allocate processor of the task
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
durationDecl
SMT variables for actor duration
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
enableTimeDecl
SMT variables for enable time of the task
|
protected Graph |
graph
Application graph.
|
boolean |
graphSymmetry
Enable task symmetry
|
protected Graph |
hsdf
Equivalent HSDF graph
|
protected java.util.List<Actor> |
lastActorList
List of actors without successors.
|
protected com.microsoft.z3.IntExpr |
latencyDecl
SMT variable to calculate latency of the schedule
|
protected com.microsoft.z3.FuncDecl |
maxFunctionDecl
SMT function to calculate the maximum value among the two values
|
private java.util.Map<Actor,java.util.HashSet<Actor>> |
predecessors |
boolean |
processorSymmetry
Enable processor symmetry
|
protected com.microsoft.z3.FuncDecl |
schedMatrixDecl
Schedule matrix where the problem is solved
|
protected Solutions |
solutions
Solutions for Application graph.
|
protected java.util.List<Actor> |
startActorList
List of actors without predecessors.
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
symmetryDecl
SMT variables for symmetry
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
taskIndexDecl
SMT variables for index of the task
|
boolean |
tetrisSymmetry
Enable Tetris Symmetry for allocating processors to the tasks.
|
protected com.microsoft.z3.IntExpr |
totalProcDecl
SMT variable to calculate processors used in the schedule
|
boolean |
useMaxFunction
Should we use a function to calculate maximum values among the
two values (true) or use if then else statement (false)
|
boolean |
useQuantifier
Use quantifier or not.
|
contextStatements, pushedContext, statementCountAfterPush, z3Solver
Constructor and Description |
---|
MatrixSolver(Graph inputGraph)
Build a matrix solver object.
|
Modifier and Type | Method and Description |
---|---|
private void |
actorPrecedenceConstraints()
Generate precedence constraints for the tasks
|
private void |
assertCpuBounds()
Define upper and lower bound on the processor variables
|
void |
assertNonPipelineConstraints()
Generate all the constraints for non-pipelined scheduling
|
private void |
assertTaskIndexBounds()
Define bounds on the index variables for all the tasks
|
private void |
calculateEnableTimes()
Calculate enable times of the tasks
|
private void |
calculateSchedMatrixIndexVar() |
private void |
calculateSchedMatrixNonIndexVar() |
private void |
calculateSchedMatrixNonIndexVar(int numProcessors) |
(package private) com.microsoft.z3.IntExpr |
cpuId(java.lang.String name)
Get the SMT variable for processor allocated to a task
|
(package private) com.microsoft.z3.IntExpr |
cpuId(java.lang.String name,
int instance)
Get the SMT variable for processor allocated to an actor instance
|
private void |
defineActorDuration()
Define SMT variables for actor durations
|
private void |
defineCpuAllocation()
Define SMT variables for processor allocated for the task
|
private void |
defineEnableTimes()
Define SMT variables tocalculate the enable time of actors
such that all its precedence constraints are satisfied
|
private void |
defineMaxFunction()
Define max function which calculates the maximum value
between two integers
|
private void |
defineTaskIndex()
Define index variables for all the tasks.
|
(package private) com.microsoft.z3.IntExpr |
durationId(java.lang.String name)
Get SMT variable for duration of an actor.
|
private void |
enableTimeBounds()
Generate constraints for lower and upper bounds on enable times
|
(package private) com.microsoft.z3.IntExpr |
enableTimeId(java.lang.String name)
Get SMT variable for enabled time for execution of task.
|
(package private) com.microsoft.z3.IntExpr |
enableTimeId(java.lang.String name,
int instance)
Get SMT variable for enabled time for execution of actor instance.
|
private com.microsoft.z3.Expr |
functionApplication(com.microsoft.z3.FuncDecl functionId,
com.microsoft.z3.Expr index1,
com.microsoft.z3.Expr index2)
Make a function application with two indices.
|
private void |
generateLatencyCalculation()
Generate latency calculation for the schedule
|
void |
generateLatencyConstraint(int latencyConstraint)
Set the latency constraint for exploration query.
|
private void |
generatePredecessorsList()
Generate a list of predecessors for all HSDF actors
|
void |
generateProcessorConstraint(int numProcessors)
Set an upper bound on number of processors to be used in the schedule.
|
private void |
generateProcessorSymmetryDefinitions()
Generate SMT variables for processor symmetry
|
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 calculation of the schedule.
|
com.microsoft.z3.FuncDecl |
getMaxFunctionDeclId()
Get the max function.
|
com.microsoft.z3.IntExpr |
getProcDeclId()
Get SMT variable for number of 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.
|
com.microsoft.z3.FuncDecl |
getSchedMatrixDeclId()
Get SMT variable for the schedule matrix.
|
protected void |
graphSymmetryLexicographic()
Generate Task Symmetry constraints
|
private void |
indexSymmetry()
New type of symmetry : index symmetry
|
private void |
initialSchedMatrix(int numProcessors)
Set the initial values of the schedule matrix.
|
(package private) com.microsoft.z3.IntExpr |
maxCpuId(java.lang.String name,
int index)
Get SMT variable for maximum processor index where task can be allocated
|
private void |
processorSymmetryConstraints()
Generate constraints for processor symmetry
|
private void |
schedMatrixConstraints() |
(package private) com.microsoft.z3.IntExpr |
taskIndexId(java.lang.String name)
Get SMT variable for task index in the schedule matrix
|
(package private) com.microsoft.z3.IntExpr |
taskIndexId(java.lang.String name,
int instance)
Get SMT variable for index of an actor instance in the schedule matrix.
|
private void |
tetrisSymmetryConstraints()
Generate tetris symmetry constraints
|
private void |
tetrisSymmetryConstraints(int numProcessors)
Tetris symmetry is another kind of symmetry that is seen in
allocating the processor to a tasks, just like in tetris game.
|
addVariableDeclaration, checkSat, declareFunction, generateAssertion, generateSatCode, getModel, getStatistics, popContext, printContext, pushContext, resetSolver, 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
protected Solutions solutions
public boolean tetrisSymmetry
public boolean processorSymmetry
public boolean graphSymmetry
public boolean useQuantifier
public boolean useMaxFunction
protected java.util.List<Actor> lastActorList
protected java.util.List<Actor> startActorList
protected com.microsoft.z3.IntExpr latencyDecl
protected com.microsoft.z3.IntExpr totalProcDecl
protected com.microsoft.z3.FuncDecl schedMatrixDecl
protected com.microsoft.z3.FuncDecl maxFunctionDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> taskIndexDecl
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> enableTimeDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> symmetryDecl
public MatrixSolver(Graph inputGraph)
inputGraph
- application graph SDFpublic com.microsoft.z3.IntExpr getLatencyDeclId()
public com.microsoft.z3.IntExpr getProcDeclId()
public com.microsoft.z3.FuncDecl getSchedMatrixDeclId()
public com.microsoft.z3.FuncDecl getMaxFunctionDeclId()
com.microsoft.z3.IntExpr cpuId(java.lang.String name, int instance)
name
- name of the actorinstance
- instance id of the actorcom.microsoft.z3.IntExpr cpuId(java.lang.String name)
name
- name of the taskcom.microsoft.z3.IntExpr durationId(java.lang.String name)
name
- name of the actorcom.microsoft.z3.IntExpr taskIndexId(java.lang.String name, int instance)
name
- name of the actorinstance
- instance idcom.microsoft.z3.IntExpr taskIndexId(java.lang.String name)
name
- name of the taskcom.microsoft.z3.IntExpr maxCpuId(java.lang.String name, int index)
name
- name of the actorindex
- instance idcom.microsoft.z3.IntExpr enableTimeId(java.lang.String name, int instance)
name
- actor nameinstance
- instance idcom.microsoft.z3.IntExpr enableTimeId(java.lang.String name)
name
- name of the taskprivate com.microsoft.z3.Expr functionApplication(com.microsoft.z3.FuncDecl functionId, com.microsoft.z3.Expr index1, com.microsoft.z3.Expr index2)
functionId
- function idindex1
- index 1index2
- index 2private void generatePredecessorsList()
private void defineTaskIndex()
private void defineActorDuration()
private void defineCpuAllocation()
private void defineEnableTimes()
private void assertCpuBounds()
private void assertTaskIndexBounds()
protected void graphSymmetryLexicographic()
private void initialSchedMatrix(int numProcessors)
numProcessors
- number of processors to be used.private void calculateSchedMatrixNonIndexVar(int numProcessors)
numProcessors
- private void tetrisSymmetryConstraints(int numProcessors)
numProcessors
- number of processors to usepublic 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.private void generateLatencyCalculation()
private void actorPrecedenceConstraints()
private void schedMatrixConstraints()
private void enableTimeBounds()
private void tetrisSymmetryConstraints()
private void calculateSchedMatrixIndexVar()
private void calculateSchedMatrixNonIndexVar()
private void calculateEnableTimes()
private void defineMaxFunction()
private void generateProcessorSymmetryDefinitions()
private void processorSymmetryConstraints()
private void indexSymmetry()
public void assertNonPipelineConstraints()
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.