示例#1
0
 def test_action(self):
     size = 1000
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     poly.compute_path()
     self.assertEqual(poly.action_range(1, size)+poly.environment[0][size], poly.max_action)
示例#2
0
 def test_endpoint(self):
     size = 1000
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     path = poly.compute_path()
     end = poly.compute_endpoint()
     self.assertTrue(abs(path[-1] - end) <= 1)
示例#3
0
 def test_endpoint(self):
     size = 1000
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     path = poly.compute_path()
     end = poly.compute_endpoint()
     self.assertTrue(abs(path[-1] - end) <= 1)
示例#4
0
 def test_tau(self):
     size = 1000
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     path = poly.compute_path()
     end = poly.compute_endpoint()
     tau = poly.compute_tau()
     self.assertTrue(abs(end) > abs(path[tau-1])) 
示例#5
0
 def test_tau(self):
     size = 1000
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     path = poly.compute_path()
     end = poly.compute_endpoint()
     tau = poly.compute_tau()
     self.assertTrue(abs(end) > abs(path[tau - 1]))
示例#6
0
 def test_action(self):
     size = 1000
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     poly.compute_path()
     self.assertEqual(
         poly.action_range(1, size) + poly.environment[0][size],
         poly.max_action)
示例#7
0
def test_pinned_path(n):
    poly = Polymer(n)
    poly.make_environment()
    poly.compute_actions()
    for i in range(n+1):
        j = random.randint(-i,i)
        try:
            poly.pinned_path(j, i)
        except IndexError:
            print "failure at ", j, i
示例#8
0
 def test_end_discrepancy(self):
     size = 1000
     exponent = 0.5
     constant = 10
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     path = poly.compute_path()
     end = poly.compute_endpoint()
     self.assertTrue(poly.discrepancy(end) < constant*pow(abs(float(end)), -exponent) )
示例#9
0
def test_pinned_path(n):
    poly = Polymer(n)
    poly.make_environment()
    poly.compute_actions()
    for i in range(n + 1):
        j = random.randint(-i, i)
        try:
            poly.pinned_path(j, i)
        except IndexError:
            print "failure at ", j, i
示例#10
0
 def test_typical_omega(self):
     size = 1000
     trials = 100
     threshold = .9
     count_typical = 0
     for i in range(trials):
         poly = Polymer(size)
         poly.make_environment()
         count_typical += spacevar_typical(poly)
     # print count_typical
     self.assertTrue(count_typical > threshold*trials)
示例#11
0
 def test_typical_omega(self):
     size = 1000
     trials = 100
     threshold = .9
     count_typical = 0
     for i in range(trials):
         poly = Polymer(size)
         poly.make_environment()
         count_typical += spacevar_typical(poly)
     # print count_typical
     self.assertTrue(count_typical > threshold * trials)
示例#12
0
 def test_end_discrepancy(self):
     size = 1000
     exponent = 0.5
     constant = 10
     poly = Polymer(size)
     poly.make_environment()
     poly.compute_actions()
     path = poly.compute_path()
     end = poly.compute_endpoint()
     self.assertTrue(
         poly.discrepancy(end) < constant * pow(abs(float(end)), -exponent))
示例#13
0
def test__path(n):
    poly = Polymer(n)
    poly.make_environment()
    poly.compute_actions()
    poly.compute_path()
    poly.compute_record_discrepancies()
    poly.records
    for i in range(n+1):
        try:
            poly.compute_path(i)
        except IndexError:
            print "failure at ", i
示例#14
0
def test__path(n):
    poly = Polymer(n)
    poly.make_environment()
    poly.compute_actions()
    poly.compute_path()
    poly.compute_record_discrepancies()
    poly.records
    for i in range(n + 1):
        try:
            poly.compute_path(i)
        except IndexError:
            print "failure at ", i