Better Task Sets and printing.

This commit is contained in:
Nils Hölscher 2022-06-02 10:29:04 +02:00
parent e98e7e9cb6
commit 7c9f6a55a5
8 changed files with 3904 additions and 1995 deletions

View File

@ -19,7 +19,7 @@ The tasksets are represented by a 2D array, where row i is a Task i and the colu
## Runing the Tests ## Runing the Tests
Make sure you have at least python3, argparse and numpy installed. Make sure you have at least python3, argparse, numpy and tabulate installed.
Argpoarse and Numpy can be installed via pip. Argpoarse and Numpy can be installed via pip.
Use the SchedTest.py Script Use the SchedTest.py Script

View File

@ -1,9 +1,12 @@
import argparse import argparse
import numpy as np import numpy as np
from tabulate import tabulate
import schedTests.LiuAndLaylandBound as LLB import schedTests.LiuAndLaylandBound as LLB
import schedTests.TimeDemandAnalysis as TDA import schedTests.TimeDemandAnalysis as TDA
import schedTests.HyperbolicBound as HB import schedTests.HyperbolicBound as HB
import include.TasksHelper as TH import include.TasksHelper as TH
import task_sets.TaskSetGenerator as gen
# This function Parses the Input Arguments # This function Parses the Input Arguments
@ -35,9 +38,10 @@ def main():
# Parse Arguments # Parse Arguments
args = parse_args() args = parse_args()
print(args.i) print(args.i)
np.set_printoptions(threshold=np.inf)
# Read Tasksets from txt files # Read Tasksets from txt files
tasksets = get_tasksets(args.i, args.n) tasksets = get_tasksets(args.i, args.n)
#tasksets = gen.gen_np_taskset(100)
print("Successfully parsed Task Sets") print("Successfully parsed Task Sets")
shape = tasksets.shape shape = tasksets.shape
print("Nr. of Task Sets: " + str(shape[0])) print("Nr. of Task Sets: " + str(shape[0]))
@ -46,15 +50,18 @@ def main():
# Starting the analysis # Starting the analysis
print("Starting Liu and Layland bound analysis!") print("Starting Liu and Layland bound analysis!")
stubLLB = [] stubLLB = []
for _ in range(shape[0]): stubU = []
for k in range(shape[0]):
stubLLB.append(False) stubLLB.append(False)
stubU.append(TH.getTotalUtilization(tasksets[k], shape[1]))
LLBresults = np.array(stubLLB) LLBresults = np.array(stubLLB)
U = np.array(stubU)
for i in range(shape[0]): for i in range(shape[0]):
if LLB.test(tasksets[i]): if LLB.test(tasksets[i]):
LLBresults[i] = True LLBresults[i] = True
print("Task Set: " + str(i) + # print("Task Set: " + str(i) +
" fulfills necessary the Liu and Layland Bound!") # " fulfills necessary the Liu and Layland Bound!")
print() #print()
print("Starting Hyperbolic bound analysis!") print("Starting Hyperbolic bound analysis!")
stubHB = [] stubHB = []
@ -64,9 +71,9 @@ def main():
for i in range(shape[0]): for i in range(shape[0]):
if HB.test(tasksets[i]): if HB.test(tasksets[i]):
HBresults[i] = True HBresults[i] = True
print("Task Set: " + str(i) + # print("Task Set: " + str(i) +
" fulfills the sufficient Hyperbolic Bound!") # " fulfills the sufficient Hyperbolic Bound!")
print() #print()
print("Starting Time Demand Analysis!") print("Starting Time Demand Analysis!")
stubTDA = [] stubTDA = []
@ -76,7 +83,15 @@ def main():
for i in range(shape[0]): for i in range(shape[0]):
if TDA.test(tasksets[i]) > 0: if TDA.test(tasksets[i]) > 0:
TDAresults[i] = True TDAresults[i] = True
print("Task Set: " + str(i) + " is feasible by TDA analysis!") #print("Task Set: " + str(i) + " is feasible by TDA analysis!")
#print results
headers = ["#", "U", "LLB", "HB", "TDA"]
# Generate the table in fancy format.
results = np.array((np.arange(shape[0]), U, LLBresults, HBresults, TDAresults)).T
table = tabulate(results, headers, tablefmt="fancy_grid")
print(table)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -13,7 +13,6 @@ import include.TasksHelper as TH
# C_i is accessed as: tasks[i][2] # C_i is accessed as: tasks[i][2]
# The number of tasks can be accessed as: tasks.shape[0] # The number of tasks can be accessed as: tasks.shape[0]
#The Time Demand Analysis Test #The Time Demand Analysis Test
def test(tasks): def test(tasks):
#Sorting Taskset by Period/Deadline #Sorting Taskset by Period/Deadline

File diff suppressed because it is too large Load Diff

