-
-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Casadi solver doesn't work with external variables #775
Comments
looks like this is because the padding of the statevector happens inside the One option could be to pass an extra argument to the
or maybe it is more efficient to create another class which pads then returns the |
I think the proper way of dealing with external variables / inputs in casadi is to pass them as "parameters" to the solver - otherwise there might be "variable is free" errors. This is why I didn't sort it out properly at the same time as the other solvers. Separate but related - do you think external variables and inputs are fundamentally different objects which should be kept separate (as currently done) or should we unify the interface so that external variables are treated as an input that is not scalar? |
Ah ok - I wasn't too sure on how to correctly to pass to casadi, but it seems like you have a better understanding of this. I don't think external variables and inputs are fundamentally different. Presumably we can keep all of the machinery for external variables in discretisation etc., but then pass the vectors in as inputs using the variable name? I think a unified interface would be cleaner. |
They are pretty similar sounding. But I kind of understood it as inputs are changeable parameters that are never usually "solved-for" and external variables are fixed variables that are usually solved-for. This pretty much amounts to the same thing but I guess the analogy would be like linking model outputs to inputs in comsol. I'm not sure if we need to make the distinction clearer or just merge them. Would it simplify the underlying code? |
Hey @tinosulzer is there a chance this can get done this week? Would really help me out. Cheers |
ok will get the hacky solution done asap |
Branch |
@tinosulzer awesome thanks a lot. I merged it into my branch and it seems to be working. Do you have an idea for a better way of doing it that you are still working on. Want me to review when that's done or shall we get this signed off and merged in now? |
Let's merge this in now, and I'll work on other issues as part of #784 |
Fine by me . I approved the PR |
Summary
ODE solver allows you to specify external variables - it would be good if Casadi solver did to
At the very least there should be some error messages saying it's not implemented yet. If you try to run it you get runtime errors
RuntimeError: .../casadi/core/function_internal.hpp:1247: Input 1 (i1) has mismatching shape. Got 80-by-1. Allowed dimensions, in general, are:
This was produced with the following script
The text was updated successfully, but these errors were encountered: