You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed that in @expression and in @constraint sparse matrices are not accepted.
For example, A=spzeros(n,m). If I use A_expr = @expression A or @constraint(model, A * X ==0)
It gives me this error:
ERROR: LoadError: MethodError: no method matching one(::Type{Any})
Closest candidates are:
one(::Type{Union{Missing, T}}) where T at missing.jl:87
one(::Missing) at missing.jl:83
one(::BitArray{2}) at bitarray.jl:400
...
Stacktrace:
[1] one(::Type{Any}) at ./missing.jl:87
[2] *(::SparseMatrixCSC{Float32,Int64}, ::Array{Variable,1})at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/SparseArrays/src/linalg.jl:53
This might be related: We started a project to abstract all the code we have in JuMP/src/operator.jl to rewrite LinearAlgebra and SparseArrays code for JuMP expressions: https://github.com/JuliaOpt/MutableArithmetics.jl/blob/master/src/linear_algebra.jl
The approach would be to create an abstract type so that if Parametron.Variable is a subtype of this abstract type, the call is dispatched to MutableArithmetics instead of LinearAlgebra/SparseArrays. Then the multiplication will exploit the mutability of the expressions created and will compute the element type of the resulting array correctly (usually, what is used in SparseArrays doesn't work as it start by promoting the type of both array to a common type so it the product of an array of Int and an array of Variable gives quadratic expressions).
I just noticed that in
@expression
and in@constraint
sparse matrices are not accepted.For example,
A=spzeros(n,m)
. If I useA_expr = @expression A
or@constraint(model, A * X ==0)
It gives me this error:
Originally posted by @ssadat in #107 (comment)
The text was updated successfully, but these errors were encountered: