Parameters as piecewise functions in optimal control #3689
Unanswered
jimgreenelab
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Any chance you are calling expand() somewhere or using the expand option? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am a relatively new user, so I hope you will forgive any ignorance.
I am trying to solve an optimal control problem which minimizes$x(t_{f})$ , and is constrained by the ODE
where$\alpha(u)$ is a piecewise linear function. I understand how to set this up in CasaADi, and I am trying to use the Opti Stack. However, I have issues when I call the solver because I defined $\alpha(u)$ via
After calling
I get a Stack Error of the form
RuntimeError: Error in Opti::solve [OptiNode] at .../casadi/core/optistack.cpp:157:
.../casadi/core/function_internal.cpp:146: Error calling IpoptInterface::init for 'solver':
Error in Function::call for 'nlp' [MXFunction] at .../casadi/core/function.cpp:370:
Error in Function::operator() for 'alpha_u_interpolant' [LinearInterpolant] at .../casadi/core/function.cpp:1522:
.../casadi/core/function_internal.cpp:2013: 'eval_sx' not defined for LinearInterpolant
I suppose what is happening is that somewhere my MX symbolic is being thrown into an SX evaluation. But I don't fully understand, since the Opti variables are all MX, I think, and thus so is alpha_u_interpolant (if u is MX). I am no expert here, and I am sure I am missing a subtlety.
Could someone provide suggestions on the best way to solve such a problem in CasaADi?
Beta Was this translation helpful? Give feedback.
All reactions