コード例 #1
0
    def test_potentially_constrained(self):
        ineq1 = ((-1, "K2"), (1, "K1"), (1, "aabbc"))  # K2-K1 < aabbc
        ineq2 = ((1, "A2"), (-1, "A1"), (-1, "aabbc"))  # A2-A1 > aabbc

        potential_constraints = inequality_decider.potentially_constrained_variables(ineq1, ineq2)

        self.assertEquals(len(potential_constraints), 2)
        self.assertEquals(potential_constraints[("K2", "A2")], ("K1", "A1"))  # K1 > A1 if K2 > A2
        self.assertEquals(potential_constraints[("A1", "K1")], ("A2", "K2"))  # A2 > K2 if A1 > K1
コード例 #2
0
    def test_independent(self):
        ineq1 = ((-1, "K2"), (1, "K1"), (1, "aabbc"))
        ineq2 = ((-1, "A2"), (1, "A1"), (1, "bbcaa"))

        self.assertEquals(inequality_decider.potentially_constrained_variables(ineq1, ineq2), None)