def test_creation_of_particular_halfspaces(self):
"""Test that can create a given halfspace array representation"""
A = np.array([[3, 3], [2, 5], [0, 6]])
expected_halfspace = np.array([[ 3., 3., -1.],
[ 2., 5., -1.],
[ 0., 6., -1.],
[-1., -0., 0.],
[-0., -1., 0.]])
halfspace = build_halfspaces(A)
self.assertTrue(np.array_equal(halfspace, expected_halfspace))
B = np.array([[3, 2], [2, 6], [3, 1]])
expected_halfspace = np.array([[ 3., 2., 3., -1.],
[ 2., 6., 1., -1.],
[-1., -0., -0., 0.],
[-0., -1., -0., 0.],
[-0., -0., -1., 0.]])
halfspace = build_halfspaces(B.transpose())
self.assertTrue(np.array_equal(halfspace, expected_halfspace))
评论列表
文章目录