Esempio n. 1
0
def rs_plot(N, rs, incentive_func=None, eta=None, w=None, mutation_func=None, mu_ab=0.001, mu_ba=0.001, test_func=None):
    """Plot entropy rate over a range of fitness values."""
    ms = [ [[r,r],[1,1]] for r in rs]
    params = [constant_generator(N), ms]
    for p in [incentive_func, eta, w, mutation_func, mu_ab, mu_ba, test_func]:
        params.append(constant_generator(p))
    es = run_batches(params)
    print es[-1]
    pyplot.plot(rs, [x[-1] for x in es])
    return es    
Esempio n. 2
0
def mu_plot(N, m, incentive_func=None, eta=None, w=None, mutation_func=None, mus=None, test_func=None):
    """Plot entropy rate over a range of mutation probabilities."""
    params = [constant_generator(N)]
    for p in [m, incentive_func, eta, w, mutation_func]:
        params.append(constant_generator(p))
    params.append(mus)
    params.append(mus)
    params.append(constant_generator(test_func))
    es = run_batches(params)
    print es[-1]
    pyplot.plot([-math.log(mu) for mu in mus], [x[-1] for x in es])
    return es
Esempio n. 3
0
def compute_N_r_heatmap_data(Ns, rs, incentive_func=None, eta=None, w=None, mutation_func=None, mu_ab=0.001, mu_ba=0.001, test_func=None):
    data = []
    for r in rs:
        print r
        m = [[r,r],[1,1]]
        params = [Ns]
        for p in [m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba, test_func]:
            params.append(constant_generator(p))
        es = run_batches(params)
        for (args, e) in es:
            N, m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba = args
            data.append([N, r, mu_ab, mu_ba, e])
    return data
Esempio n. 4
0
def static_plot(Ns, m, incentive_func=None, eta=None, w=None, mutation_func=None, mu_ab=0.001, mu_ba=0.001, test_func=None):
    """Plot entropy rate over a range of population sizes."""
    params = [Ns]
    for p in [m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba, test_func]:
        params.append(constant_generator(p))
    es = run_batches(params)
    #k = 0.5 + 0.5* math.log(math.pi / 2)    
    #print mu_ab, (es[-1][-1] - k) / (0.5 * math.log(Ns[-1]))
    #pyplot.plot(Ns, [(es[i][-1] -k)/(0.5 * math.log(Ns[i])) for i in range(len(es))])
    #print mu_ab, (es[-1][-1] - k) / (0.5 * math.log(Ns[-1]))
    print mu_ab, es[-1][-1] - binary_entropy(mu_ab)
    pyplot.plot(Ns, [es[i][-1] - binary_entropy(mu_ab) for i in range(len(es))])
    return es
Esempio n. 5
0
def compute_N_mu_heatmap_data(Ns, mus, r, incentive_func=None, eta=None, w=None, mutation_func=None, test_func=None):
    data = []
    m = [[r,r],[1,1]]
    for mu in mus:
        print mu
        params = [Ns]
        for p in [m, incentive_func, eta, w, mutation_func, mu, mu, test_func]:
            params.append(constant_generator(p))
        es = run_batches(params)
        for (args, e) in es:
            N, m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba = args
            data.append([N, r, mu, -math.log(e)])
    return data
Esempio n. 6
0
def rs_plot(N,
            rs,
            incentive_func=None,
            eta=None,
            w=None,
            mutation_func=None,
            mu_ab=0.001,
            mu_ba=0.001,
            test_func=None):
    """Plot entropy rate over a range of fitness values."""
    ms = [[[r, r], [1, 1]] for r in rs]
    params = [constant_generator(N), ms]
    for p in [incentive_func, eta, w, mutation_func, mu_ab, mu_ba, test_func]:
        params.append(constant_generator(p))
    es = run_batches(params)
    print es[-1]
    pyplot.plot(rs, [x[-1] for x in es])
    return es
Esempio n. 7
0
def mu_plot(N,
            m,
            incentive_func=None,
            eta=None,
            w=None,
            mutation_func=None,
            mus=None,
            test_func=None):
    """Plot entropy rate over a range of mutation probabilities."""
    params = [constant_generator(N)]
    for p in [m, incentive_func, eta, w, mutation_func]:
        params.append(constant_generator(p))
    params.append(mus)
    params.append(mus)
    params.append(constant_generator(test_func))
    es = run_batches(params)
    print es[-1]
    pyplot.plot([-math.log(mu) for mu in mus], [x[-1] for x in es])
    return es
Esempio n. 8
0
def compute_N_mu_heatmap_data(Ns,
                              mus,
                              r,
                              incentive_func=None,
                              eta=None,
                              w=None,
                              mutation_func=None,
                              test_func=None):
    data = []
    m = [[r, r], [1, 1]]
    for mu in mus:
        print mu
        params = [Ns]
        for p in [m, incentive_func, eta, w, mutation_func, mu, mu, test_func]:
            params.append(constant_generator(p))
        es = run_batches(params)
        for (args, e) in es:
            N, m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba = args
            data.append([N, r, mu, -math.log(e)])
    return data
Esempio n. 9
0
def static_plot(Ns,
                m,
                incentive_func=None,
                eta=None,
                w=None,
                mutation_func=None,
                mu_ab=0.001,
                mu_ba=0.001,
                test_func=None):
    """Plot entropy rate over a range of population sizes."""
    params = [Ns]
    for p in [
            m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba, test_func
    ]:
        params.append(constant_generator(p))
    es = run_batches(params)
    #k = 0.5 + 0.5* math.log(math.pi / 2)
    #print mu_ab, (es[-1][-1] - k) / (0.5 * math.log(Ns[-1]))
    #pyplot.plot(Ns, [(es[i][-1] -k)/(0.5 * math.log(Ns[i])) for i in range(len(es))])
    #print mu_ab, (es[-1][-1] - k) / (0.5 * math.log(Ns[-1]))
    print mu_ab, es[-1][-1] - binary_entropy(mu_ab)
    pyplot.plot(Ns,
                [es[i][-1] - binary_entropy(mu_ab) for i in range(len(es))])
    return es
Esempio n. 10
0
def compute_N_r_heatmap_data(Ns,
                             rs,
                             incentive_func=None,
                             eta=None,
                             w=None,
                             mutation_func=None,
                             mu_ab=0.001,
                             mu_ba=0.001,
                             test_func=None):
    data = []
    for r in rs:
        print r
        m = [[r, r], [1, 1]]
        params = [Ns]
        for p in [
                m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba,
                test_func
        ]:
            params.append(constant_generator(p))
        es = run_batches(params)
        for (args, e) in es:
            N, m, incentive_func, eta, w, mutation_func, mu_ab, mu_ba = args
            data.append([N, r, mu_ab, mu_ba, e])
    return data