obj = 0
for i in range(N-1):
obj += (z[:,i+1]-z_ref[:,i]).T @ Q @ (z[:,i+1]-z_ref[:,i])
obj += ((u[:,i+1]-u[:,i])/X_D).T @ S @ ((u[:,i+1]-u[:,i])/X_D) # change in control variables w.r.t distance
obj += u[:,i].T @ R @ u[:,i] # control variables
obj = Function("objective",[z,u],[obj])
print(obj)
DAE = {"x": z, "p": u, "ode":obj(z,u)}
intg = integrator("intg","rk", DAE)
res = intg(z, u, [],[],[],[])
states_nxt = res[0]
Objective_fun = Function("Estimator",[z,u],[obj]).
On running this it shows following error.
I couldn't understand what exactly it means.
RuntimeError: .../casadi/core/integrator.cpp:1430: Assertion "e.numel()==nr*nrhs" failed:
Inconsistent number of rhs
My objective function takes opti stack variables as input
objective:(i0[2x181],i1[2x180])->(o0[2x181]) MXFunction
Any kind of help is appreciated,
Thank you
Regards,
Rugved