hyperbolic sched test works 👌

This commit is contained in:
Mukendi Mputu 2022-06-24 19:13:20 +02:00
parent a382f8d408
commit 4a595665dc
Signed by untrusted user: samy.mputu
GPG Key ID: 492A6E5AC70F6B0B
1 changed files with 12 additions and 6 deletions

View File

@ -12,11 +12,17 @@ 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 sufficient Test for the Hyperbolic bound #The sufficient Test for the Hyperbolic bound
def test(tasks): def test(tasks):
""" The Hyperbolic bound is given as Π(U + 1) of all tasks: """
##################### # compute the hyperbolic bound as product of the U_factor of each task + 1
#YOUR CODE GOES HERE# hb = 1
##################### for i in range(len(tasks)): # len(tasks) is 10
# print("Task #{}: P_i={} = D_i ={}, C_i={}".format(i, tasks[i][0], tasks[i][1], tasks[i][2]))
return False hb *= (tasks[i][2] / tasks[i][0]) + 1
# compare this computed bound to 2.0
# if greater then no guaranty of schedulability
# otherwise task set is schedulable
print("Hyperbolic bound: {}".format(hb))
return hb <= 2.0