Description
Hello there 👋 I'm writing regarding the following admonition in the docs :)
I am solving optimal-control problems where the dynamics are encoded in the form of a ModelingToolkit model. ModelingToolkit can generate very efficient code for the right-hand side of the dynamics, i.e., I can obtain an executable function
where
Tracing through
To avoid explosive expression growth when tracing through x = A\b
that appear in
x = InfiniteOpt.@variables(m, begin
[1:n], Infinite(τ) # Temporary anonymous variables
end)[1]
lhs = A*x
@constraint(m, lhs .== b)
bout .= x
i.e., I introduce temporary variables x
and equality constraints A*x == b
. As I said, this works, but memory requirements are sky high and I believe it should be possible to improve the performance by at least 1000x over the performance this gives me.
Coming back to the admonition, I have been thinking about different ways to work around the limitations on vector-valued nonlinear functions but haven't found any alternative that is working out for me. What approach did you have in mind with
However, this limitation can readily be removed if there is a use case for it
?
I am willing to jump through quite a few hoops to make this efficient if required :) Thanks for your time!