View File

@ -1,199 +1,177 @@
6.2504383551,6.2504383551,0.0712695584018 1.55088526e+01,1.55088526e+01,7.72156853e-01
91.7301596676,91.7301596676,1.85973864123 1.32443479e+01,1.32443479e+01,2.58768434e-01
5.54218170236,5.54218170236,0.368699984512 5.13385122e+01,5.13385122e+01,1.87312465e+00
35.365405996,35.365405996,3.61197473745 6.29912342e+01,6.29912342e+01,2.38572270e+00
7.80223783742,7.80223783742,0.395892416097 2.70293102e+01,2.70293102e+01,2.15938076e+00
65.6532097008,65.6532097008,4.65778060945 5.02831001e+00,5.02831001e+00,3.96028055e-01
3.25455707226,3.25455707226,0.0688358070731 2.12921765e+00,2.12921765e+00,7.74909311e-02
91.8771630371,91.8771630371,10.1540122581 7.73772838e+01,7.73772838e+01,7.19953850e-01
9.84506928434,9.84506928434,0.689891296569 8.33329504e+00,8.33329504e+00,1.42241801e+00
82.9195512397,82.9195512397,12.9550003692 8.57190280e+00,8.57190280e+00,2.68083582e-01
; ;
6.2504383551,6.2504383551,0.072317640143 2.09979589e+01,2.09979589e+01,6.89770055e-02
91.7301596676,91.7301596676,1.8870877389 1.25233211e+01,1.25233211e+01,1.83377181e+00
5.54218170236,5.54218170236,0.374122043108 1.36280373e+01,1.36280373e+01,2.99349676e-02
35.365405996,35.365405996,3.665092013 2.25433452e+00,2.25433452e+00,3.70871085e-01
7.80223783742,7.80223783742,0.401714363393 9.32240731e+00,9.32240731e+00,1.16486721e-01
65.6532097008,65.6532097008,4.72627738312 1.72956043e+00,1.72956043e+00,6.87984604e-02
3.25455707226,3.25455707226,0.0698480983536 4.26116749e+01,4.26116749e+01,1.46456666e+00
91.8771630371,91.8771630371,10.3033359678 6.09409904e+01,6.09409904e+01,3.74655568e+00
9.84506928434,9.84506928434,0.700036756813 1.95855461e+00,1.95855461e+00,1.40299437e-01
82.9195512397,82.9195512397,13.1455150805 1.63598431e+00,1.63598431e+00,7.16876062e-02
; ;
6.2504383551,6.2504383551,0.0733657218842 1.49130537e+00,1.49130537e+00,3.44038118e-02
91.7301596676,91.7301596676,1.91443683656 3.31174110e+01,3.31174110e+01,3.48775733e-01
5.54218170236,5.54218170236,0.379544101704 2.62674473e+00,2.62674473e+00,2.87497642e-02
35.365405996,35.365405996,3.71820928856 4.10249954e+01,4.10249954e+01,1.66456256e+00
7.80223783742,7.80223783742,0.407536310688 4.64683943e+00,4.64683943e+00,1.38447452e+00
65.6532097008,65.6532097008,4.79477415679 1.68458588e+00,1.68458588e+00,1.10864542e-01
3.25455707226,3.25455707226,0.0708603896341 8.48447150e+01,8.48447150e+01,4.69522180e-01
91.8771630371,91.8771630371,10.4526596774 9.89553147e+01,9.89553147e+01,1.82868637e+00
9.84506928434,9.84506928434,0.710182217057 1.09167882e+00,1.09167882e+00,4.25728855e-02
82.9195512397,82.9195512397,13.3360297918 4.66725394e+01,4.66725394e+01,4.57941525e+00
; ;
6.2504383551,6.2504383551,0.0744138036254 6.96922598e+01,6.96922598e+01,1.43931215e+00
91.7301596676,91.7301596676,1.94178593423 6.03677545e+00,6.03677545e+00,1.07083225e+00
5.54218170236,5.54218170236,0.384966160299 3.19161564e+00,3.19161564e+00,6.56648312e-02
35.365405996,35.365405996,3.77132656411 3.66367174e+01,3.66367174e+01,2.10025808e+00
7.80223783742,7.80223783742,0.413358257984 1.83503233e+01,1.83503233e+01,9.01080376e-01
65.6532097008,65.6532097008,4.86327093046 5.32437015e+01,5.32437015e+01,1.35917908e-01
3.25455707226,3.25455707226,0.0718726809146 1.11050191e+00,1.11050191e+00,1.53905294e-01
91.8771630371,91.8771630371,10.6019833871 6.60517675e+01,6.60517675e+01,1.00728825e+00
9.84506928434,9.84506928434,0.720327677301 8.06102833e+01,8.06102833e+01,1.09399043e+01
82.9195512397,82.9195512397,13.5265445031 3.72905853e+00,3.72905853e+00,8.52116540e-02
; ;
6.2504383551,6.2504383551,0.0754618853666 2.17145879e+00,2.17145879e+00,1.27340202e-01
91.7301596676,91.7301596676,1.96913503189 1.56005336e+01,1.56005336e+01,3.46224537e-01
5.54218170236,5.54218170236,0.390388218895 1.59821338e+01,1.59821338e+01,4.55091543e-01
35.365405996,35.365405996,3.82444383966 4.97496815e+00,4.97496815e+00,3.34436201e-01
7.80223783742,7.80223783742,0.41918020528 2.36282516e+01,2.36282516e+01,1.39983014e-02
65.6532097008,65.6532097008,4.93176770412 3.62109079e+00,3.62109079e+00,6.50996620e-01
3.25455707226,3.25455707226,0.072884972195 4.35442043e+01,4.35442043e+01,4.01774764e+00
91.8771630371,91.8771630371,10.7513070968 1.57128467e+00,1.57128467e+00,8.98780055e-02
9.84506928434,9.84506928434,0.730473137544 4.45411068e+00,4.45411068e+00,4.35463873e-01
82.9195512397,82.9195512397,13.7170592144 1.10837865e+01,1.10837865e+01,7.29961153e-01
; ;
6.2504383551,6.2504383551,0.0765099671078 9.88418030e+01,9.88418030e+01,4.57459064e+00
91.7301596676,91.7301596676,1.99648412956 7.64528144e+00,7.64528144e+00,1.08902944e+00
5.54218170236,5.54218170236,0.395810277491 5.20960721e+01,5.20960721e+01,3.60559302e+00
35.365405996,35.365405996,3.87756111521 5.34841412e+00,5.34841412e+00,3.94783079e-02
7.80223783742,7.80223783742,0.425002152575 2.46632007e+01,2.46632007e+01,8.79982811e-01
65.6532097008,65.6532097008,5.00026447779 7.81403020e+01,7.81403020e+01,4.59463155e+00
3.25455707226,3.25455707226,0.0738972634755 8.49640118e+00,8.49640118e+00,2.82088559e-01
91.8771630371,91.8771630371,10.9006308065 1.14464457e+00,1.14464457e+00,1.02895100e-02
9.84506928434,9.84506928434,0.740618597788 2.22202166e+01,2.22202166e+01,3.28998671e+00
82.9195512397,82.9195512397,13.9075739258 2.76640866e+00,2.76640866e+00,4.14819952e-01
; ;
6.2504383551,6.2504383551,0.077558048849 1.34615498e+01,1.34615498e+01,3.18892920e-01
91.7301596676,91.7301596676,2.02383322722 1.00887405e+01,1.00887405e+01,1.09934163e+00
5.54218170236,5.54218170236,0.401232336087 6.24881168e+01,6.24881168e+01,1.41352807e+01
35.365405996,35.365405996,3.93067839076 8.29248100e+00,8.29248100e+00,7.13867539e-02
7.80223783742,7.80223783742,0.430824099871 1.30610430e+01,1.30610430e+01,5.30277925e-01
65.6532097008,65.6532097008,5.06876125146 1.65130236e+00,1.65130236e+00,2.46429855e-01
3.25455707226,3.25455707226,0.074909554756 4.13370175e+00,4.13370175e+00,3.10049518e-01
91.8771630371,91.8771630371,11.0499545161 1.12187457e+01,1.12187457e+01,5.71105752e-01
9.84506928434,9.84506928434,0.750764058032 2.06553878e+01,2.06553878e+01,2.71026204e-01
82.9195512397,82.9195512397,14.0980886371 1.90238432e+00,1.90238432e+00,6.40360142e-02
; ;
6.2504383551,6.2504383551,0.0786061305902 5.53366175e+00,5.53366175e+00,7.74708363e-01
91.7301596676,91.7301596676,2.05118232489 2.00261055e+01,2.00261055e+01,1.04797941e+00
5.54218170236,5.54218170236,0.406654394682 9.55607174e+00,9.55607174e+00,7.68988059e-02
35.365405996,35.365405996,3.98379566631 1.35868249e+01,1.35868249e+01,7.86015477e-01
7.80223783742,7.80223783742,0.436646047166 2.16253233e+00,2.16253233e+00,2.35351552e-02
65.6532097008,65.6532097008,5.13725802513 9.87781144e+01,9.87781144e+01,1.62159932e+01
3.25455707226,3.25455707226,0.0759218460365 4.94726087e+01,4.94726087e+01,6.94027663e+00
91.8771630371,91.8771630371,11.1992782258 1.58856356e+00,1.58856356e+00,1.85555032e-02
9.84506928434,9.84506928434,0.760909518275 1.60610651e+01,1.60610651e+01,5.42486596e-01
82.9195512397,82.9195512397,14.2886033484 7.83383088e+01,7.83383088e+01,1.10441566e+01
; ;
6.2504383551,6.2504383551,0.0796542123314 3.73448069e+01,3.73448069e+01,1.94760116e+00
91.7301596676,91.7301596676,2.07853142255 1.08983205e+01,1.08983205e+01,1.11450419e+00
5.54218170236,5.54218170236,0.412076453278 8.38003640e+00,8.38003640e+00,2.07206816e-01
35.365405996,35.365405996,4.03691294186 1.50019532e+00,1.50019532e+00,9.18611172e-02
7.80223783742,7.80223783742,0.442467994462 4.06139828e+00,4.06139828e+00,2.44134569e-01
65.6532097008,65.6532097008,5.2057547988 4.43281269e+01,4.43281269e+01,3.16641835e+00
3.25455707226,3.25455707226,0.076934137317 1.57884941e+00,1.57884941e+00,4.73625296e-01
91.8771630371,91.8771630371,11.3486019355 2.01511810e+01,2.01511810e+01,1.50352853e+00
9.84506928434,9.84506928434,0.771054978519 5.67636724e+00,5.67636724e+00,1.48697031e-01
82.9195512397,82.9195512397,14.4791180597 1.54395865e+01,1.54395865e+01,2.67003216e-01
; ;
6.2504383551,6.2504383551,0.0807022940726 2.89200064e+00,2.89200064e+00,5.54365271e-03
91.7301596676,91.7301596676,2.10588052022 9.07164676e+01,9.07164676e+01,3.12680041e+00
5.54218170236,5.54218170236,0.417498511874 7.56555746e+01,7.56555746e+01,4.09560858e+00
35.365405996,35.365405996,4.09003021741 1.96931766e+00,1.96931766e+00,2.17248262e-02
7.80223783742,7.80223783742,0.448289941757 6.75396492e+01,6.75396492e+01,1.32805806e+00
65.6532097008,65.6532097008,5.27425157247 5.76676490e+01,5.76676490e+01,4.32783205e-02
3.25455707226,3.25455707226,0.0779464285975 6.03944113e+00,6.03944113e+00,5.32803326e-01
91.8771630371,91.8771630371,11.4979256452 6.36946189e+01,6.36946189e+01,1.49550785e+01
9.84506928434,9.84506928434,0.781200438763 1.21772192e+01,1.21772192e+01,1.81861567e+00
82.9195512397,82.9195512397,14.669632771 4.07351882e+01,4.07351882e+01,9.19291507e+00
; ;
6.2504383551,6.2504383551,0.0817503758138 2.42830202e+00,2.42830202e+00,3.30622963e-02
91.7301596676,91.7301596676,2.13322961788 3.91190214e+00,3.91190214e+00,6.21099147e-01
5.54218170236,5.54218170236,0.42292057047 6.84228318e+00,6.84228318e+00,6.04213534e-02
35.365405996,35.365405996,4.14314749296 1.12207447e+01,1.12207447e+01,1.37528215e+00
7.80223783742,7.80223783742,0.454111889053 4.22758764e+01,4.22758764e+01,2.60243387e+00
65.6532097008,65.6532097008,5.34274834613 8.82301652e+01,8.82301652e+01,7.30172704e+00
3.25455707226,3.25455707226,0.078958719878 6.95369682e+01,6.95369682e+01,1.15636731e+01
91.8771630371,91.8771630371,11.6472493548 2.81130846e+01,2.81130846e+01,2.54788178e-01
9.84506928434,9.84506928434,0.791345899006 2.77354107e+00,2.77354107e+00,1.84669235e-01
82.9195512397,82.9195512397,14.8601474823 6.39770625e+01,6.39770625e+01,1.02337373e+01
; ;
6.2504383551,6.2504383551,0.082798457555 6.21957754e+01,6.21957754e+01,2.38515498e+00
91.7301596676,91.7301596676,2.16057871555 7.87374931e+01,7.87374931e+01,1.54069109e+01
5.54218170236,5.54218170236,0.428342629065 3.29725862e+00,3.29725862e+00,4.74691530e-02
35.365405996,35.365405996,4.19626476851 2.46973108e+00,2.46973108e+00,9.54097082e-02
7.80223783742,7.80223783742,0.459933836348 1.07418225e+00,1.07418225e+00,2.13902920e-03
65.6532097008,65.6532097008,5.4112451198 3.00134738e+00,3.00134738e+00,3.63560940e-01
3.25455707226,3.25455707226,0.0799710111584 3.56686250e+00,3.56686250e+00,8.88205339e-01
91.8771630371,91.8771630371,11.7965730645 4.91637875e+00,4.91637875e+00,2.52271508e-01
9.84506928434,9.84506928434,0.80149135925 1.88779331e+01,1.88779331e+01,1.06991365e+00
82.9195512397,82.9195512397,15.0506621936 1.71979326e+01,1.71979326e+01,1.94028317e+00
; ;
6.2504383551,6.2504383551,0.0838465392963 1.47263660e+00,1.47263660e+00,9.03479312e-02
91.7301596676,91.7301596676,2.18792781321 2.60426109e+01,2.60426109e+01,9.40828010e-02
5.54218170236,5.54218170236,0.433764687661 3.05962718e+01,3.05962718e+01,1.49822171e+00
35.365405996,35.365405996,4.24938204406 4.23819603e+00,4.23819603e+00,3.53412180e-01
7.80223783742,7.80223783742,0.465755783644 7.50102167e+00,7.50102167e+00,9.00924983e-01
65.6532097008,65.6532097008,5.47974189347 2.34936625e+01,2.34936625e+01,1.92206784e+00
3.25455707226,3.25455707226,0.0809833024389 3.98836823e+00,3.98836823e+00,5.21585966e-02
91.8771630371,91.8771630371,11.9458967742 2.23989395e+01,2.23989395e+01,4.47222735e+00
9.84506928434,9.84506928434,0.811636819494 9.48057119e+01,9.48057119e+01,1.57159168e+01
82.9195512397,82.9195512397,15.2411769049 3.91474817e+01,3.91474817e+01,5.17734565e+00
; ;
6.2504383551,6.2504383551,0.0848946210375 3.85414025e+00,3.85414025e+00,2.71885153e-01
91.7301596676,91.7301596676,2.21527691088 1.85282324e+00,1.85282324e+00,1.26020176e-02
5.54218170236,5.54218170236,0.439186746257 7.06459146e+01,7.06459146e+01,8.60044082e+00
35.365405996,35.365405996,4.30249931961 8.30730707e+00,8.30730707e+00,5.50474130e-02
7.80223783742,7.80223783742,0.47157773094 8.15084542e+01,8.15084542e+01,7.53815023e-01
65.6532097008,65.6532097008,5.54823866714 6.21281836e+00,6.21281836e+00,1.97354535e+00
3.25455707226,3.25455707226,0.0819955937194 1.37860417e+01,1.37860417e+01,3.01173375e-01
91.8771630371,91.8771630371,12.0952204839 6.61921846e+01,6.61921846e+01,5.74977941e+00
9.84506928434,9.84506928434,0.821782279737 1.70527493e+01,1.70527493e+01,3.70337592e+00
82.9195512397,82.9195512397,15.4316916162 1.32407849e+00,1.32407849e+00,1.07912460e-01
; ;
6.2504383551,6.2504383551,0.0859427027787 1.49361618e+00,1.49361618e+00,1.73037660e-01
91.7301596676,91.7301596676,2.24262600855 1.01991221e+00,1.01991221e+00,1.52666949e-01
5.54218170236,5.54218170236,0.444608804853 2.73783531e+00,2.73783531e+00,4.34900715e-02
35.365405996,35.365405996,4.35561659516 1.50564546e+00,1.50564546e+00,1.90887937e-04
7.80223783742,7.80223783742,0.477399678235 4.39420842e+01,4.39420842e+01,9.56918101e+00
65.6532097008,65.6532097008,5.61673544081 1.21164339e+01,1.21164339e+01,1.07895431e+00
3.25455707226,3.25455707226,0.0830078849999 3.75260090e+01,3.75260090e+01,3.26476596e+00
91.8771630371,91.8771630371,12.2445441936 2.80427361e+01,2.80427361e+01,2.77552650e+00
9.84506928434,9.84506928434,0.831927739981 1.52527137e+00,1.52527137e+00,7.88658249e-02
82.9195512397,82.9195512397,15.6222063276 4.21601526e+00,4.21601526e+00,6.06906381e-01
; ;
6.2504383551,6.2504383551,0.0869907845199 1.93818526e+01,1.93818526e+01,1.34046147e+00
91.7301596676,91.7301596676,2.26997510621 1.43195828e+00,1.43195828e+00,1.46533905e-01
5.54218170236,5.54218170236,0.450030863449 1.85282833e+01,1.85282833e+01,4.95182331e-01
35.365405996,35.365405996,4.40873387072 1.59664605e+01,1.59664605e+01,5.89676042e-01
7.80223783742,7.80223783742,0.483221625531 4.32806685e+00,4.32806685e+00,6.35912761e-01
65.6532097008,65.6532097008,5.68523221448 4.37941864e+00,4.37941864e+00,9.33790277e-01
3.25455707226,3.25455707226,0.0840201762804 1.93193024e+01,1.93193024e+01,2.06300397e+00
91.8771630371,91.8771630371,12.3938679032 2.10651923e+00,2.10651923e+00,2.09964122e-01
9.84506928434,9.84506928434,0.842073200225 1.27761543e+00,1.27761543e+00,9.35389103e-02
82.9195512397,82.9195512397,15.8127210389 2.47374306e+01,2.47374306e+01,3.09288263e+00
;
6.2504383551,6.2504383551,0.0880388662611
91.7301596676,91.7301596676,2.29732420388
5.54218170236,5.54218170236,0.455452922044
35.365405996,35.365405996,4.46185114627
7.80223783742,7.80223783742,0.489043572826
65.6532097008,65.6532097008,5.75372898814
3.25455707226,3.25455707226,0.0850324675609
91.8771630371,91.8771630371,12.5431916129
9.84506928434,9.84506928434,0.852218660468
82.9195512397,82.9195512397,16.0032357502
;
6.2504383551,6.2504383551,0.0890869480023
91.7301596676,91.7301596676,2.32467330154
5.54218170236,5.54218170236,0.46087498064
35.365405996,35.365405996,4.51496842182
7.80223783742,7.80223783742,0.494865520122
65.6532097008,65.6532097008,5.82222576181
3.25455707226,3.25455707226,0.0860447588414
91.8771630371,91.8771630371,12.6925153226
9.84506928434,9.84506928434,0.862364120712
82.9195512397,82.9195512397,16.1937504615
; ;
;end ;end

