Ejemplo n.º 1
0
import manipulationData as md
import sys
from glob import glob

for n in [1,2,4,8,16,32,64,128,256]:
    for cands in [3,5]:
        for distribution in ['uniform', 'condorcet', 'spatial']:
            for rule in ['borda','veto','plurality','irv','copeland','pluralityWithRunoff']:
                print n, cands, distribution, rule
                base = ('/home/stu2/s1/cxc0117/thesis/run/data/' +
                        '-'.join([distribution[0], str(cands),
                                  str(n), rule]))
                files = [base + '.repo'] + glob(base + '*out??')
                repo = md.readFiles(*files)
                md.writeRepo(repo, base + '.repo')
Ejemplo n.º 2
0
    for cands in [3,5]:
        for distribution in ['uniform', 'condorcet', 'spatial']:
            for rule in ['borda','veto','irv','copeland','pluralityWithRunoff']:
                if cands == 3 and rule == 'pluralityWithRunoff':
                    continue
                if n == 256 and distribution != 'uniform':
                    continue

                print n, cands, distribution, rule
                base1 = ('/home/stu2/s1/cxc0117/thesis/run/data/' +
                         '-'.join([distribution[0], str(cands),
                                  str(n), rule]))
                base2 = ('/home/stu2/s1/cxc0117/thesis/run/bfdata/' +
                         '-'.join([distribution[0], str(cands),
                                  str(n), rule]))
                repo1 = md.readFiles(base1 + '.repo')
                repo2 = md.readFiles(base2 + '.repo')

                for i in range(1,1001):
                    try:
                        lowers1 = repo1[(i, 'lower')]
                        uppers1 = repo1[(i, 'upper')]
                        lowers2 = repo2[(i, 'lower')]
                        uppers2 = repo2[(i, 'upper')]
                    except KeyError:
                        print 'Cannot check %d' % i
                        continue
                    if not consistent(lowers1, uppers1, lowers2, uppers2):
                        print 'OH SHIT!'
                        print i,
                        print 'SAT:', lowers1, uppers1,