Update the get/set syntax#363
Open
joaquimg wants to merge 1 commit into
Open
Conversation
c94cbcb to
4a0e7aa
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #363 +/- ##
==========================================
- Coverage 91.12% 90.46% -0.67%
==========================================
Files 16 16
Lines 2491 2507 +16
==========================================
- Hits 2270 2268 -2
- Misses 221 239 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4a0e7aa to
30fa61d
Compare
Member
|
Doesn't this contradicts jump-dev/JuMP.jl#3980 (comment) and #345 ? I'm confused |
Member
Author
|
I was playing with this suggestion: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move the JuMP-level forward/reverse differentiation API to the standard
get_attribute/set_attributeinterface with MOI attribute objects,replacing the bespoke
DiffOpt.{get,set}_*accessor functions.API changes
DiffOpt.set_forward_parameter(model, x, v)set_attribute(x, DiffOpt.ForwardParameterValue(), v)DiffOpt.get_reverse_parameter(model, x)get_attribute(x, DiffOpt.ReverseParameterValue())DiffOpt.set_reverse_variable(model, x, v)set_attribute(x, DiffOpt.ReverseVariablePrimal(), v)DiffOpt.get_forward_variable(model, x)get_attribute(x, DiffOpt.ForwardVariablePrimal())DiffOpt.set_reverse_objective(model, v)set_attribute(model, DiffOpt.ReverseObjectiveValue(), v)DiffOpt.get_forward_objective(model)get_attribute(model, DiffOpt.ForwardObjectiveSensitivity())DiffOpt.set_forward_objective_function(model, f)set_attribute(model, DiffOpt.ForwardObjectiveFunction(), f)DiffOpt.set_forward_constraint_function(model, c, f)set_attribute(c, DiffOpt.ForwardConstraintFunction(), f)DiffOpt.get_forward_constraint_dual(model, c)get_attribute(c, DiffOpt.ForwardConstraintDual())DiffOpt.get_reverse_objective_function(model)get_attribute(model, DiffOpt.ReverseObjectiveFunction())DiffOpt.get_reverse_constraint_function(model, c)get_attribute(c, DiffOpt.ReverseConstraintFunction())ReverseObjectiveSensitivityrenamed toReverseObjectiveValue(deprecated binding kept).[with help from claude]
Question:
Are we happy with:
forward_differentiate!(model)or we want to move to:
set_attribute(model, ForwardDifferentiate(), nothing)?
The
nothinglooks weird for something user-facing.cc @blegat @odow @andrewrosemberg