-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sparse Matrix multiplied by variable vector with Julia v1.0.5 and 1.3 #2163
Comments
@expression(model, A * y) I can't reproduce this on Julia 1.3 and JuMP#master. julia> model = Model()
A JuMP Model
Feasibility problem with:
Variables: 0
@aModel mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
julia> @variable(model, y[i=1:8])
8-element Array{VariableRef,1}:
y[1]
y[2]
y[3]
y[4]
y[5]
y[6]
y[7]
y[8]
julia> I = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
julia> J = [1, 2, 3, 3, 4, 4, 5, 5, 6, 6];
julia> V = [1, 1, -0.333333, -1.0, -0.666667, 0.0, -1.0, -1.0, -1.0, -1.0];
julia> A = sparse(I, J, V, 2, 8) # Is your code correct for this line? I reversed 8, 2.
2×8 SparseMatrixCSC{Float64,Int64} with 10 stored entries:
[1, 1] = 1.0
[2, 2] = 1.0
[1, 3] = -0.333333
[2, 3] = -1.0
[1, 4] = -0.666667
[2, 4] = 0.0
[1, 5] = -1.0
[2, 5] = -1.0
[1, 6] = -1.0
[2, 6] = -1.0
julia> A * y
2-element Array{GenericAffExpr{Float64,VariableRef},1}:
y[1] - 0.333333 y[3] - 0.666667 y[4] - y[5] - y[6]
y[2] - y[3] - y[5] - y[6] Much of the default sparse fallbacks don't work well with JuMP because we don't define See: #1151 |
This might be because the type of the sparse matrix is |
Still can't reproduce this on JuMP 0.21.2, even with julia> A * y
2-element Array{GenericAffExpr{Float64,VariableRef},1}:
y[1] - 0.333333 y[3] - 0.666667 y[4] - y[5] - y[6]
y[2] - y[3] - y[5] - y[6]
julia> typeof(A)
SparseMatrixCSC{Real,Int64}
julia> typeof(y)
Array{VariableRef,1} Can you reproduce? If not, I will close. |
Closing as not reproducible. Please re-open if you can find a reproducible example on |
The code that worked with Julia 1.0.5 does not work with Julia 1.3.
Any help is appreciated.
The text was updated successfully, but these errors were encountered: