-
Notifications
You must be signed in to change notification settings - Fork 13
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
Coherent & concise JuMPification of MARGO? #18
Comments
The first thing to do is set up some very simple tests of JuMP and see how far we can push the use of functions to simplify the optimization before we break JuMP. |
Looks like some of this is possible with the user-defined functions API in JuMP. I'm a bit nervous about whether this will extend to the |
Hey Henri! Using this trick, we can minimize control costs subject to But we won’t be able to use I wrote a more detailed notebook about it here, which is just the mitigation optimization. To run the notebook, you need to checkout the forward-diffable branch of ClimateMARGO, so I also made a PDF. Have a look at "Conclusions" on page 6 https://github.com/fonsp/disorganised-mess/blob/master/jump%20test%20margo.jl |
Awesome progress @fonsp! I'll take a look at it in the next couple of days! |
I feel like there should be some trick to generalize the clunky |
To add to this: JuMP uses forward mode automatic differentiation (dual numbers). This means that it can automatically differentiate our diagnostic functions 🎉, and also user-defined functions 🎊, even though they are a 'black box' from the perspective of ClimateMARGO.jl. As long as they are not 'too complex' (not sure what that means yet), and as long as they accept the more general If we ever have a user whose custom functions are not auto-diffable, JuMP does not include finite differencing by default, but it seems like we can add that functionality later, either by supplying a finite difference method as the 'derivative', or by switching packages. |
In the end, I was able to also use If anyone is interested, I can document what I tried. Code is here, here and here. |
As mentioned in #14, it would be nice to reduce the JuMP implementation of MARGO to a few single-line statements like:
which reuse the diagnostic functions such as
T
which fully describe the model (see https://github.com/hdrake/ClimateMARGO.jl/tree/updating-structure) but are complicated functions of both the four controls {M,R,G,A} as well as a number of prescribed inputs functions and parameters. In the current implementation af16f49, these optimization constraints are hard-coded from scratch, span many lines, and are repeated several times over.The text was updated successfully, but these errors were encountered: