1. |
PRG = initializeProgram |
2. |
MProc = initializeProgramModel |
3. |
/* Build the model of monitoring program using backward inference, TargetM and CurrentM are swapped*/ |
4. |
MProc = DirectProgramSynthesis(maxLevel, MProc, TargetM, CurrentM) |
5. |
MProg = reproduceTransitionSequences(MProc) |
6. |
/* Build the model of the monitoring program according to the synthesized structure */ |
7. |
for each l in [(maxLevel-1)..0] do |
8. |
for each i in [0.. MProc.AchievedWith[l].length] do |
9. |
z = getFunKind(MProc.AchievedWith[l][i]) |
10. |
v = getFunType(MProc.AchievedWith[l][i]) |
11. |
MProg.StructureElements[l] = add(MProg.StructureElements[l], buildStructureElement(z, v)) |
12. |
End |
13. |
for each i in [0.. MProc.AchivedWhile[l].length] do |
14. |
conditions = MProc.AchivedWhile[l][i] |
15. |
MProg.Condition[l] = add(MProg.Condition[l], buildConditions(conditions)) |
16. |
end |
17. |
MProg.Program[l] = buildProgramForLevel(MProg.StructureElements[l], MProg.Condition[l]) |
18. |
/* transform program structure elements of each level to the resulting program structure */ |
19. |
PRG = buildProgram(PRG, MProg.Program[l]) |
20. |
end |
21. |
return PRG |