示例#1
0
def calc_rand_Q(n, m):
    total = 0
    for _ in range(10):
        Q_val = stat.mod_check(*bld.make_graph(n, m, 1, 0))[0][1]
        total += Q_val
    rel_Q = total / 10
    return rel_Q
#desired approximate Q-value
APPROX_Q = 0.95

#----------------------------------------------------------------------------#
#                                                                            #
#    Main Functions                                                          #
#                                                                            #
#----------------------------------------------------------------------------#

io.init_exp()
try:
    for vrs in range(*VARS_DATA):
        clas = int(vrs * CTV_RATIO)
        for i in range(NUM_PER_ITER):
            (G, CNF) = bld.make_graph(vrs, clas, 1, 0)
            rand = stats.check_graph(G, CNF, vrs, clas, 1, 0)
            io.write_output(rand)
            io.print_stats(rand)
except KeyboardInterrupt:
    import sys
    io.close_exp()
    sys.exit()
io.close_exp()

for grp in range(*GRP_DATA):
    io.init_exp()
    try:
        for vrs1 in range(*VARS_DATA):
            vrs = vrs1 * grp
            clas = int(vrs * CTV_RATIO)