def evaluator(candidate, args): type_info_price = args.get("type_info_price") type_info_ecu = args.get("type_info_ecu") task_base_time = args.get("task_base_time") task_preds = args.get("task_preds") comm_speeds = args.get("comm_speeds") comm_sizes = args.get("comm_sizes") n_tasks = args.get("n_tasks") n_nodes = args.get("n_tasks") n_types = args.get("n_types") fitness = evaluate(candidate, type_info_price, type_info_ecu, task_base_time, task_preds, comm_speeds, comm_sizes, n_tasks, n_nodes, n_types) return inspyred.ec.emo.Pareto(fitness)
if __name__ == '__main__': from sys import argv from workflow import Workflow from pool import AWS from emo_tool import get_info, evaluate from log import get_details from plot import stat, trans, show wf = Workflow(argv[1]) pool = AWS("aws.info") info = get_info(wf, pool) _, loc, ts = heft2(*info[2:]) c = get_chromosome(loc, ts) makespan, cost = evaluate(c, *info[2:-1], n_tasks=len(loc), n_nodes=len(loc), n_types=len(info[1])) scheme = get_details(c, *info[:-1], n_tasks=len(loc), n_nodes=len(loc), n_types=len(info[1])) scheme = [(n, ) + v for n, v in scheme.iteritems()] print "Makespan: %.0fs\tCost: $%.2f" % (makespan, cost) # stat(scheme) # show(*trans(scheme))
break if len(types) > n_tasks: types = types[:n_tasks] c = array.array("I", []) for l, t in itertools.izip_longest(loc, types, fillvalue=0): c.append(l) c.append(t) return c if __name__ == '__main__': from sys import argv from workflow import Workflow from pool import AWS from emo_tool import get_info, evaluate from log import get_details from plot import stat, trans, show wf = Workflow(argv[1]) pool = AWS("aws.info") info = get_info(wf, pool) _, loc, ts = heft2(*info[2:]) c = get_chromosome(loc, ts) makespan, cost = evaluate(c, *info[2:-1], n_tasks=len(loc), n_nodes=len(loc), n_types=len(info[1])) scheme = get_details(c, *info[:-1], n_tasks=len(loc), n_nodes=len(loc), n_types=len(info[1])) scheme = [(n,)+v for n,v in scheme.iteritems()] print "Makespan: %.0fs\tCost: $%.2f" % (makespan, cost) # stat(scheme) # show(*trans(scheme))