Skip to content

Method error during eval #8

@odow

Description

@odow

I assume somewhere that you drop zeros from summations, so then you're left with an empty list of arguments.

Reported on https://discourse.julialang.org/t/jump-maingo-no-method-matching/114514

julia> using JuMP, MAiNGO

julia> model = Model(MAiNGO.Optimizer);

julia> @variable(model, x);

julia> @objective(model, Min, [x, x]' * [x^2, 0])
0.0 + (x * (0)) + (x * (x²))

julia> optimize!(model)
ERROR: MethodError: no method matching +()
String concatenation is performed with * (See also: https://docs.julialang.org/en/v1/manual/strings/#man-concatenation).

Closest candidates are:
  +(::Base.CoreLogging.LogLevel, ::Integer)
   @ Base logging.jl:131
  +(::Bool, ::Complex{Bool})
   @ Base complex.jl:305
  +(::Bool, ::Bool)
   @ Base bool.jl:166
  ...

Stacktrace:
  [1] top-level scope
    @ none:1
  [2] eval
    @ ./boot.jl:385 [inlined]
  [3] eval
    @ ~/.julia/packages/MAiNGO/zVhVL/src/MAiNGO.jl:8 [inlined]
  [4] to_str(expr::Expr, variable_names::Vector{String})
    @ MAiNGO ~/.julia/packages/MAiNGO/zVhVL/src/util.jl:189
  [5] to_str_
    @ ~/.julia/packages/MAiNGO/zVhVL/src/util.jl:137 [inlined]
  [6] (::MAiNGO.var"#7#10"{MAiNGO.var"#to_str_#8"{Vector{String}}})(d::Expr)
    @ MAiNGO ./none:0
  [7] iterate
    @ ./generator.jl:47 [inlined]
  [8] collect_to!(dest::Vector{String}, itr::Base.Generator{Vector{…}, MAiNGO.var"#7#10"{…}}, offs::Int64, st::Int64)
    @ Base ./array.jl:892
  [9] collect_to_with_first!(dest::Vector{String}, v1::String, itr::Base.Generator{Vector{…}, MAiNGO.var"#7#10"{…}}, st::Int64)
    @ Base ./array.jl:870
 [10] collect(itr::Base.Generator{Vector{Any}, MAiNGO.var"#7#10"{MAiNGO.var"#to_str_#8"{Vector{String}}}})
    @ Base ./array.jl:844
 [11] to_str(expr::Expr, variable_names::Vector{String})
    @ MAiNGO ~/.julia/packages/MAiNGO/zVhVL/src/util.jl:213
 [12] to_str_
    @ ~/.julia/packages/MAiNGO/zVhVL/src/util.jl:137 [inlined]
 [13] (::MAiNGO.var"#7#10"{MAiNGO.var"#to_str_#8"{Vector{String}}})(d::Expr)
    @ MAiNGO ./none:0
 [14] iterate
    @ ./generator.jl:47 [inlined]
 [15] collect_to!(dest::Vector{String}, itr::Base.Generator{Vector{…}, MAiNGO.var"#7#10"{…}}, offs::Int64, st::Int64)
    @ Base ./array.jl:892
 [16] collect_to_with_first!(dest::Vector{String}, v1::String, itr::Base.Generator{Vector{…}, MAiNGO.var"#7#10"{…}}, st::Int64)
    @ Base ./array.jl:870
 [17] collect(itr::Base.Generator{Vector{Any}, MAiNGO.var"#7#10"{MAiNGO.var"#to_str_#8"{Vector{String}}}})
    @ Base ./array.jl:844
 [18] to_str(expr::Expr, variable_names::Vector{String})
    @ MAiNGO ~/.julia/packages/MAiNGO/zVhVL/src/util.jl:213
 [19] write_ALE_problem(m::MAiNGO.MAINGOModel)
    @ MAiNGO ~/.julia/packages/MAiNGO/zVhVL/src/util.jl:370
 [20] optimize!(model::MAiNGO.Optimizer)
    @ MAiNGO ~/.julia/packages/MAiNGO/zVhVL/src/MOI_wrapper.jl:190
 [21] optimize!
    @ ~/.julia/packages/MathOptInterface/2rAFb/src/Bridges/bridge_optimizer.jl:380 [inlined]
 [22] optimize!
    @ ~/.julia/packages/MathOptInterface/2rAFb/src/MathOptInterface.jl:85 [inlined]
 [23] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2rAFb/src/Utilities/cachingoptimizer.jl:316
 [24] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
    @ JuMP ~/.julia/packages/JuMP/Gwn88/src/optimizer_interface.jl:457
 [25] optimize!(model::Model)
    @ JuMP ~/.julia/packages/JuMP/Gwn88/src/optimizer_interface.jl:409
 [26] top-level scope
    @ REPL[10]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions