Class PAM
java.lang.Object
PAM
public class PAM
extends java.lang.Object
PAM class implements the PLAN, Algorithm 4, and print out put file for Minimum Cost Flow
-
Field Summary
Fields Modifier and Type Field Description private DataCenter
dataCenter
private double[]
PAMarray
private double[]
PLANingressEgress
private java.util.Hashtable<java.lang.String,java.lang.Integer>
VM_PM_AfterMigrate
-
Constructor Summary
Constructors Constructor Description PAM(DataCenter dataCenter)
-
Method Summary
Modifier and Type Method Description double
costBetweenMbsOrderPolicy()
Calculate length from first middle box to last middle box in ordered policy without the communication frequenciesdouble
costPLAN()
Calculate the cost in PLAN algorithm of unordered PAL (without migration) travel all the Virtual machines pair for each virtual machine pair, find the ingress and egress middle box calculate the length from VM to ingress, and VMP to egress calculate the total communication from VM to ingress, ingress to all middle box, and VMP to egressdouble
costUnorderPAM()
Calculate the cost for unordered in PAM algorithmint
ingressOrEgressMB(int pm)
Find the ingress: the middle box closest to the VM, and egress: the middle box closest to the VMPdouble
initialCommunicationCostOfDatacenter()
Initial communication Cost of Data Center before migration.double[][]
middleBoxMatrix()
Matrix represents the shortest distance from one middle box to all the middle boxes row [mb0, mb1, mb2, ...] column [mb0, mb1, mb2,...]java.util.List<java.lang.Integer>
orderTravelMB(int ingress, int egress)
Get the list ordered travel between middle boxes with the minimum distance between middle boxes.double
printCommunicationCostAfterMCF(java.lang.String fileNameIn)
void
printMCF(java.lang.String fileIndex)
Print the structure format in MCF to use MCF code to calculate the MCFdouble
totalCommunicationCostBetweenMbsOrdered()
Calculate total communication cost between middle boxes with communication frequenciesdouble
totalCommunicationFre()
Calculate total communication frequencies between virtual machines pairs
-
Field Details
-
dataCenter
-
PLANingressEgress
private double[] PLANingressEgress -
PAMarray
private double[] PAMarray -
VM_PM_AfterMigrate
private java.util.Hashtable<java.lang.String,java.lang.Integer> VM_PM_AfterMigrate
-
-
Constructor Details
-
Method Details
-
costBetweenMbsOrderPolicy
public double costBetweenMbsOrderPolicy()Calculate length from first middle box to last middle box in ordered policy without the communication frequencies
- Returns:
- cost in order policy from first to last middle box.
-
totalCommunicationFre
public double totalCommunicationFre()Calculate total communication frequencies between virtual machines pairs- Returns:
- total communication frequencies.
-
totalCommunicationCostBetweenMbsOrdered
public double totalCommunicationCostBetweenMbsOrdered()Calculate total communication cost between middle boxes with communication frequencies- Returns:
- total communication cost between middle boxes.
-
initialCommunicationCostOfDatacenter
public double initialCommunicationCostOfDatacenter()Initial communication Cost of Data Center before migration.- Returns:
- total communication cost of Data Center before migration.
-
printMCF
public void printMCF(java.lang.String fileIndex) throws java.io.IOExceptionPrint the structure format in MCF to use MCF code to calculate the MCF- Parameters:
fileIndex
- input file name for MCF file- Throws:
java.io.IOException
- not support
-
printCommunicationCostAfterMCF
public double printCommunicationCostAfterMCF(java.lang.String fileNameIn) throws java.io.FileNotFoundException- Parameters:
fileNameIn
- file name for calculate communication cost in Minimum Cost Flow- Returns:
- - the total communication cost in MCF
- Throws:
java.io.FileNotFoundException
- not support
-
costUnorderPAM
public double costUnorderPAM()Calculate the cost for unordered in PAM algorithm- Returns:
- cost of unordered in PAM algorithm
-
middleBoxMatrix
public double[][] middleBoxMatrix()Matrix represents the shortest distance from one middle box to all the middle boxes row [mb0, mb1, mb2, ...] column [mb0, mb1, mb2,...]- Returns:
- double array represents the shortest distance between middle boxes.
-
orderTravelMB
public java.util.List<java.lang.Integer> orderTravelMB(int ingress, int egress)Get the list ordered travel between middle boxes with the minimum distance between middle boxes.- Parameters:
ingress
- - source as a middle box closest to VMegress
- - destination as a middle box closest to VMP- Returns:
- - list in order of Middle box
-
ingressOrEgressMB
public int ingressOrEgressMB(int pm)Find the ingress: the middle box closest to the VM, and egress: the middle box closest to the VMP- Parameters:
pm
- - index of the physical machine- Returns:
- the index of the middle box
-
costPLAN
public double costPLAN()Calculate the cost in PLAN algorithm of unordered PAL (without migration) travel all the Virtual machines pair for each virtual machine pair, find the ingress and egress middle box calculate the length from VM to ingress, and VMP to egress calculate the total communication from VM to ingress, ingress to all middle box, and VMP to egress- Returns:
- cost in PLAN Algorithm
-