File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1056,6 +1056,32 @@ function canonical(f::MOI.AbstractFunction)
10561056 return g
10571057end
10581058
1059+ # Workaround: both `is_canonical` and `canonicalize!` would be slow otherwise
1060+ canonical (f:: MOI.ScalarNonlinearFunction ) = f
1061+
1062+ # This is maybe the right fix, but commented out to be sure to isolate
1063+ # JuMP-side of profiling in https://github.com/jump-dev/JuMP.jl/pull/4032
1064+ # We still need to figure out what's the right fix here anyway
1065+ # function canonical(f::MOI.ScalarNonlinearFunction)
1066+ # cache = Dict{MOI.AbstractScalarFunction,MOI.AbstractScalarFunction}()
1067+ # # Don't use recursion here. This gets called for all scalar nonlinear
1068+ # # constraints.
1069+ # stack = Any[arg for arg in f.args]
1070+ # while !isempty(stack)
1071+ # arg = pop!(stack)
1072+ # if arg isa MOI.ScalarNonlinearFunction
1073+ # for a in arg.args
1074+ # push!(stack, a)
1075+ # end
1076+ # else
1077+ # if !is_canonical(arg)
1078+ # return false
1079+ # end
1080+ # end
1081+ # end
1082+ # return true
1083+ # end
1084+
10591085canonicalize! (f:: Union{MOI.VectorOfVariables,MOI.VariableIndex} ) = f
10601086
10611087"""
You can’t perform that action at this time.
0 commit comments