Sha256: d030ce65d15d41691658419b317fc31dbd60a9241e73e1012502a03d92545dfc

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# -*- coding: utf-8 -*-
"""
Created on Sat Feb 27 21:32:33 2016

@author: devd
"""
from __future__ import division
from createRandomString import *
from meshers import *
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages


length = 32
ones_range_min = 4
ones_range_max = 16
reps = 10
numStrings = 100

strings = []
ones = []
numUnmatched = []
perc = []
for numOnes in range(ones_range_min, ones_range_max+1):
    for iterations in range (reps):
        for i in range(numStrings):
            strings.append(createRandomString(length, numOnes))
        b, unmatched = greedyMesher(strings)
        ones.append(numOnes)
        percentage = (len(unmatched)/numStrings)*100
        numUnmatched.append(len(unmatched))
        perc.append(percentage)
        strings = []
plt.plot(ones, numUnmatched,'ro')
plt.ylabel('Number of unmatched strings')
plt.xlabel('Number of ones per string')
plt.title('GREEDY FIRST-MATCH MESHING RESULTS \n{}-bit strings, {} trials per x value'.format(length, reps))
#plt.show()


plt.plot(ones, perc,'ro')
plt.ylabel('Percentage of unmatched strings')
plt.xlabel('Number of ones per string')
plt.title('GREEDY FIRST-MATCH MESHING RESULTS \n{}-bit strings, {} trials per x value, {} strings per trial'.format(length, reps, numStrings))
plt.show()
#plt.savefig('test.png', dpi = 1000)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mesh-rb-0.0.1 ext/mesh/mesh/theory/greedy_experiment_copy.py