View File

@ -0,0 +1,101 @@
import numpy as np
import random
###
# Task set generation.
###
# Main functions.
def gen_tasksets(num_tasks, num_tasksets, min_period, max_period, utilization,
rounded=False):
"""Generate task sets.
Variables:
num_tasks: number of tasks per set
num_tasksets: number of sets
min_period: minimal period
max_period: maximal period
utilization: desired utilization
rounded: flag to round periods to integers
"""
# Create periods.
tasksets_periods = generate_periods_loguniform(
num_tasks, num_tasksets, min_period, max_period, rounded)
# Create utilizations.
tasksets_utilizations = generate_utilizations_uniform(
num_tasks, num_tasksets, utilization)
# Create tasksets by matching both of the above.
tasksets = []
tasksetsnp = []
for i in range(num_tasksets):
taskset = []
for j in range(num_tasks):
task = {
'execution': (tasksets_periods[i][j]
* tasksets_utilizations[i][j]),
'period': tasksets_periods[i][j],
'deadline': tasksets_periods[i][j]
}
taskset.append(task)
tasksets.append(taskset)
tasksetsnp.append(np.array((tasksets_periods[0],tasksets_periods[0], np.array(tasksets_periods[0])*np.array(tasksets_utilizations[0]))).T)
return np.array(tasksetsnp)
def generate_utilizations_uniform(num_tasks, num_tasksets, utilization):
"""Generate utilizations with UUNIFAST.
Variables:
num_tasks: number of tasks per set
num_tasksets: number of sets
utilization: desired utilization in (0,1]
"""
def uunifast(num_tasks, utilization):
"""UUNIFAST utilization pulling."""
utilizations = []
cumulative_utilization = utilization
for i in range(1, num_tasks):
# Randomly set next utilization.
cumulative_utilization_next = (
cumulative_utilization
* random.random() ** (1.0/(num_tasks-i)))
utilizations.append(
cumulative_utilization - cumulative_utilization_next)
# Compute remaining utilization.
cumulative_utilization = cumulative_utilization_next
utilizations.append(cumulative_utilization_next)
# Return list of utilizations.
return utilizations
# Return one list of utilizations for each task set.
return [uunifast(num_tasks, utilization) for i in range(num_tasksets)]
# help functions
def generate_periods_loguniform(num_tasks, num_tasksets, min_period,
max_period, rounded=False):
"""Generate log-uniformly distributed periods to create tasks.
Variables:
num_tasks: number of tasks per set
num_tasksets: number of sets
min_period: minimal period
max_period: maximal period
rounded: flag to round periods to integers
"""
# Create random periods.
periods = np.exp(np.random.uniform(
low=np.log(min_period),
high=np.log(max_period),
size=(num_tasksets, num_tasks)))
# Make list out of them
if rounded: # round periods to nearest integer
return np.rint(periods).tolist()
else:
return periods.tolist()
def gen_np_taskset(NrTasks):
tasksets = []
for i in range(55,101,3):
tasksets.append(gen_tasksets(NrTasks,1,1,100,i/100)[0])
return np.array(tasksets)

