Fix setter for ConstraintSet and ConstraintFunction#120
Fix setter for ConstraintSet and ConstraintFunction#120
Conversation
Codecov ReportBase: 95.14% // Head: 93.99% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #120 +/- ##
==========================================
- Coverage 95.14% 93.99% -1.15%
==========================================
Files 4 4
Lines 968 1033 +65
==========================================
+ Hits 921 971 +50
- Misses 47 62 +15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
joaquimg
left a comment
There was a problem hiding this comment.
there are more detail that need to be considered.
- outer indices must be converted to inner indices
- new function might be adding parameters do existing constraints
- new function might be removing parameters from existing constraints
| f::F, | ||
| ) where {T,S<:MOI.AbstractSet,F} | ||
| if haskey(model.affine_added_cache, c) | ||
| MOI.set( |
There was a problem hiding this comment.
this looks too simple, don't we have any other data cached for affine function in the POI.Optimizer?
| f::F, | ||
| ) where {T,S<:MOI.AbstractSet,F} | ||
| if haskey(model.quadratic_added_cache, c) | ||
| MOI.set( |
| s::S, | ||
| ) where {T,S<:MOI.AbstractSet} | ||
| if haskey(model.quadratic_added_cache, c) | ||
| MOI.set( |
| s::S, | ||
| ) where {T,S<:MOI.AbstractSet} | ||
| if haskey(model.affine_added_cache, c) | ||
| MOI.set( |
| f, | ||
| ) | ||
| else | ||
| MOI.set(model.optimizer, MOI.ConstraintFunction(), c, f) |
There was a problem hiding this comment.
this is also strange, you might have parameters in f
|
Isn't #119 related to |
It looks like the issue is that the values aren't being set to begin with. |
Probably we will need to fix both getters and setters methods. |
|
Maybe this is the correct place to fix this but why return after a throw? function MOI.get(
model::Optimizer,
attr::MOI.ConstraintSet,
ci::MOI.ConstraintIndex{F,S},
) where {F,S}
if haskey(model.original_constraint_function_and_set_cache, ci)
return model.original_constraint_function_and_set_cache[ci][2]
else
MOI.throw_if_not_valid(model, ci)
return MOI.get(model.optimizer, attr, ci)
end
end |
The throw only happens if the index is not valid. |
|
Yeah right, I realized it doesn't always throw. |
|
@joaquimg do you know if there is progress on this PR? I am ready to continue with the integration in PowerSimulations.jl |
|
@jd-lara could you share the code that triggers the problem? |
|
replaced by #130 |
Close #119
Follows the same idea of #109