WP3 demo

parent 971c896b
......@@ -105,7 +105,7 @@ public class ResourceManagerComms extends ResourceManager {
return 0;
}
public void getCost(Worker worker) {
public double getCost(Worker worker) {
List<CommunicationLink> workerLinks = worker.getCommunicationLinksForApplication();
......@@ -131,26 +131,32 @@ public class ResourceManagerComms extends ResourceManager {
// float monitoredRTT = workerLinks.get(ll).getDelayRtt();
if (workerLinks.get(ll).getDelayRtt() >= rttmax) {
worker.setActive(false); // Is inactive true or false?
System.out.println("Thres. violation. Worker " + worker.getID() + "disabled");
worker.setCommunicationCost(Float.POSITIVE_INFINITY);
return;
return -1;
} else {
commsCost = commsCost + (priority / norm)
- (Math.log(Math.max(0, 1 - (workerLinks.get(ll).getDelayRtt() / rttmax))));
}
}
System.out.println("Worker.setCommunicationCost(" + String.valueOf(commsCost) + ")");
// System.out.println("Worker.setCommunicationCost(" + String.valueOf(commsCost)
// + ")");
worker.setCommunicationCost((float) commsCost);
/*Double obj = new Double(commsCost);
float f = obj.floatValue();*/
return commsCost;
/*
* Double obj = new Double(commsCost); float f = obj.floatValue();
*/
}
public void getCosts(Node node) {
double commsCost = 0;
// Is Inactive True or False???
List<Worker> activeWorkers = node.getWorkers().stream().filter(w -> w.isActive()).collect(Collectors.toList());
for (int ww = 0; ww < activeWorkers.size(); ww++) {
getCost(activeWorkers.get(ww));
commsCost = getCost(activeWorkers.get(ww));
}
//System.out.println("Worker.setCommunicationCost(" + String.valueOf(commsCost) + ")");
}
public Map<String, Double> getCost(JSONObject netTelemetry) {
......
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