1819
task_sets/old/100tasks.txt Normal file

File diff suppressed because it is too large Load Diff

199
task_sets/old/10tasks.txt Normal file
View File

@ -0,0 +1,199 @@
6.2504383551,6.2504383551,0.0712695584018
91.7301596676,91.7301596676,1.85973864123
5.54218170236,5.54218170236,0.368699984512
35.365405996,35.365405996,3.61197473745
7.80223783742,7.80223783742,0.395892416097
65.6532097008,65.6532097008,4.65778060945
3.25455707226,3.25455707226,0.0688358070731
91.8771630371,91.8771630371,10.1540122581
9.84506928434,9.84506928434,0.689891296569
82.9195512397,82.9195512397,12.9550003692
;
6.2504383551,6.2504383551,0.072317640143
91.7301596676,91.7301596676,1.8870877389
5.54218170236,5.54218170236,0.374122043108
35.365405996,35.365405996,3.665092013
7.80223783742,7.80223783742,0.401714363393
65.6532097008,65.6532097008,4.72627738312
3.25455707226,3.25455707226,0.0698480983536
91.8771630371,91.8771630371,10.3033359678
9.84506928434,9.84506928434,0.700036756813
82.9195512397,82.9195512397,13.1455150805
;
6.2504383551,6.2504383551,0.0733657218842
91.7301596676,91.7301596676,1.91443683656
5.54218170236,5.54218170236,0.379544101704
35.365405996,35.365405996,3.71820928856
7.80223783742,7.80223783742,0.407536310688
65.6532097008,65.6532097008,4.79477415679
3.25455707226,3.25455707226,0.0708603896341
91.8771630371,91.8771630371,10.4526596774
9.84506928434,9.84506928434,0.710182217057
82.9195512397,82.9195512397,13.3360297918
;
6.2504383551,6.2504383551,0.0744138036254
91.7301596676,91.7301596676,1.94178593423
5.54218170236,5.54218170236,0.384966160299
35.365405996,35.365405996,3.77132656411
7.80223783742,7.80223783742,0.413358257984
65.6532097008,65.6532097008,4.86327093046
3.25455707226,3.25455707226,0.0718726809146
91.8771630371,91.8771630371,10.6019833871
9.84506928434,9.84506928434,0.720327677301
82.9195512397,82.9195512397,13.5265445031
;
6.2504383551,6.2504383551,0.0754618853666
91.7301596676,91.7301596676,1.96913503189
5.54218170236,5.54218170236,0.390388218895
35.365405996,35.365405996,3.82444383966
7.80223783742,7.80223783742,0.41918020528
65.6532097008,65.6532097008,4.93176770412
3.25455707226,3.25455707226,0.072884972195
91.8771630371,91.8771630371,10.7513070968
9.84506928434,9.84506928434,0.730473137544
82.9195512397,82.9195512397,13.7170592144
;
6.2504383551,6.2504383551,0.0765099671078
91.7301596676,91.7301596676,1.99648412956
5.54218170236,5.54218170236,0.395810277491
35.365405996,35.365405996,3.87756111521
7.80223783742,7.80223783742,0.425002152575
65.6532097008,65.6532097008,5.00026447779
3.25455707226,3.25455707226,0.0738972634755
91.8771630371,91.8771630371,10.9006308065
9.84506928434,9.84506928434,0.740618597788
82.9195512397,82.9195512397,13.9075739258
;
6.2504383551,6.2504383551,0.077558048849
91.7301596676,91.7301596676,2.02383322722
5.54218170236,5.54218170236,0.401232336087
35.365405996,35.365405996,3.93067839076
7.80223783742,7.80223783742,0.430824099871
65.6532097008,65.6532097008,5.06876125146
3.25455707226,3.25455707226,0.074909554756
91.8771630371,91.8771630371,11.0499545161
9.84506928434,9.84506928434,0.750764058032
82.9195512397,82.9195512397,14.0980886371
;
6.2504383551,6.2504383551,0.0786061305902
91.7301596676,91.7301596676,2.05118232489
5.54218170236,5.54218170236,0.406654394682
35.365405996,35.365405996,3.98379566631
7.80223783742,7.80223783742,0.436646047166
65.6532097008,65.6532097008,5.13725802513
3.25455707226,3.25455707226,0.0759218460365
91.8771630371,91.8771630371,11.1992782258
9.84506928434,9.84506928434,0.760909518275
82.9195512397,82.9195512397,14.2886033484
;
6.2504383551,6.2504383551,0.0796542123314
91.7301596676,91.7301596676,2.07853142255
5.54218170236,5.54218170236,0.412076453278
35.365405996,35.365405996,4.03691294186
7.80223783742,7.80223783742,0.442467994462
65.6532097008,65.6532097008,5.2057547988
3.25455707226,3.25455707226,0.076934137317
91.8771630371,91.8771630371,11.3486019355
9.84506928434,9.84506928434,0.771054978519
82.9195512397,82.9195512397,14.4791180597
;
6.2504383551,6.2504383551,0.0807022940726
91.7301596676,91.7301596676,2.10588052022
5.54218170236,5.54218170236,0.417498511874
35.365405996,35.365405996,4.09003021741
7.80223783742,7.80223783742,0.448289941757
65.6532097008,65.6532097008,5.27425157247
3.25455707226,3.25455707226,0.0779464285975
91.8771630371,91.8771630371,11.4979256452
9.84506928434,9.84506928434,0.781200438763
82.9195512397,82.9195512397,14.669632771
;
6.2504383551,6.2504383551,0.0817503758138
91.7301596676,91.7301596676,2.13322961788
5.54218170236,5.54218170236,0.42292057047
35.365405996,35.365405996,4.14314749296
7.80223783742,7.80223783742,0.454111889053
65.6532097008,65.6532097008,5.34274834613
3.25455707226,3.25455707226,0.078958719878
91.8771630371,91.8771630371,11.6472493548
9.84506928434,9.84506928434,0.791345899006
82.9195512397,82.9195512397,14.8601474823
;
6.2504383551,6.2504383551,0.082798457555
91.7301596676,91.7301596676,2.16057871555
5.54218170236,5.54218170236,0.428342629065
35.365405996,35.365405996,4.19626476851
7.80223783742,7.80223783742,0.459933836348
65.6532097008,65.6532097008,5.4112451198
3.25455707226,3.25455707226,0.0799710111584
91.8771630371,91.8771630371,11.7965730645
9.84506928434,9.84506928434,0.80149135925
82.9195512397,82.9195512397,15.0506621936
;
6.2504383551,6.2504383551,0.0838465392963
91.7301596676,91.7301596676,2.18792781321
5.54218170236,5.54218170236,0.433764687661
35.365405996,35.365405996,4.24938204406
7.80223783742,7.80223783742,0.465755783644
65.6532097008,65.6532097008,5.47974189347
3.25455707226,3.25455707226,0.0809833024389
91.8771630371,91.8771630371,11.9458967742
9.84506928434,9.84506928434,0.811636819494
82.9195512397,82.9195512397,15.2411769049
;
6.2504383551,6.2504383551,0.0848946210375
91.7301596676,91.7301596676,2.21527691088
5.54218170236,5.54218170236,0.439186746257
35.365405996,35.365405996,4.30249931961
7.80223783742,7.80223783742,0.47157773094
65.6532097008,65.6532097008,5.54823866714
3.25455707226,3.25455707226,0.0819955937194
91.8771630371,91.8771630371,12.0952204839
9.84506928434,9.84506928434,0.821782279737
82.9195512397,82.9195512397,15.4316916162
;
6.2504383551,6.2504383551,0.0859427027787
91.7301596676,91.7301596676,2.24262600855
5.54218170236,5.54218170236,0.444608804853
35.365405996,35.365405996,4.35561659516
7.80223783742,7.80223783742,0.477399678235
65.6532097008,65.6532097008,5.61673544081
3.25455707226,3.25455707226,0.0830078849999
91.8771630371,91.8771630371,12.2445441936
9.84506928434,9.84506928434,0.831927739981
82.9195512397,82.9195512397,15.6222063276
;
6.2504383551,6.2504383551,0.0869907845199
91.7301596676,91.7301596676,2.26997510621
5.54218170236,5.54218170236,0.450030863449
35.365405996,35.365405996,4.40873387072
7.80223783742,7.80223783742,0.483221625531
65.6532097008,65.6532097008,5.68523221448
3.25455707226,3.25455707226,0.0840201762804
91.8771630371,91.8771630371,12.3938679032
9.84506928434,9.84506928434,0.842073200225
82.9195512397,82.9195512397,15.8127210389
;
6.2504383551,6.2504383551,0.0880388662611
91.7301596676,91.7301596676,2.29732420388
5.54218170236,5.54218170236,0.455452922044
35.365405996,35.365405996,4.46185114627
7.80223783742,7.80223783742,0.489043572826
65.6532097008,65.6532097008,5.75372898814
3.25455707226,3.25455707226,0.0850324675609
91.8771630371,91.8771630371,12.5431916129
9.84506928434,9.84506928434,0.852218660468
82.9195512397,82.9195512397,16.0032357502
;
6.2504383551,6.2504383551,0.0890869480023
91.7301596676,91.7301596676,2.32467330154
5.54218170236,5.54218170236,0.46087498064
35.365405996,35.365405996,4.51496842182
7.80223783742,7.80223783742,0.494865520122
65.6532097008,65.6532097008,5.82222576181
3.25455707226,3.25455707226,0.0860447588414
91.8771630371,91.8771630371,12.6925153226
9.84506928434,9.84506928434,0.862364120712
82.9195512397,82.9195512397,16.1937504615
;
;end