Skip to content
Snippets Groups Projects

Revert "Merge branch 'master' of https://gitlab.inria.fr/afahs/voila-orch_sim"

Merged Klervie Toczé requested to merge revert-d15df919 into master
1 file
+ 5
23
Compare changes
  • Side-by-side
  • Inline
+ 5
23
@@ -135,14 +135,12 @@ def CalculateFitness(Current,Previous,NodeObjects,Epsilon,Cs,Ca,fitnessAlpha):
#We want to also have the cost from 0 to 100
nbDedicated=len(GetNodesOfType("D",NodeObjects))
nbSpare=len(GetNodesOfType("S",NodeObjects))
#minCost=Cd
minCost=Cd
maxCost=(nbDedicated-1)*(Cd+Cr)+Cd+nbSpare*(Cs+Ca+Cr)
#percentCost=((Cost-minCost)/(maxCost-minCost))*100
percentCost=((Cost-minCost)/(maxCost-minCost))*100
#alpha=0.5 #Fitness parameter
#fitness=fitnessAlpha*(100-Epsilon)+(1-fitnessAlpha)*percentCost
percentCost=(Cost/maxCost)
fitness=fitnessAlpha*Epsilon+(1-fitnessAlpha)*percentCost
fitness=fitnessAlpha*(100-Epsilon)+(1-fitnessAlpha)*percentCost
return fitness
@@ -374,12 +372,6 @@ def GetBestWithCost(Cases,SaturationPerPod,VProximity,Ep0, Previous, NodeObjects
#Also get all the suitable cases (i.e. below the threshold)
if case.Ep < Ep0:
SuitableCases.append(case)
if SuitableCases==[]:
for case in Cases:
if case.Ep < MinEp+0.1:
SuitableCases.append(Case)
#If we have suitable cases, we want to return the one with minimum cost as the best
#Otherwise, we return the current best
if SuitableCases != []:
@@ -393,12 +385,10 @@ def GetBestWithCost(Cases,SaturationPerPod,VProximity,Ep0, Previous, NodeObjects
MinCost=case.Cost
MinCostCase=case
BestCase=MinCostCase
return BestCase
def GetBestWithFitness(Cases,SaturationPerPod,VProximity,Ep0, Previous, NodeObjects,Cs,Ca,fitnessAlpha):
assert fitnessAlpha>=0 and fitnessAlpha<=1; "The value of alpha "+fitnessAlpha+" is out of range"
MinEp=100
BestCase=Cases[0]
SuitableCases=[]
@@ -418,16 +408,12 @@ def GetBestWithFitness(Cases,SaturationPerPod,VProximity,Ep0, Previous, NodeObje
SuitableCases.append(case)
#If we have suitable cases, we want to return the one with minimum cost as the best
#Otherwise, we return the current best
if SuitableCases==[]:
for case in Cases:
if case.Ep < MinEp+0.1:
SuitableCases.append(Case)
if SuitableCases != []:
MaxFitness=CalculateFitness(SuitableCases[0],Previous,NodeObjects,SuitableCases[0].Ep,Cs,Ca,fitnessAlpha)
MaxFitnessCase=SuitableCases[0]
for case in SuitableCases:
case.Fitness=CalculateFitness(case,Previous,NodeObjects,case.Ep,Cs,Ca,fitnessAlpha)
if case.Fitness<MaxFitness:
if case.Fitness>MaxFitness:
MaxFitness=case.Fitness
MaxFitnessCase=case
BestCase=MaxFitnessCase
@@ -972,8 +958,6 @@ def FixSaturationQoSFitness(Nodes,NodeObjects,SelectedNodes,start,TempCase,FullT
if number!=0: # number=0 should return the solution, in this case else will be skipped and the function will go to the if number==0 directly
print("debug 16")
return Cases
else:
return Best
else: # No scale up with one D solution was found, we have to try S
NewCases,Number,Condition=AutoScale(VProximity,Ep0,SaturationPerPod,
Timeout,TempCase,ProbMat,TestMat,NodeObjects,
@@ -1055,8 +1039,6 @@ def FixProximityQoSFitness(Nodes,NodeObjects,SelectedNodes,start,TempCase,FullTe
if number!=0: # number=0 should return the solution, in this case else will be skipped and the function will go to the if number==0 directly
print("debug 19")
return Cases
else:
return Best
else:
NewCases,Number,Condition=AutoScale(VProximity,Ep0,SaturationPerPod,
Loading