From 4a595665dce6e8dad568222373c526ae83811bdd Mon Sep 17 00:00:00 2001 From: Mukendi Mputu Date: Fri, 24 Jun 2022 19:13:20 +0200 Subject: [PATCH] =?UTF-8?q?hyperbolic=20sched=20test=20works=20?= =?UTF-8?q?=F0=9F=91=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schedTests/HyperbolicBound.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/schedTests/HyperbolicBound.py b/schedTests/HyperbolicBound.py index 250da99..e92030e 100644 --- a/schedTests/HyperbolicBound.py +++ b/schedTests/HyperbolicBound.py @@ -12,11 +12,17 @@ import include.TasksHelper as TH # C_i is accessed as: tasks[i][2] # The number of tasks can be accessed as: tasks.shape[0] + #The sufficient Test for the Hyperbolic bound def test(tasks): - - ##################### - #YOUR CODE GOES HERE# - ##################### - - return False + """ 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 + 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])) + 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