Open whoburg opened 1 year ago
Updated title to be about the vector substitution failure only -- #1573 captures the other failure.
I can work on fixing this but I'm unclear on the intent of how it should work. The model is
x = Variable("x")
x_min = Variable("x_min", 1)
y = VectorVariable(2, "y")
m = Model(x, [x >= y.prod()])
There are several different substitutions in test_vector_sweep
; the first few are:
{y: ('sweep', [[2, 3], [5, 7], [9, 11]])}
(three different values for the vector of length 2, produces costs [6, 15, 27, 14, 35, 63, 22, 55, 99]
)
{y: ('sweep', [[2, 3], [5, 7, 11]])}
(the one that's failing with ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
-- intended to produce costs [10, 15, 14, 21, 22, 33]
),
{y: ('sweep', [[2, 3, 9], [5, 7, 11]])}
(wrong shape, intended to throw a ValueError
) ... and a few more.
I'd support a solution that's more restrictive on shapes of substitutions that are supported - seems surprising to allow the inhomogeneous shape.
Found two failing tests on a fresh install. One of is already captured in #1573; the other one in
test_vector_sweep
seems new.Per the instructions printed after running
import gpkit.tests
, here is the output: