Exemplo n.º 1
0
 def _fix(self, matrix):
     constraints = []
     rows,cols = intf.size(matrix)
     for i in range(rows):
         for j in range(cols):
             if matrix[i, j] == 0:
                 constraints.append(self[i, j] == 0)
     return constraints
Exemplo n.º 2
0
    def test_coefficients(self):
        exp = AffVstack(self.x)
        coeffs = exp.coefficients(self.intf)
        self.assertEqual(coeffs.keys(), self.x.coefficients(self.intf).keys())

        exp = AffVstack(self.x, self.y)
        coeffs = exp.coefficients(self.intf)
        self.assertItemsEqual(coeffs.keys(), 
            self.x.coefficients(self.intf).keys() + \
            self.y.coefficients(self.intf).keys())
        for k,v in coeffs.items():
            self.assertEqual(intf.size(v), (4,2))

        exp = AffVstack(self.A, self.B, self.C)
        coeffs = exp.coefficients(self.intf)
        v = coeffs[self.A]
        self.assertEqual(intf.size(v), (10,3))
Exemplo n.º 3
0
 def _fix(self, matrix):
     constraints = []
     rows, cols = intf.size(matrix)
     for i in range(rows):
         for j in range(cols):
             if matrix[i, j] == 0:
                 constraints.append(self[i, j] == 0)
     return constraints