Configure Datacenter, Host, Vms and cloudlets
vmlist = createVM();
broker.submitVmList(vmlist);
newList = createCloudlet();
broker.submitCloudletList(newList);
lastClock = CloudSim.startSimulation();
Find Utilization of resources
double mip = server.getAvailableMips();
double band = server.getUtilizationOfBw();
long st = server.getStorage();
avmip[x] = ((instruction – mip) / instruction) * 100;
System.out.println(“Host: ======> ” + hostId);
System.out.println(“Average cpu utilization is ======> ” + avmip[x]);
hostlMap.put(avmip[x], hst);
mipsAvg.add(avmip[x]);
avband[x] = ((bandwidth – BW) / bandwidth) * 100;
System.out.println(“Average BW utilization is ======> ” + avband[x]);
avmem[x] = ((size – MEM) / size) * 100;
System.out.println(“Average mem utilization is ======> ” + avmem[x] + “\n\n”);
The data fitness value of solution is the objective of the algorithm. Here the objective is to schedule the tasks on VM so that the makespan should be less. Therefore here the data fitness value of the solution is related to the expected makespan of the solution
VMs from the hosts that are under utilized are migrated to other hosts and the corresponding hosts are put into switched off.
PM pm = (PM) underUtilized;
machine[g] = vmToMigrate.get(g);
System.out.println(“VMs to migrate: ” + machine[g].getId());
send(this.getId(), delay, CloudSimTags.VM_MIGRATE, ma);