def randomBDDRule(agents, alpha): global t0, t u = t0 for a in range(agents): scg = randomSCG(agents, alpha) if u.pathValue(scg) is None: n = t[random.randint(0, 9)] scg.sort(reverse=True) for x in scg: n = Node.getnode(x, t0, n) u = Node.union(u, n) # print "appended " + str(scg) else: pass # print "skipped " + str(scg) m = MTZDD() init_mtzdd(m, u) m.precompute() return m
print "\033[1;34mCSG MIP Problem Generator for MTZDD Representation\033[0m" print "" print " Input file: \033[1;33m", args.input.name, "\033[0m" print " Output file: \033[1;33m", args.output.name, "\033[0m" print " Problem type: \033[1;33m", args.type, "\033[0m" print "" ### ### Read input file ### ifile = args.input li = ifile.readline().strip() while li.startswith("#") or li == '': li = ifile.readline().strip() p = MTZDD.fromString(li) ifile.close() p.precompute() ### ### Generate constraints ### constr = [] binary = set() def xvar(g): global binary v = "x_" + str(g[0]) + "_" + str(g[1])
print "" print " Input file: \033[1;33m", args.input.name, "\033[0m" print " Output file: \033[1;33m", args.output.name, "\033[0m" print " Problem type: \033[1;33m", args.type, "\033[0m" print "" ### ### Read input file ### ifile = args.input li = ifile.readline().strip() while li.startswith("#") or li == "": li = ifile.readline().strip() p = MTZDD.fromString(li) ifile.close() p.precompute() ### ### Generate constraints ### constr = [] binary = set() def xvar(g): global binary v = "x_" + str(g[0]) + "_" + str(g[1])