When I tried to run this, it became clear that the value of N is not defined.
I think you have N = 2 set somewhere.
Setting N = 3 gives 3 in place of 2 here:
ERROR: BoundsError: attempt to access 3-element Vector{Float64} at index [1:6]
while setting N = 6 misses this error but ultimately returns from IPOPT:
EXIT: Invalid number in NLP function or derivative detected.
1 Like