Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Samant, Sunil (Data61, Marsfield) authored and Samant, Sunil (Data61, Marsfield) committed Mar 31, 2021
1 parent 33e34a4 commit 074a126
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public static float FCOStrategy(int w1, int w2, int w3, int e2eQoS, int delta_A,
aggQoS = aggQoS + qosS2[0];
total_cost = total_cost + costS2[0];
//System.out.println("spark: " + instS2[0] + "");
System.out.println(instS2[0]);
//System.out.println(instS2[0]);
break;
}
case 3: {
Expand Down Expand Up @@ -398,7 +398,7 @@ public static float FCOStrategy(int w1, int w2, int w3, int e2eQoS, int delta_A,
aggQoS = aggQoS + qosS3[0];
total_cost = total_cost + costS3[0];

//System.out.println("cassandra: " + instS3[0] + "");
System.out.println(instS3[0]);
//System.out.print(instS3[0] + '\t');
// String[] split = instS3[0].split("X");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,9 +1876,10 @@ else if (proSO) {

public static void main(String args[]) throws IOException {
//Float[] price = {0.0385F, 0.0928F, 0.1856F}; //OD Ohio
Float[] price = new Float[3]; // {0.048F, 0.1168F, 0.2336F}; //OD Sydney
//Float[] price = new Float[3]; // {0.048F, 0.1168F, 0.2336F}; //OD Sydney
float totalCost = 0.0F;
//Float[] price = {0.032F, 0.065F, 0.13F}; //SB - 6hrs Ohio
//Float[] price = {0.048F, 0.1168F, 0.2336F}; //OD Sydney
Float[] price = {0.019F, 0.025F, 0.030F}; //SB - 6hrs Ohio
//Float[] price = {0.019F, 0.035F, 0.0701F}; //Spot Sydeny
// Float[] price = {0.048F, 0.1168F, 0.2336F}; //mixed - first spot, 2 -ODs
//Float[] price = {0.019F, 0.035F, 0.0701F}; // mixed - 2 Spots , 1 OD
Expand Down Expand Up @@ -1929,12 +1930,13 @@ public static void main(String args[]) throws IOException {
current_allocation_ingestion = current_allocation_processing = current_allocation_storage = null;
previous_Period_total_cost = 0.0F;
boolean ingSO, ingSI, proSO, proSI, stoSO, stoSI;

//int[] workloads = {10000, 10000, 7500};
int[] workloads = read("D:\\dpp.xls"); //read workload data from a file - 31 days NYC taxi data.
Float[] mediumInstPrice = readPrice("D:\\m6g_mediumPriceOD.xls"); // m6g_mediumPriceOD , m6g_mediumPriceSpot
Float[] largeInstPrice = readPrice("D:\\t2_largePriceOD.xls");// t2_largePriceOD , t2_largePriceSpot
Float[] xlargeInstPrice = readPrice("D:\\t2_xlargePriceOD.xls"); // t2_xlargePriceOD, t2_xlargePriceSpot
//Float[] mediumInstPrice = readPrice("D:\\m6g_mediumPriceOD.xls"); // m6g_mediumPriceOD , m6g_mediumPriceSpot
//Float[] largeInstPrice = readPrice("D:\\t2_largePriceOD.xls");// t2_largePriceOD , t2_largePriceSpot
//Float[] xlargeInstPrice = readPrice("D:\\t2_xlargePriceOD.xls"); // t2_xlargePriceOD, t2_xlargePriceSpot
int w1, w2, w3;
String resource_heterogeneity = null;
System.out.println("Select stratgey:(DCO/FCO)");
String strategy = scanner.next();
System.out.println("Resource homogeneity or heterogeneity: (Ho/He)");
Expand All @@ -1948,9 +1950,9 @@ public static void main(String args[]) throws IOException {
for (int i = 0; i < workloads.length; i++) {
if (i == 0) {
w3 = (int) (0.25 * workloads[i]);
price[0] = mediumInstPrice[i];
price[1] = largeInstPrice[i];
price[2] = xlargeInstPrice[i];
// price[0] = mediumInstPrice[i];
// price[1] = largeInstPrice[i];
//price[2] = xlargeInstPrice[i];
if (null == option) {
System.out.println("Please select appropriate heterogeneity option:");
} else {
Expand All @@ -1967,9 +1969,9 @@ public static void main(String args[]) throws IOException {
}
}
} else {
price[0] = mediumInstPrice[i];
price[1] = largeInstPrice[i];
price[2] = xlargeInstPrice[i];
//price[0] = mediumInstPrice[i];
//price[1] = largeInstPrice[i];
//price[2] = xlargeInstPrice[i];
if (current_capacity_ingestion > workloads[i]) {
ingSI = true; //scale-in
ingSO = false;
Expand Down Expand Up @@ -2032,17 +2034,19 @@ public static void main(String args[]) throws IOException {
long startTime = System.currentTimeMillis();
for (int i = 0; i < workloads.length; i++) {
w3 = (int) (0.25 * workloads[i]);
price[0] = mediumInstPrice[i];
price[1] = largeInstPrice[i];
price[2] = xlargeInstPrice[i];
//price[0] = mediumInstPrice[i];
//price[1] = largeInstPrice[i];
//price[2] = xlargeInstPrice[i];
if (null == option) {
System.out.println("Please select appropriate heterogeneity option:");
} else {
switch (option) {
case "he":
resource_heterogeneity = "heterogeneous";
totalCost = totalCost + HeterogeneousFCO.FCOStrategy(workloads[i], workloads[i], w3, e2eQoS, deltaA, deltaB, price);
break;
case "ho":
resource_heterogeneity = "homogeneous";
totalCost = totalCost + Homogeneous.HomogeneousFCO(workloads[i], workloads[i], w3, e2eQoS, deltaA, deltaB, price);
break;
default:
Expand All @@ -2054,7 +2058,7 @@ public static void main(String args[]) throws IOException {
}
long endTime = System.currentTimeMillis();
System.out.println("Total time taken to find cost-optimal solution(ms):" + (endTime - startTime) + "");
System.out.println("Total cost of RA using FCO:" + totalCost);
System.out.println("Total cost of RA using FCO with " + resource_heterogeneity + " is :" + totalCost);
//System.out.println("Total time taken to find cost-optimal solution(ms): " + duration);
break;
default:
Expand Down

0 comments on commit 074a126

Please sign in to comment.