@Override public boolean evaluate() { if (curInstance == null) { curInstance = createInstance(0, selectedVm); // create a Instance with the past values } if (app.getSuspendedTicks() > 0 || app.getVm().getSuspendedTicks() > 0 || app.getVm().getPm().getSuspendedTicks() > 0) { return false; } else if (waitForEvaluation > 0) { waitForEvaluation--; return false; } else { // System.out.println("APP - Running Ticks: " + app.getRunningTicks()); LinkedList<Integer> cpuusagehist = selectedVm.getPm().getCpuUsageHistory(10); LinkedList<Integer> memusagehist = selectedVm.getPm().getMemoryUsageHistory(10); LinkedList<Integer> storageusagehist = selectedVm.getPm().getStorageUsageHistory(10); double evaluation = (255 - calculateUsageRatio(cpuusagehist, 85) - calculateUsageRatio(memusagehist, 85) - calculateUsageRatio(storageusagehist, 85)) / 255; // subtract SLA Violations evaluation -= (app.getCpuSlaErrorcount() + app.getMemorySlaErrorcount() + app.getStorageSlaErrorcount()) / 10; // minimum of 0 // evaluation = Math.max(0, evaluation); Monitor.getInstance().logExecution(app, this, evaluation, this.globalTickExecution); curInstance.setValue(getKnowledgeBase().attribute(63), evaluation); this.setLocalEvaluation(evaluation); getKnowledgeBase().add(curInstance); } return true; }