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.
public Map
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.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
if (fogdevice == nodevmmap.FogNode && vm == nodevmmap.VirtualMachine) {
for (TupleTime tuptime : tupleTimelist) {
wtime = wtime + tuptime.time;
}
break;
}
}
}
return wtime;
}
}