def selector(algo, func_details, popSize, Iter): function_name = func_details[0] lb = func_details[1] ub = func_details[2] dim = func_details[3] if (algo == 0): x = pso.PSO(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 1): x = mvo.MVO(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 2): x = gwo.GWO(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 3): x = mfo.MFO(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 4): x = cs.CS(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 5): x = bat.BAT(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 6): x = woa.WOA(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 7): x = ffa.FFA(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) if (algo == 8): x = ssa.SSA(getattr(benchmarks, function_name), lb, ub, dim, popSize, Iter) return x
def getPathConditions(trace, filename): callstack = list(trace["callstack"]) inss = list(trace["raw_code"]) mem_access = trace["memaccess"] SSA.SSAinit() mvars = set() smt_conds = SMT() #assert(False) for ins_str in inss: #print ins_str.strip("\n") # Instruction parsing pins = parse_reil(ins_str) # Instruction processing current_call = trace["current_call"] mem_access = trace["memaccess"].getAccess(pins.address) ins = Instruction(pins,current_call,mem_access) ins_write_vars = set(ins.getWriteVarOperands()) ins_read_vars = set(ins.getReadVarOperands()) if pins.instruction == "jcc" or len(ins_write_vars.intersection(mvars)) > 0: ssa_map = SSA.SSAMapping(ins_read_vars.difference(mvars), ins_write_vars, ins_read_vars.intersection(mvars)) cons = conds.get(pins.instruction, Condition) condition = cons(ins, ssa_map) mvars = mvars.difference(ins_write_vars) mvars = ins_read_vars.union(mvars) mvars = set(filter(lambda o: o.name <> "ebp", mvars)) smt_conds.add(condition.getEq()) #print "mvars ops:" #for op in mvars: # print op smt_conds.write_smtlib_file(filename+".smt2") smt_conds.write_sol_file(filename+".sol")
def selector(algo, func_details, popSize, Iter): function_name = func_details[0] lb = func_details[1] ub = func_details[2] dim = 30 if (algo == 'PSO'): x = pso.PSO(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'SSA'): x = ssa.SSA(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'GOA'): x = goa.GOA(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'IGOA'): x = igoa.IGOA(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'MVO'): x = mvo.MVO(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'GWO'): x = gwo.GWO(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'MFO'): x = mfo.MFO(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'CS'): x = cs.CS(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'BAT'): x = bat.BAT(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'WOA'): x = woa.WOA(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) if (algo == 'FFA'): x = ffa.FFA(getattr(cec2005, function_name), lb, ub, dim, popSize, Iter) return x