integrator interface

167 views
Skip to first unread message

Marco Vaccari

unread,
May 18, 2016, 1:51:11 PM5/18/16
to CasADi
Hi everybody.
I wanted to to use the integrator structure in the example vdp_multiple_shooting but I got an error. This is what I have:

x = SX.sym('x',2)
u = SX.sym('u',2)
y = SX.sym('y',2)

F1 = vertcat(x[0]+x[1]+u, x[1])
F2 = x
F_obj = u*(2 - y[1])

function_opt = (F1, F2, F_obj, ..)

def function_opt ( F1, F2, F_obj , .. ) 
   X = MX.sym('X', 2)
   Y = MX.sym('Y', 2)
   U = MX.sym('U', 2)
   d = MX.sym('d', 2)

    dae = {'x':vertcat(X,Y), 'p':vertcat(U,d), 'ode':vertcat(F1,F2), 'quad':F_obj}
    tf = 10.0    # End time    
    opts = {'tf':tf/N} # final time
    F = integrator('F', 'cvodes', dae, opts)
    .....

    return 

When I lunch the line where integrator is called I have this error:

NotImplementedError: Wrong number or type of arguments for overloaded function 'integrator'.
  Possible Python usages are:
    integrator(str,str,str:SX,Dict)
    integrator(str,str,str:MX,Dict)
    integrator(str,str,Function,Dict)
    integrator(str,str,(Function,Function) ,Dict)
You have: integrator(str, str, str:SX|MX, str:float)

What am I doing wrong?

Best,

Marco

Joris Gillis

unread,
May 18, 2016, 1:55:06 PM5/18/16
to CasADi
Dear Marco,

The (last line of the) error message attempts to inform you about the mistake:
Your dae dictionary contains both SX'es and MX'es. You cannot mix these types in an expression..

Best regards,
  Joris Gillis

Marco Vaccari

unread,
May 18, 2016, 4:22:08 PM5/18/16
to CasADi
Thanks Joris, I didn't understand well the error message. Now It is completely clear. 

Best,
Marco
Reply all
Reply to author
Forward
0 new messages