-
Notifications
You must be signed in to change notification settings - Fork 0
Pyomo.DoE: Add symbolic differentiation gradient calculation option as an alternative to finite different #7
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
base: master
Are you sure you want to change the base?
Conversation
… users from modifying it
…Created new temporary example for testing.
Here is the current error message:
Here is output from some extra print statements:
Why does my new PyNumero code use 25 measurements but the old code considers 27? I think the old code is counting the ODE initial conditions as both a measurement (output) and experiment input. But this needs to be investigated. |
From my "shunk-works" branch dowlinglab/pyomo-doe#8 ...
New thought: something is not getting fixed properly before calling my AD/SD code. |
Good news: most recent change (fixing input parameters and variables) Bad news: solver failure on a machine without good Ipopt:
|
Actually, there is still a dimension mismatch error:
|
Confirmed the issue: my AD code is not considering CA and CB at time zero are measurements. I suspect that is because these are experiment inputs and thus fixed. |
Interesting... CA[0] is an experiment input, but CB[0] is not. By construction, for this problem, we fixed CB[0] = 0. Should we allow the user to specify quantities that are fixed as measurements? If they do, the gradient (sensitivity) should be zero. I should be able to handle this zero gradient. |
Comparison of trace:
Comparison of determinate:
Ideas:
|
Results for a single point using
|
Results using symbolic:
|
I should make a much easier test example without ODEs/DAEs. |
Set scaling to False; symbolic results did not change. Results using
Conclusion: I need to implement scaling! |
Results with scaling for symbolic:
|
Original Pyomo.DoE for the reaction kinetics example:
|
With symbolic derivatives:
|
@djlaky @blnicho @michaelbynum @jsiirola I am excited to share we have a working draft implementation of Pyomo.DoE using symbolic differentiation to build the sensitivity matrix instead of finite difference. I tested this on the reactor example. The model is smaller and solves in Ipopt ~2x faster. Now that there is a draft implementation, this is ready for a software design review. I appreciate your comments in advance. Also, is there a good way to move this PR from my fork to the main Pyomo repo? |
@adowling2 thanks for the update, this is really exciting! You may be able to edit the target branch for this PR to point to the main Pyomo repo (I can't remember if GitHub allows you to edit the target to a different fork). If that doesn't work then you'll have to open a new PR into Pyomo. |
Fixes # .
Summary/Motivation:
Changes proposed in this PR:
FiniteDifferenceMethod
withGradientMethod
fd_method
in favor ofgradient_method
as an input for Pyomo.DoEsymbolic
as an option inGradientMethod
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: