コード例 #1
0
    def test_creation_of_particular_feasible_point(self):
        A = np.array([[3, 3], [2, 5], [0, 6]])
        halfspaces = build_halfspaces(A)
        feasible_point = find_feasible_point(halfspaces)
        self.assertTrue(
            all(np.isclose(feasible_point, np.array([0.08074176,
                                                     0.08074176]))))

        B = np.array([[3, 2], [2, 6], [3, 1]])
        halfspaces = build_halfspaces(B.transpose())
        feasible_point = find_feasible_point(halfspaces)
        self.assertTrue(
            all(
                np.isclose(feasible_point,
                           np.array([0.06492189, 0.06492189, 0.06492189]))))
コード例 #2
0
 def test_creation_of_feasible_point(self, A):
     halfspaces = build_halfspaces(A)
     feasible_point = find_feasible_point(halfspaces)
     M, b = halfspaces[:, :-1], halfspaces[:, -1]
     self.assertTrue(all(np.dot(M, feasible_point) <= -b))