Source:
<code>public Plan optimize(final Collection<EvaluatorParameters> activeEvaluators, final int availableEvaluators) { if (ctrlTaskContextId == null) { initializeCtrlTaskContextId(); } final Optional<Cost> cost = CostCalculator.calculate(activeEvaluators, ctrlTaskContextId); if (!cost.isPresent()) { <START> return PlanImpl.newBuilder().build(); <END> } final List<OptimizedComputeTask> optimizedComputeTasks = initOptimizedComputeTasks(cost.get(), availableEvaluators - activeEvaluators.size()); final ExpressionsBasedModel model = new ExpressionsBasedModel(); final Variable cmpCostVar = Variable.make("computeCost"); final double commCostWeight = cost.get().getCommunicationCost() / cost.get().getComputeTaskCosts().size(); model.addVariable(cmpCostVar.weight(1.0)); for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { model.addVariable(cmpTask.getParticipateVariable().weight(commCostWeight)); model.addVariable(cmpTask.getRequestedDataVariable()); } addExpressions(model, cmpCostVar, optimizedComputeTasks, availableEvaluators - 1); final int totalDataUnits = getSumDataUnits(optimizedComputeTasks); final Optimisation.Result result = model.minimise(); LOG.log(Level.FINEST, "ILPSolverOptimizer Optimization Result: {0}", result); makeDataUnitsInteger(optimizedComputeTasks, totalDataUnits); final Plan plan = generatePlan(optimizedComputeTasks); LOG.log(Level.FINE, "ILPSolverOptimizer Plan: {0}", plan); return plan; }</code><technical_language>throw exception if cost calculated is controller task? If allow a situation is controller task, leave a log this distinguish cases application is running in optimal configuration optimizer work</technical_language>

Target:
public Plan optimize(final Collection<EvaluatorParameters> activeEvaluators, final int availableEvaluators) { if (ctrlTaskContextId == null) { initializeCtrlTaskContextId(); } final Optional<Cost> cost = CostCalculator.calculate(activeEvaluators, ctrlTaskContextId); if (!cost.isPresent()) { LOG.log(Level.WARNING, "No controller task present at the moment. Returning empty plan."); return PlanImpl.newBuilder().build(); } final List<OptimizedComputeTask> optimizedComputeTasks = initOptimizedComputeTasks(cost.get(), availableEvaluators - activeEvaluators.size()); final ExpressionsBasedModel model = new ExpressionsBasedModel(); final Variable cmpCostVar = Variable.make("computeCost"); final double commCostWeight = cost.get().getCommunicationCost() / cost.get().getComputeTaskCosts().size(); model.addVariable(cmpCostVar.weight(1.0)); for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { model.addVariable(cmpTask.getParticipateVariable().weight(commCostWeight)); model.addVariable(cmpTask.getRequestedDataVariable()); } addExpressions(model, cmpCostVar, optimizedComputeTasks, availableEvaluators - 1); final int totalDataUnits = getSumDataUnits(optimizedComputeTasks); final Optimisation.Result result = model.minimise(); LOG.log(Level.FINEST, "ILPSolverOptimizer Optimization Result: {0}", result); makeDataUnitsInteger(optimizedComputeTasks, totalDataUnits); final Plan plan = generatePlan(optimizedComputeTasks); LOG.log(Level.FINE, "ILPSolverOptimizer Plan: {0}", plan); return plan; }