-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
public observed equivalent #3536
Comments
For me it usually works well to simply add all equations (including those I know should become unknowns) during model building, then structurally simplify the system, and the expected equations are automatically moved over to observeds. Are there some concrete example use cases that require manually adding observeds? Sometimes I have to define a "more complicated observed", e.g. some function that involves the full timeseries of the solution instead of just values at one point in time. Then I usually define functions on the full solution object that compute this. I generally think of these as different types of "derived quantities". If it is needed to add "user observeds", I would rather suggest making the existing observed field compatible and expose it. For example, maybe MTK could verify that observeds (passed by the user) are sensible and do not have to be solved for. If satisfied, then maybe structural simplify could append new observeds to this list instead of starting from scratch. |
Not all systems are supported by structural_simplify, or have a notion of algebraic equations being a valid system equation. This also relies on internals of structural_simplify always choosing the desired equations as observed. I'd rather not rely on it always doing the right thing since there is no promise it might not choose to keep an observed and eliminate another equation instead. Finally it also means we are losing information in making the model since observed are now no longer labeled in any distinct way. I agree that preserving user-provided observed would be nice. |
We should just define it for all systems? I can't think of a system type that wouldn't have a good notion for what it would mean and do?
No, it's really the exact opposite. Directly putting something into the That's not the only case. Another case that shows up often is with callbacks. Whether or not a variable is reducible can be dependent on its relationship to callbacks. For example, 2x + y ~ 0
z ~ Pre(z) + 1
z ~ x + y is a well-defined system, and so the DAE does not need to define
No information is lost. If you tell the system I think the real question to ask is, why do you feel it's so important to do that?
I truly cannot figure out why you feel really compelled to have to bypass all of the correctness testing here, especially when your stated goal is you want a more sustainable implementation with less bugs. As an analogy, you're effectively asking for the ability to bypass the Julia compiler and directly write x86 assembly code so that way we know the code we're generating and have less bugs. What I'm saying is, no, that does not lead to less bugs, for example x86 assembly code could give you incorrect behavior on Mac M-series chips, and so putting that into your libraries is a very bad idea, and with modern compilers it's probably going to generate better assembly for you anyways, so just write Julia code (or at least LLVM IR). This is why we don't have inline assembly code in our packages, and equivalently it would be good to have none of the equivalent inline MTK assembly code in downstream packages. Especially since with this specific case, there is no benchmark that I know of that shows it's actually saving time, while simultaneously there are loads of issues that document the bugs that are coming from it. So I think the real question to ask here is, if you really want this feature, can you please explain the motivation and why it is so necessary that you are willing to take the extra maintenance cost? |
OK, sounds like this is a no go and not worth continuing to discuss so I'll close this issue. |
In many biological file formats there are explicit "observed" fields defining functions of the unknowns. It would be nice to have a public equivalent to "observed" for MTK systems (basically so such variables can be evaluated and plotted given solution objects). We have been using
observed
for this from Catalyst for a long time, but given we were told it should be considered internal it would be useful to have another option. Perhaps such a field could be added for V10 (maybeuser_observed
)?The text was updated successfully, but these errors were encountered: