-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPropFairtest.py
More file actions
executable file
·36 lines (32 loc) · 1.05 KB
/
PropFairtest.py
File metadata and controls
executable file
·36 lines (32 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def Propfair(GEvector,Evector,lambdaList,T):
#green energy vector, Grid Energy vector , T is the previous scheduled memory
tc=50
NDC=len(GEvector)
Metric=[0]*NDC # Vector of the metric we used for scheduling
for i in range(0,NDC):
Metric[i]=GEvector[i]/T[i]
MAX=Metric.index(max(Metric)) #the index of the choosen one
SClist=[0]*len(GEvector) #refresh the Schedule list
SClist[MAX]=1 #The Data Center which is selected
for i in range(0,NDC):
lambdaList[i]=lambdaList[i]+SClist[i]
for i in range(0,NDC):
if SClist[i]==1:
T[i]=(1-(1/tc))*T[i]+((1/tc))*GEvector[i]
else:
T[i]=(1-(1/tc))*T[i]
print(T)
print(Metric)
print(MAX)
print(SClist)
print(lambdaList)
print('----------------')
return SClist, lambdaList, Metric, T
T=[1]*3
GEvector=[82,95,54]
Evector=[1]*3
SClist=[0]*3
lambdaList=[0]*3
for i in range(0,10):
SClist,lambdaList, Metric, T=Propfair(GEvector,Evector,lambdaList,T)
x=input()