Casadi Opti stack: to_function() with parameter for set_inital() method does not work #3577
Replies: 3 comments
-
Hi! The command I don't know if you can do exactly what you want with
Or you can follow the documentation and use the following functions:
Another option is to use the low level interface for defining of the NLP and then wraping it in a Function. What I do is the following:
Make sure you print |
Beta Was this translation helpful? Give feedback.
-
You can also use the Casadi For instance, imagine that you want the state and input variables "x" and "u" in the whole horizon in matrix form for your MPC. But they are mixed in "w" which must be a vector. Then, you can do the following:
You can do all kind of cool stuff this this, even wrap your solver and calculate derivatives for it! I hope it helps! |
Beta Was this translation helpful? Give feedback.
-
Thank you a lot for the valuable answers (and sorry for my late reply)! |
Beta Was this translation helpful? Give feedback.
-
Hello,
my intention is to define an optimization problem with CasADi Opti() and finally create a function out of it (with opti.to_function() method) similar like that (see, the set_inital() is set to constant 10. hardcoded) :
now I want to make the initalization accessible at the function interface such, that each time I call the function (iteratively, e.g. in a model predictive control manner) I can define the inital state --> intention is to do a warm start with a good guess solution!
BUT, in this case I get following error message:
Any suggestions/hints what I am doing wrong? Or how I can achieve my goal to be able to provide a inital state to the solver via function interface?
Or is there a better way to do this (warmstart) for MPC application?
kind regards,
Martin
Beta Was this translation helpful? Give feedback.
All reactions