Commit 83810f0a authored by Jonathan Shahen's avatar Jonathan Shahen
Browse files

Conference Copy

parent 05736024
......@@ -22,9 +22,9 @@ int p0[Machines,Clients]=...;
int r=...;
int t=ftoi(ceil(lg(r+1)));
int dMaxVal=ftoi(pow(2,2*t-1)-1);
int dMaxVal=maxl(ftoi(pow(2,(2*t)-1)) - 1, 1);
range tRange=0..t;
range tRange=0..t-1;
range zRange=0..t-1;
// NEW Placement of the Sum of Client VMs per Machine
......@@ -46,7 +46,7 @@ subject to {
0 <= p[k,c0,u] + p[k,c1,v] - (2 * e[c0,c1,k,u,v]) <= 1;
// Setting up values for d
forall(k in Machines, c0 in Clients, c1 in Clients, z in zRange)
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z) *e[c0,c1,k,l,z]);
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z+l) * e[c0,c1,k,l,z]);
// Capacity of servers respected
forall(k in Machines)
machineCapacity[k] >= sum(i in Clients) (p1[k,i]);
......
......@@ -22,9 +22,9 @@ int p0[Machines,Clients]=...;
int r=...;
int t=ftoi(ceil(lg(r+1)));
int dMaxVal=ftoi(pow(2,2*t-1)-1);
int dMaxVal=maxl(ftoi(pow(2,(2*t)-1)) - 1, 1);
range tRange=0..t;
range tRange=0..t-1;
range zRange=0..t-1;
// NEW Placement of the Sum of Client VMs per Machine
......@@ -46,7 +46,7 @@ subject to {
0 <= p[k,c0,u] + p[k,c1,v] - (2 * e[c0,c1,k,u,v]) <= 1;
// Setting up values for d
forall(k in Machines, c0 in Clients, c1 in Clients, z in zRange)
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z) *e[c0,c1,k,l,z]);
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z+l) * e[c0,c1,k,l,z]);
// Capacity of servers respected
forall(k in Machines)
machineCapacity[k] >= sum(i in Clients) (p1[k,i]);
......
......@@ -22,9 +22,9 @@ int p0[Machines,Clients]=...;
int r=...;
int t=ftoi(ceil(lg(r+1)));
int dMaxVal=maxl(ftoi(pow(2,(2*t)-1)-1), 1);
int dMaxVal=maxl(ftoi(pow(2,(2*t)-1)) - 1, 1);
range tRange=0..t;
range tRange=0..t-1;
range zRange=0..t-1;
// NEW Placement of the Sum of Client VMs per Machine
......@@ -35,7 +35,7 @@ dvar int e[Clients,Clients,Machines,tRange,tRange] in 0..1;
dvar int d[Clients,Clients,Machines,zRange] in 0..dMaxVal;
minimize
sum(c0, c1 in Clients) ( L[c0,c1] + sum(k in Machines, z in zRange) (d[c0,c1,k,z]) );
sum(c0, c1 in Clients: c0 != c1) (L[c0,c1] + sum(k in Machines, z in zRange) (d[c0,c1,k,z]) );
subject to {
// p1 represented as a value from p's bit form
......@@ -46,7 +46,7 @@ subject to {
0 <= p[k,c0,u] + p[k,c1,v] - (2 * e[c0,c1,k,u,v]) <= 1;
// Setting up values for d
forall(k in Machines, c0 in Clients, c1 in Clients, z in zRange)
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z) *e[c0,c1,k,l,z]);
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z+l) * e[c0,c1,k,l,z]);
// Capacity of servers respected
forall(k in Machines)
machineCapacity[k] >= sum(i in Clients) (p1[k,i]);
......
......@@ -22,9 +22,9 @@ int p0[Machines,Clients]=...;
int r=...;
int t=ftoi(ceil(lg(r+1)));
int dMaxVal=ftoi(pow(2,2*t-1)-1);
int dMaxVal=maxl(ftoi(pow(2,(2*t)-1)) - 1, 1);
range tRange=0..t;
range tRange=0..t-1;
range zRange=0..t-1;
// NEW Placement of the Sum of Client VMs per Machine
......@@ -46,7 +46,7 @@ subject to {
0 <= p[k,c0,u] + p[k,c1,v] - (2 * e[c0,c1,k,u,v]) <= 1;
// Setting up values for d
forall(k in Machines, c0 in Clients, c1 in Clients, z in zRange)
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z) *e[c0,c1,k,l,z]);
d[c0,c1,k,z] == sum(l in zRange) (pow(2,z+l) * e[c0,c1,k,l,z]);
// Capacity of servers respected
forall(k in Machines)
machineCapacity[k] >= sum(i in Clients) (p1[k,i]);
......
This diff is collapsed.
......@@ -112,7 +112,7 @@ public class VagabondCUI {
BufferedReader bfr = new BufferedReader(new FileReader(previousCommandFilename));
previousCmd = bfr.readLine();
bfr.close();
System.out.println("Previous Command ('!prev' to use the previous command): " + previousCmd);
System.out.println("Previous Command ('!p' to use the previous command): " + previousCmd);
} catch (IOException e) {
System.out.println("[ERROR] Unable to load previous command!");
}
......
......@@ -91,6 +91,9 @@ public class VagabondInstance {
case PLACEMENT_EQUALSPREADHALF:
placementMap = PlacementMapExamples.equalSpreadClientsHalfFull(settings.equalSpreadNum);
break;
case PLACEMENT_EQUALSPREADHALF2:
placementMap = PlacementMapExamples.equalSpreadClientsHalfFull2(settings.equalSpreadNum);
break;
case PLACEMENT_SPECIALTEST1:
rPlace.randomSeed(settings.randomSeed);
placementMap = PlacementMapExamples.specialTest1(rPlace, settings.equalSpreadNum);
......@@ -106,6 +109,11 @@ public class VagabondInstance {
case PLACEMENT_NAHIDTEST:
placementMap = PlacementMapExamples.nomadSubOptimalRCPlacement();
break;
case PLACEMENT_RANDOMHALFFULL:
rPlace.randomSeed(settings.randomSeed);
placementMap = PlacementMapExamples.randomHalfFull(rPlace, settings.equalSpreadNum);
break;
default:
logger.severe("No placement algorithm was picked, or one that is not implemented is used. "
+ "PlacementAlgorithm:" + settings.placementAlgorithm);
......@@ -455,6 +463,13 @@ public class VagabondInstance {
settings.placementAlgorithm = VagabondOptionString.PLACEMENT_EQUALSPREADHALF;
settings.equalSpreadNum = Integer.valueOf(value);
} else if (value.equals(VagabondOptionString.PLACEMENT_EQUALSPREADHALF2.toString())) {
value = prop.getProperty(VagabondOptionString.EQUALSPREADNUM.toString(), null);
if (value == null) { throw new IllegalArgumentException("Must provide a equalSpreadNum!"); }
settings.placementAlgorithm = VagabondOptionString.PLACEMENT_EQUALSPREADHALF2;
settings.equalSpreadNum = Integer.valueOf(value);
} else if (value.equals(VagabondOptionString.PLACEMENT_SPECIALTEST1.toString())) {
value = prop.getProperty(VagabondOptionString.EQUALSPREADNUM.toString(), null);
if (value == null) { throw new IllegalArgumentException("Must provide a equalSpreadNum!"); }
......@@ -483,6 +498,13 @@ public class VagabondInstance {
settings.placementAlgorithm = VagabondOptionString.PLACEMENT_PERCENTFILL;
settings.equalSpreadNum = Integer.valueOf(value);
} else if (value.equals(VagabondOptionString.PLACEMENT_RANDOMHALFFULL.toString())) {
value = prop.getProperty(VagabondOptionString.EQUALSPREADNUM.toString(), null);
if (value == null) { throw new IllegalArgumentException("Must provide a equalSpreadNum!"); }
settings.placementAlgorithm = VagabondOptionString.PLACEMENT_RANDOMHALFFULL;
settings.equalSpreadNum = Integer.valueOf(value);
} else {
throw new IllegalArgumentException("Placement Algorithm: " + value + " does not exist!");
}
......@@ -548,7 +570,7 @@ public class VagabondInstance {
value = prop.getProperty(VagabondOptionString.RANDOMSEED.toString(), null);
if (value != null) {
settings.randomSeed = Integer.valueOf(value);
settings.randomSeed = Long.valueOf(value);
} else {
settings.randomSeed = System.currentTimeMillis();
}
......
......@@ -184,6 +184,13 @@ public enum VagabondOptionString {
*/
PLACEMENT_RANDOM("randomPlacement"),
/**
* [Placement Algorithms] Generates a placement map using
* {@link PlacementMapExamples#randomHalfFull(vagabond.placement.RandomPlacement, int)}
* @vagabond.category Placement Algorithms
*/
PLACEMENT_RANDOMHALFFULL("randomHalfFull"),
/**
* [Placement Algorithms] Reads in the placement map from a CSV formatted file
* @vagabond.category Placement Algorithms
......@@ -202,6 +209,12 @@ public enum VagabondOptionString {
* @vagabond.category Placement Algorithms
*/
PLACEMENT_EQUALSPREADHALF("equalSpreadHalf"),
/**
* [Placement Algorithms] Generates a placement map using
* {@link PlacementMapExamples#equalSpreadClientsHalfFull(int)}
* @vagabond.category Placement Algorithms
*/
PLACEMENT_EQUALSPREADHALF2("equalSpreadHalf2"),
/**
* [Placement Algorithms] Generates a placement map using
......
......@@ -84,6 +84,29 @@ public class PlacementMapExamples {
return place;
}
public static PlacementMap equalSpreadClientsHalfFull2(int machineAndSlotAndClientSize) {
PlacementMap place = new PlacementMap(machineAndSlotAndClientSize, machineAndSlotAndClientSize);
int machineID = 0;
int half = (int) (((double) machineAndSlotAndClientSize) / 2);
for (int serviceID = 0; serviceID < half; serviceID++) {
machineID = serviceID;
for (int clientID = 0; clientID < machineAndSlotAndClientSize; clientID++) {
place.addNewVMToMachine(
new VM(clientID, serviceID, place.getNextAvailableVMID()),
machineID);
}
}
VagabondSettings s = VagabondSettings.getInstance();
s.numberOfClients = machineAndSlotAndClientSize;
s.numberOfMachines = machineAndSlotAndClientSize;
s.numberOfMachineSlots = machineAndSlotAndClientSize;
s.numberOfVMsPerClient = half;
return place;
}
/**
* Provides the 4x4 standard example but each client has half the number of VMs.
* <ul>
......@@ -125,7 +148,7 @@ public class PlacementMapExamples {
}
public static PlacementMap specialTest2(RandomPlacement rp, int specialSize) {
int quarter = specialSize / 4;
int quarter = (int) (((double) specialSize) / 4);
int dbl = specialSize * 2;
VagabondSettings s = VagabondSettings.getInstance();
......@@ -138,6 +161,19 @@ public class PlacementMapExamples {
s.numberOfVMsPerClient, false);
}
public static PlacementMap randomHalfFull(RandomPlacement rp, int specialSize) {
int half = (int) (((double) specialSize) / 2);
VagabondSettings s = VagabondSettings.getInstance();
s.numberOfClients = specialSize;
s.numberOfMachines = specialSize;
s.numberOfMachineSlots = specialSize;
s.numberOfVMsPerClient = half;
return rp.generatePlacementMap(s.numberOfMachines, s.numberOfMachineSlots, s.numberOfClients,
s.numberOfVMsPerClient, false);
}
public static PlacementMap percentFilled(RandomPlacement rp, int specialSize) {
VagabondSettings s = VagabondSettings.getInstance();
s.numberOfMachines = 8;// 5;
......
......@@ -190,11 +190,13 @@ public class RunSolverCNFSAT implements RunSolver {
if (!recordlines) {
logger.info("[CNF Solver " + tp +
"] Binary Search UNSAT for: mid = " + mid + "; high=" + hi + "; low=" + lo);
"] Binary Search UNSAT for: mid = " + mid + "; high=" + hi + "; low=" + lo + "; Took "
+ timing.getLastElapsedTimeSec() + " seconds");
lo = mid + 1; // unsat
} else {
logger.info("[CNF Solver " + tp +
"] Binary Search SAT for: mid = " + mid + "; high=" + hi + "; low=" + lo);
"] Binary Search SAT for: mid = " + mid + "; high=" + hi + "; low=" + lo + "; Took "
+ timing.getLastElapsedTimeSec() + " seconds");
cnfcert = lines;
hi = mid - 1;
}
......
......@@ -64,15 +64,17 @@ public class ReduceToNomad implements ReduceTo {
FileWriter fws = new FileWriter(nomadSettings);
fws.write("Generated by Vagabond: " + VagabondSettings.df.format(new Date()) + "\n");
if (settings.migrationBudget != -1) {
fws.write("BUDGET=" + Precision.round(calculateMigrationPercentage(place, settings.migrationBudget), 3)
+ "\n");
double tmp = Precision.round(calculateMigrationPercentage(place, settings.migrationBudget), 3);
System.out.println("Migration Budget = " + tmp);
fws.write("BUDGET=" + tmp + "\n");
} else {
/**
* This means 1000% of VMs can move per EPOCH
* Ex: TotalVMs = 100
* BUDGET=10 == migrationBuget=1000
*/
fws.write("BUDGET=10\n");
fws.write("BUDGET=1000\n");
}
fws.write("slidingT=" + settings.slidingWindow + "\n");
fws.write("numEpoch=" + settings.numberOfEpochs + "\n");
......@@ -83,7 +85,7 @@ public class ReduceToNomad implements ReduceTo {
fws.write("PlacementMap=" + nomadPlacement.getName() + "\n");
fws.write("\n# You can ignore the lines below\n");
if (settings.randomSeed == -1) {
fws.write("SEED=10000\n");
fws.write("SEED=10\n");
} else {
fws.write("SEED=" + settings.randomSeed + "\n");
}
......@@ -106,6 +108,6 @@ public class ReduceToNomad implements ReduceTo {
}
public static double calculateMigrationPercentage(PlacementMap place, int migrationBudget) {
return migrationBudget / place.getNumberOfVMs();
return ((double) migrationBudget) / ((double) place.getNumberOfVMs());
}
}
# I am a comment
numberOfMachines=4
numberOfMachineSlots=3
numberOfClients=4
numberOfVMsPerClient=2
maxCCIL=false
#reduction=nomad
reduction=ilp
#reduction=cnf
# randomPlacement equalSpread equalSpreadHalf nomadTest percentFill nahidTest
placement=randomPlacement
equalSpreadNum=6
migrationBudget=-1
numberOfEpochs=1
#
numberOfMachines=5
numberOfMachineSlots=4
numberOfClients=6
numberOfVMsPerClient=3
fillInEmpty=false
numberOfEpochs=10
# Keep at 5 unless you recompile NOMAD for a different value
slidingWindow=5
placement=randomPlacement
reduction=ilp
migrationBudget=3
# OPTIONAL: Can Comment these lines out
seed=11
name=CNFSimple
comment=Just a simple test to show that something works
\ No newline at end of file
#seed=10
name=equalSpread_1Epoch_MB-1
comment=
\ No newline at end of file
# I am a comment
maxCCIL=false
#reduction=nomad
#reduction=ilp
reduction=cnf
# randomPlacement equalSpread equalSpreadHalf nomadTest percentFill nahidTest randomHalfFull
placement=randomHalfFull
equalSpreadNum=12
migrationBudget=-1
numberOfEpochs=1
#
numberOfMachines=5
numberOfMachineSlots=4
numberOfClients=6
numberOfVMsPerClient=3
fillInEmpty=false
# Keep at 5 unless you recompile NOMAD for a different value
slidingWindow=5
# OPTIONAL: Can Comment these lines out
#seed=10
name=RANDOM_SCALABILITY_TEST
comment=
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment