예제 #1
0
    def test_obey_support(self):
        """Test for obey support"""
        self.assertFalse(obey_support(False, np.array([0, 1])))
        self.assertFalse(obey_support(np.array([1, 0]), np.array([0, 1])))
        self.assertFalse(obey_support(np.array([0, 0.5]), np.array([0])))
        self.assertFalse(obey_support(np.array([0.5, 0]), np.array([1])))

        self.assertTrue(obey_support(np.array([1, 0]), np.array([0])))
        self.assertTrue(obey_support(np.array([0, 0.5]), np.array([1])))
        self.assertTrue(obey_support(np.array([0.5, 0]), np.array([0])))
        self.assertTrue(obey_support(np.array([0.5, 0.5]), np.array([0, 1])))
예제 #2
0
    def test_obey_support(self):
        """Test for obey support"""
        A = np.array([[2, 1], [0, 2]])
        B = np.array([[2, 0], [1, 2]])
        self.assertFalse(obey_support(False, np.array([0, 1])))
        self.assertFalse(obey_support(np.array([1, 0]), np.array([0, 1])))
        self.assertFalse(obey_support(np.array([0, .5]), np.array([0])))
        self.assertFalse(obey_support(np.array([.5, 0]), np.array([1])))

        self.assertTrue(obey_support(np.array([1, 0]), np.array([0])))
        self.assertTrue(obey_support(np.array([0, .5]), np.array([1])))
        self.assertTrue(obey_support(np.array([.5, 0]), np.array([0])))
        self.assertTrue(obey_support(np.array([.5, .5]), np.array([0, 1])))
예제 #3
0
 def test_obey_support_with_high_tolerance(self):
     """Test for obey support"""
     tol = 1
     self.assertFalse(obey_support(False, np.array([0, 1])))
     self.assertFalse(obey_support(np.array([1, 0]), np.array([0, 1]), tol=tol))
     self.assertFalse(obey_support(np.array([1, 0]), np.array([0]), tol=tol))
     self.assertFalse(obey_support(np.array([0, 0.5]), np.array([1]), tol=tol))
     self.assertFalse(obey_support(np.array([0.5, 0]), np.array([0]), tol=tol))
     self.assertFalse(obey_support(np.array([0.5, 0.5]), np.array([0, 1]), tol=tol))
예제 #4
0
 def test_obey_support_with_high_tolerance(self):
     """Test for obey support"""
     A = np.array([[2, 1], [0, 2]])
     B = np.array([[2, 0], [1, 2]])
     tol = 1
     self.assertFalse(obey_support(False, np.array([0, 1])))
     self.assertFalse(
         obey_support(np.array([1, 0]), np.array([0, 1]), tol=tol))
     self.assertFalse(obey_support(np.array([1, 0]), np.array([0]),
                                   tol=tol))
     self.assertFalse(
         obey_support(np.array([0, .5]), np.array([1]), tol=tol))
     self.assertFalse(
         obey_support(np.array([.5, 0]), np.array([0]), tol=tol))
     self.assertFalse(
         obey_support(np.array([.5, .5]), np.array([0, 1]), tol=tol))