JuMP.jl icon indicating copy to clipboard operation
JuMP.jl copied to clipboard

Error creating Symmetric variables without string-names in 1.1.1.

Open Johan-Gronqvist opened this issue 2 years ago • 1 comments

I am trying to create a symmetric variable (or matrix of variables) with JuMP 1.1.1 using the option to not create string names.

The following two work for me

model = Model(Hypatia.Optimizer)
@variable(model, [1:2, 1:2], Symmetric)
model = Model(Hypatia.Optimizer)
set_string_names_on_creation(model, false)
@variable(model, [1:2, 1:2])

but when combine the two options (symmetric and no string names)

model = Model(Hypatia.Optimizer)
set_string_names_on_creation(model, false)
@variable(model, [1:2, 1:2], Symmetric)

it seems to try to create a matrix from a string MethodError: no method matching (Matrix)(::String) with the stacktrace containing

Stacktrace:
 [1] vectorize(matrix::String, shape::SymmetricMatrixShape)
   @ JuMP ~/.julia/packages/JuMP/Y4piv/src/sd.jl:216
 [2] add_variable(model::Model, variable::VariablesConstrainedOnCreation{MathOptInterface.Reals, SymmetricMatrixShape, ScalarVariable{Float64, Float64, Float64, Float64}}, names::String)
   @ JuMP ~/.julia/packages/JuMP/Y4piv/src/variables.jl:1220

My Pkg.status() used for testing

      Status `~/.julia/environments/v1.7/Project.toml`
  [b99e6be6] Hypatia v0.7.0
  [7073ff75] IJulia v1.23.3
  [4076af6c] JuMP v1.1.1
  [0f1e0344] WebIO v0.8.18

Johan-Gronqvist avatar Aug 04 '22 08:08 Johan-Gronqvist

I can reproduce. An elusive bug in JuMP! This is my fault in #2978. I'll take a look.

odow avatar Aug 05 '22 21:08 odow