The following gives me an error and I don’t know how to fix it. I want entries of the matrix X to be bounded by -1 and 1, and in addition I wand |X(i,j)| >= 0.01 for all i and j. What am I doing wrong?
MethodError: no method matching abs(::LinearAlgebra.Symmetric{VariableRef, Matrix{VariableRef}})
Closest candidates are:
abs(::ForwardDiff.Dual{T}) where T at ~/.julia/packages/ForwardDiff/pDtsf/src/dual.jl:238
abs(::Signed) at /Volumes/Julia-1.7.2/Julia-1.7.app/Contents/Resources/julia/share/julia/base/int.jl:180
abs(::Unsigned) at /Volumes/Julia-1.7.2/Julia-1.7.app/Contents/Resources/julia/share/julia/base/int.jl:179
...
I guess that abs isn’t supported in constraints. Maybe try replacing min(abs(X)) .>= 0.01 with something like these two constraints: X[1:n, 1:n] ≤ -0.01 and 0.01 ≤ X[1:n, 1:n].
Yes that’s the correct syntax but still I get the error
MethodError: no method matching abs(::VariableRef)
Closest candidates are:
abs(::ForwardDiff.Dual{T}) where T at ~/.julia/packages/ForwardDiff/pDtsf/src/dual.jl:238
abs(::Signed) at /Volumes/Julia-1.7.2/Julia-1.7.app/Contents/Resources/julia/share/julia/base/int.jl:180
abs(::Unsigned) at /Volumes/Julia-1.7.2/Julia-1.7.app/Contents/Resources/julia/share/julia/base/int.jl:179
Realize that even if you can formulate this for JuMP, it’s likely to be a pretty terrible combinatorial optimization problem — your feasible set is not only non-convex, it is actually disconnected, with an exponentially large number of disjoint sign choices. It may be pretty hard (probably NP hard) for any algorithm to solve such a problem. Are you sure you can’t formulate a different problem for your application? Why do you need the absolute-value constraint?