The operator / allow to stack expressions
(self)
| 51 | self.assertEqual(y.expr(0, 1).A.shape, (4,)) |
| 52 | |
| 53 | def test_stacking(self): |
| 54 | """ |
| 55 | The operator / allow to stack expressions |
| 56 | """ |
| 57 | problem = placo.Problem() |
| 58 | |
| 59 | x = problem.add_variable(8) |
| 60 | e = x.expr(0, 1) / x.expr(2, 1) / x.expr(4, 1) / x.expr(6, 1) |
| 61 | |
| 62 | A = np.zeros((4, 8)) |
| 63 | A[0, 0] = 1 |
| 64 | A[1, 2] = 1 |
| 65 | A[2, 4] = 1 |
| 66 | A[3, 6] = 1 |
| 67 | self.assertNumpyEqual(A, e.A, msg="Expected matrix obtained by stacking") |
| 68 | |
| 69 | b = np.zeros(4) |
| 70 | self.assertNumpyEqual(b, e.b, msg="Expected vector obtained by stacking") |
| 71 | |
| 72 | def test_simple_solve(self): |
| 73 | problem = placo.Problem() |
nothing calls this directly
no test coverage detected