metavar="FUNCTION", nargs="*", help="function to test") parser.add_argument("--pareto", "-p", help="true Pareto front directory") args = parser.parse_args() analyzer = Analyzer() analyzer.setResultDirectories(args.results) pareto = args.pareto if pareto is None: pareto = os.path.dirname(__file__) + "/../resources/" + Analyzer.__PARETO__ analyzer.setPareto(pareto) functions = [] for functionName in analyzer.getFunctionNames(): if len(args.functions) == 0 or True in [ analyzer.functionMatches(fn, functionName) for fn in args.functions ]: functions.append(functionName.upper()) functions.sort() resultDir = args.name if resultDir[-1] == "/": resultDir = resultDir[:-1] if os.path.exists(resultDir): newResultDir = "%s-%s" % (resultDir, time.strftime("%Y%m%d-%H%M%S")) print "Backing up previous selection at '%s' to '%s'" % (resultDir, newResultDir) shutil.move(resultDir, newResultDir) os.mkdir(resultDir) for functionName in functions:
parser = argparse.ArgumentParser(description="Analyze Multi-Objective Optimization algorithm results against true Pareto fronts") parser.add_argument("--name", "-n", help="name of the selected results") parser.add_argument("--results", "-r", metavar="RESULT", nargs="+", help="results directory of an algorithm") parser.add_argument("--functions", "-f", metavar="FUNCTION", nargs="*", help="function to test") parser.add_argument("--pareto", "-p", help="true Pareto front directory") args = parser.parse_args() analyzer = Analyzer() analyzer.setResultDirectories(args.results) pareto = args.pareto if pareto is None: pareto = os.path.dirname(__file__) + "/../resources/" + Analyzer.__PARETO__ analyzer.setPareto(pareto) functions = [] for functionName in analyzer.getFunctionNames(): if len(args.functions) == 0 or True in [analyzer.functionMatches(fn, functionName) for fn in args.functions]: functions.append(functionName.upper()) functions.sort() resultDir = args.name if resultDir[-1] == "/": resultDir = resultDir[:-1]; if os.path.exists(resultDir): newResultDir = "%s-%s" % (resultDir, time.strftime("%Y%m%d-%H%M%S")) print "Backing up previous selection at '%s' to '%s'" % (resultDir, newResultDir) shutil.move(resultDir, newResultDir) os.mkdir(resultDir) for functionName in functions: print "Selecting best result for %s" % functionName analyzer.computeMetrics(functionName)