コード例 #1
0
ファイル: con2vert_test.py プロジェクト: d-ming/AR-tools
def test_2D_1():
    # 2-D mass balance triangle
    A = sp.array([[-1., 0],
                  [0, -1],
                  [1, 1]])

    b = sp.array([[0., 0, 1]]).T

    vs = artools.con2vert(A, b)
    vs_ref = sp.array([[0., 1], [0, 0], [1, 0]])

    assert (artools.same_rows(vs, vs_ref) is True)
コード例 #2
0
    def test_1(self):
        # 2-D mass balance triangle
        A = sp.array([[-1., 0],
                      [0, -1],
                      [1, 1]])

        b = sp.array([[0., 0, 1]]).T

        vs = con2vert(A, b)
        vs_ref = sp.array([[0., 1], [0, 0], [1, 0]])

        assert (sameRows(vs, vs_ref) is True)
コード例 #3
0
    def test_3(self):
        # mass balance triangle cut at y = 0.5
        A = sp.array([[-1., 0],
                      [0, -1],
                      [1, 1],
                      [0, 1]])

        b = sp.array([[0., 0, 1, 0.5]]).T

        vs = con2vert(A, b)
        vs_ref = sp.array([[0, 0.5],
                           [0, 0],
                           [1, 0],
                           [0.5, 0.5]])

        assert (sameRows(vs, vs_ref) is True)
コード例 #4
0
    def test_2(self):
        # 2-D unit square
        A = sp.array([[-1., 0],
                      [0, -1],
                      [1, 0],
                      [0, 1]])

        b = sp.array([[0., 0, 1, 1]]).T

        vs = con2vert(A, b)
        vs_ref = sp.array([[0., 1],
                           [0, 0],
                           [1, 0],
                           [1, 1]])

        assert (sameRows(vs, vs_ref) is True)
コード例 #5
0
ファイル: con2vert_test.py プロジェクト: d-ming/AR-tools
def test_2D_3():
    # mass blanace triangle cut at y = 0.5
    A = sp.array([[-1., 0],
                  [0, -1],
                  [1, 1],
                  [0, 1]])

    b = sp.array([[0., 0, 1, 0.5]]).T

    vs = artools.con2vert(A, b)
    vs_ref = sp.array([[0, 0.5],
                       [0, 0],
                       [1, 0],
                       [0.5, 0.5]])

    assert (artools.same_rows(vs, vs_ref) is True)
コード例 #6
0
ファイル: con2vert_test.py プロジェクト: d-ming/AR-tools
def test_2D_2():
    # 2-D unit square
    A = sp.array([[-1., 0],
                  [0, -1],
                  [1, 0],
                  [0, 1]])

    b = sp.array([[0., 0, 1, 1]]).T

    vs = artools.con2vert(A, b)
    vs_ref = sp.array([[0., 1],
                       [0, 0],
                       [1, 0],
                       [1, 1]])

    assert (artools.same_rows(vs, vs_ref) is True)
コード例 #7
0
    def test_interior_1(self):

        """
        This set of constraints produces an initial guess that is not an
        interior point of the region.
        """

        A = sp.array([[1.0, 0.0],
                      [1.0, 1.0],
                      [-1.0, 1.0],
                      [-3.0, -1.0],
                      [0.0, -1.0]])

        b = sp.array([[1.0, 1.0, 0.0, 0.0, 0.0]]).T

        vs_ref = sp.array([[0.5, 0.5],
                           [0.0, 0.0],
                           [1.0, 0.0]])

        vs = con2vert(A, b)

        assert (sameRows(vs, vs_ref) is True)