Error while using Optimization.jl

It’s hard to figure things out at the moment, can you post a complete example and try to format your code a little better?

Off the top of my head I would bet that ddprob is a matrix, and that you should be indexing it as ddprob[i, :] instead of ddprob[i][:] (which would work in Python). In Julia, whatever the shape of the array a, a[i] for integer i is the i-th element in the flattened array, hence a scalar. That’s why you cannot apply getindex(..., :) (“colon”) on it.

1 Like