If I have an ODESolution, I can evaluate some variable at some t=5 with sol(5, idxs=sys.some_variable), but what if I have EvalAt(15)(sys.some_variable) - EvalAt(10)(sys.other_variable). This is a reasonable expression to evaluate on the solution. But sol(10, idxs=...) does not work, neither does sol[...]. How should I do it?
I looked into Function Building and Compilation (build_function) · Symbolics.jl, but it’s not obvious how to put that into practice.
It’s not quite clear to me what you want to do, why do you need the EvalAt? Does
sol(15, idxs=sys.some_variable) - sol(10, idxs=sys.other_variable)
not work?
Well, yes it does. However, I am letting my users specify constraints (in an optimization problem) as symbolic expressions (or well, I would like to do that), and thus I need to evaluate that symbolic expression on the solution. I don’t know how to do that.
Maybe there’s a better way (or alternative package) to do the optimization? Apparently, once upon a time
@optimization_model model begin
@constraints begin
EvalAt(0.5)(x) ~ 2.0 # x must equal 2.0 at t=0.5
end
end
was a thing, but I don’t know what became of it.