Ejemplo n.º 1
0
    def test_cr(self):
        A = self.cases[6]
        splitting = CR(A)

        # 1d-tests, should be alternating aggregates
        #       (n-1)/2 < = sum <= (n+1)/2.
        # Test auto thetacs and set thetacs values
        for i in range(3, 10):
            A = self.cases[i]
            h_split_auto = CR(A, method='habituated', thetacr=0.7,
                              thetacs='auto')
            assert(h_split_auto.sum() <= (h_split_auto.shape[0]+1)/2)
            assert(h_split_auto.sum() >= (h_split_auto.shape[0]-1)/2)

            c_split_auto = CR(A, method='concurrent', thetacr=0.7,
                              thetacs='auto')
            assert(c_split_auto.sum() <= (c_split_auto.shape[0]+1)/2)
            assert(c_split_auto.sum() >= (c_split_auto.shape[0]-1)/2)

            h_split = CR(A, method='habituated', thetacr=0.7,
                         thetacs=[0.3, 0.5])
            assert(h_split.sum() <= (h_split.shape[0]+1)/2)
            assert(h_split.sum() >= (h_split.shape[0]-1)/2)

            c_split = CR(A, method='concurrent', thetacr=0.7,
                         thetacs=[0.3, 0.5])
            assert(c_split.sum() <= (c_split.shape[0]+1)/2)
            assert(c_split.sum() >= (c_split.shape[0]-1)/2)

        # 2d-tests. CR is a little more picky with parameters and relaxation
        # type in 2d. Can still bound above by (n+1)/2.
        # Need looser lower bound,
        # say (n+1)/4.
        for i in range(10, 15):
            A = self.cases[i]
            h_split_auto = CR(A, method='habituated', thetacr=0.7,
                              thetacs='auto')
            assert(h_split_auto.sum() <= (h_split_auto.shape[0]+1)/2)
            assert(h_split_auto.sum() >= (h_split_auto.shape[0]-1)/4)

            c_split_auto = CR(A, method='concurrent', thetacr=0.7,
                              thetacs='auto')
            assert(c_split_auto.sum() <= (c_split_auto.shape[0]+1)/2)
            assert(c_split_auto.sum() >= (c_split_auto.shape[0]-1)/4)

            h_split = CR(A, method='habituated', thetacr=0.7,
                         thetacs=[0.3, 0.5])
            assert(h_split.sum() <= (h_split.shape[0]+1)/2)
            assert(h_split.sum() >= (h_split.shape[0]-1)/4)

            c_split = CR(A, method='concurrent', thetacr=0.7,
                         thetacs=[0.3, 0.5])
            assert(c_split.sum() <= (c_split.shape[0]+1)/2)
            assert(c_split.sum() >= (c_split.shape[0]-1)/4)
Ejemplo n.º 2
0
    def test_cr(self):
        A = self.cases[6]
        splitting = CR(A)

        # 1d-tests, should be alternating aggregates
        #       (n-1)/2 < = sum <= (n+1)/2.
        # Test auto thetacs and set thetacs values
        for i in range(3, 10):
            A = self.cases[i]
            h_split_auto = CR(A, method="habituated", thetacr=0.7, thetacs="auto")
            assert h_split_auto.sum() <= (h_split_auto.shape[0] + 1) / 2
            assert h_split_auto.sum() >= (h_split_auto.shape[0] - 1) / 2

            c_split_auto = CR(A, method="concurrent", thetacr=0.7, thetacs="auto")
            assert c_split_auto.sum() <= (c_split_auto.shape[0] + 1) / 2
            assert c_split_auto.sum() >= (c_split_auto.shape[0] - 1) / 2

            h_split = CR(A, method="habituated", thetacr=0.7, thetacs=[0.3, 0.5])
            assert h_split.sum() <= (h_split.shape[0] + 1) / 2
            assert h_split.sum() >= (h_split.shape[0] - 1) / 2

            c_split = CR(A, method="concurrent", thetacr=0.7, thetacs=[0.3, 0.5])
            assert c_split.sum() <= (c_split.shape[0] + 1) / 2
            assert c_split.sum() >= (c_split.shape[0] - 1) / 2

        # 2d-tests. CR is a little more picky with parameters and relaxation
        # type in 2d. Can still bound above by (n+1)/2.
        # Need looser lower bound,
        # say (n+1)/4.
        for i in range(10, 15):
            A = self.cases[i]
            h_split_auto = CR(A, method="habituated", thetacr=0.7, thetacs="auto")
            assert h_split_auto.sum() <= (h_split_auto.shape[0] + 1) / 2
            assert h_split_auto.sum() >= (h_split_auto.shape[0] - 1) / 4

            c_split_auto = CR(A, method="concurrent", thetacr=0.7, thetacs="auto")
            assert c_split_auto.sum() <= (c_split_auto.shape[0] + 1) / 2
            assert c_split_auto.sum() >= (c_split_auto.shape[0] - 1) / 4

            h_split = CR(A, method="habituated", thetacr=0.7, thetacs=[0.3, 0.5])
            assert h_split.sum() <= (h_split.shape[0] + 1) / 2
            assert h_split.sum() >= (h_split.shape[0] - 1) / 4

            c_split = CR(A, method="concurrent", thetacr=0.7, thetacs=[0.3, 0.5])
            assert c_split.sum() <= (c_split.shape[0] + 1) / 2
            assert c_split.sum() >= (c_split.shape[0] - 1) / 4
Ejemplo n.º 3
0
 def test_cr(self):
     A = self.cases[6]
     splitting = CR(A)
     assert (splitting.sum() < splitting.shape[0])
Ejemplo n.º 4
0
 def test_cr(self):
     A = self.cases[6]
     splitting = CR(A)
     assert(splitting.sum() < splitting.shape[0])