test_polytope.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:Nashpy 作者: drvinceknight 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号