Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to Calculate the Fitness function and Waiting time in iFogSim?

Description

Estimates the fitness value for each task in the workflow of application the various fog and Cloud resources to identify the ideal solution from the possible solutions. The waiting time is defined as the total execution time of the immediate predecessor task before initializing the process in the particular resource with the estimated processing delays of the task during its execution in the specific resources.

Source Code

public Map FitnessFunction(FogDevice node, Tuple tuple) {

double execTime = Double.MAX_VALUE;

Vm selectedVm = null;

for (Vm vm : node.getHost().getVmList()) {

double ct = 0;

double waittime = 0;

ct = (double) tuple.getCloudletTotalLength() / (double) (vm.getMips() * vm.getNumberOfPes());

waittime = WaitTime(node, tuple, vm);

System.out.println("IABO fitenessfunction compute time :" + ct + " waiting time " + waittime + " vm id #" + vm.getId() + " node name " + node.getName());

ct = ct + waittime + node.getUplinkLatency();

if (execTime > ct) {

execTime = ct;

selectedVm = vm;

}

}

Map nodeVmTime = new HashMap();

nodeVmTime.put(new NodeVm(node, selectedVm), new TupleTime(tuple, execTime));

return nodeVmTime;

}

public double WaitTime(FogDevice fogdevice, Tuple tuple, Vm vm) {

double wtime = 0;

NodeVm nodevm = new NodeVm(fogdevice, vm);

if (getWaitingTime().isEmpty()) {

wtime = 0.0;

} else {

for (Map.Entry waitingTimeMap : getWaitingTime().entrySet()) {

NodeVm nodevmmap = (NodeVm) waitingTimeMap.getKey();

List tupleTimelist = (List) waitingTimeMap.getValue();

if (fogdevice == nodevmmap.FogNode && vm == nodevmmap.VirtualMachine) {

for (TupleTime tuptime : tupleTimelist) {

wtime = wtime + tuptime.time;

}

break;

}

}

}

return wtime;

}

}

Output

Calculate the Fitness function and Waiting time