File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,14 @@ function MOI.get(
103103) where {F,S}
104104 MOI. throw_if_not_valid (v, ci)
105105 f, _ = v. constraints[ci]:: Tuple{F,S}
106- return copy (f)
106+ # Since `MA.mutability(MOI.ScalarNonlinearFunction)` is `MA.IsNotMutable`,
107+ # this does not copy `MOI.ScalarNonlinearFunction`. This is important if the
108+ # function share aliases of the same subexpression at different parts of
109+ # it's expression graph or the expression graph of other functions of the
110+ # model. If we `copy`, they won't be aliases of the same subexpression
111+ # anymore hence `MOI.Nonlinear.ReverseAD` won't detect them as common
112+ # subexpressions.
113+ return MA. copy_if_mutable (f)
107114end
108115
109116function MOI. get (
You can’t perform that action at this time.
0 commit comments