Receiving Error message: MethodError: no method matching isnan(::Symbol) #939
Replies: 6 comments 4 replies
-
To exclude issues with the installation you could check whether you can run the simple system (import the json file into a new spine db through the spine db editor). You should also check whether your importer is up to date. You could export your spine db to a json file and compare that file to the current template. Are there any differences in definitions and default values? |
Beta Was this translation helpful? Give feedback.
-
Looking at this
it looks like it's trying to fix a variable to a Symbol. Most likely you have specified some initial or fix value for a variable using a string rather than a number. |
Beta Was this translation helpful? Give feedback.
-
This functionality would prevent this sort of error The issue is tagged with toolbox milestone V0.8 - would be nice if it could get done |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. We've found a few commas that we changed into dots instead in the excel sheet. Looks like the importer could read it but SpineOpt couldn't. Anyways, now SpineOpt can complete the entire run and we receive no errors. But we still don't receive an output report and there's a warning that says: Here's the full log: Execution started at 2024-03-13T15:33:12.534
Window 1: 2019-01-15T00:00~>2019-01-22T00:00 Execution complete. Started at 2024-03-13T15:33:12.534, ended at 2024-03-13T15:33:44.829, elapsed time: 32 seconds, 295 milliseconds |
Beta Was this translation helpful? Give feedback.
-
Importer could read the values, but it read them as strings and that's what caused your error. Regarding your output, did you specify any output items for reporting? See here: https://spine-tools.github.io/SpineOpt.jl/latest/getting_started/output_data/ |
Beta Was this translation helpful? Give feedback.
-
@filipnykvist it looks like this is a support issue so I have taken the liberty of converting it to a discussion in the support section. |
Beta Was this translation helpful? Give feedback.
-
Hi!
We're trying to simulate a river system and have imported nodes, units etc from an excel file. The input database looks similar to a working model from another case study. When we're trying to run our simulation we get the error-message below. We have tried updating both SpineOpt and julia.
What are we doing wrong?
julia> # Running julia run_spineOpt.jl http://127.0.0.1:61054 http://127.0.0.1:61057
"http://127.0.0.1:61054"
"http://127.0.0.1:61057"
Execution started at 2024-03-13T12:37:15.015
Preparing SpineOpt for sqlite:///C:\Users\antes\OneDrive\Documents\KTH\År 3\KexJobb\Kexpriment_v1.spinetoolbox\items\input\input.sqlite?spinedbfilter=cfg%3Atool%3Aobject_activity_control...
Initializing data structure from db... 0.914390 seconds (659.36 k allocations: 47.798 MiB, 44.03% compilation time)
Preprocessing data structure... 0.075105 seconds (157.15 k allocations: 11.652 MiB, 86.19% compilation time)
Checking data structure... 0.001157 seconds (13.58 k allocations: 1.283 MiB)
Running SpineOpt...
Creating temporal structure... 0.007103 seconds (100.07 k allocations: 6.410 MiB)
Creating stochastic structure... 0.000867 seconds (6.66 k allocations: 845.188 KiB)
Adding variables...
ERROR: LoadError: MethodError: no method matching isnan(::Symbol)
Closest candidates are:
isnan(::BigFloat)
@ Base mpfr.jl:982
isnan(::Missing)
@ Base missing.jl:101
isnan(::DualNumbers.Dual)
@ DualNumbers C:\Users\antes.julia\packages\DualNumbers\5knFX\src\dual.jl:52
...
Stacktrace:
[1] _fix(var::JuMP.VariableRef, fix_value::Symbol)
@ SpineInterface C:\Users\antes.julia\packages\SpineInterface\uCIf7\src\update_model.jl:181
[2] fix(var::JuMP.VariableRef, call::SpineInterface.Call)
@ SpineInterface C:\Users\antes.julia\packages\SpineInterface\uCIf7\src\update_model.jl:176
[3] _variable(m::JuMP.Model, name::Symbol, ind::@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}, bin::Nothing, int::Nothing, lb::SpineInterface.Parameter, ub::Nothing, fix_value::SpineInterface.Parameter, internal_fix_value::Nothing, replacement_value::Nothing)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\variables\variable_common.jl:131
[4] #861
@ .\none:0 [inlined]
[5] iterate
@ .\generator.jl:47 [inlined]
[6] _all(f::Base.var"#384#386", itr::Base.Generator{Vector{@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}}, SpineOpt.var"#861#862"{Nothing, Nothing, SpineInterface.Parameter, Nothing, SpineInterface.Parameter, Nothing, Nothing, JuMP.Model, Symbol}}, ::Colon)
@ Base .\reduce.jl:1297
[7] all
@ .\reduce.jl:1283 [inlined]
[8] Dict(kv::Base.Generator{Vector{@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}}, SpineOpt.var"#861#862"{Nothing, Nothing, SpineInterface.Parameter, Nothing, SpineInterface.Parameter, Nothing, Nothing, JuMP.Model, Symbol}})
@ Base .\dict.jl:111
[9] add_variable!(m::JuMP.Model, name::Symbol, indices::typeof(node_state_indices); bin::Nothing, int::Nothing, lb::SpineInterface.Parameter, ub::Nothing, initial_value::SpineInterface.Parameter, fix_value::SpineInterface.Parameter, internal_fix_value::Nothing, replacement_value::Nothing, non_anticipativity_time::Nothing, non_anticipativity_margin::Nothing)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\variables\variable_common.jl:56
[10] add_variable_node_state!(m::JuMP.Model)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\variables\variable_node_state.jl:43
[11] macro expansion
@ .\timing.jl:279 [inlined]
[12] macro expansion
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\util\misc.jl:51 [inlined]
[13] _add_variables!(m::JuMP.Model; add_user_variables::SpineOpt.var"#44#54", log_level::Int64)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:122
[14] macro expansion
@ .\timing.jl:279 [inlined]
[15] macro expansion
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\util\misc.jl:51 [inlined]
[16] init_model!(m::JuMP.Model; add_user_variables::Function, add_constraints::Function, log_level::Int64)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:76
[17] init_model!
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:75 [inlined]
[18] rerun_spineopt_standard!(m::JuMP.Model, url_out::String; add_user_variables::Function, add_constraints::Function, log_level::Int64, optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, resume_file_path::Nothing, run_kernel::typeof(run_spineopt_kernel!))
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:37
[19] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@kwargs{add_user_variables::SpineOpt.var"#44#54", add_constraints::SpineOpt.var"#45#55", log_level::Int64, optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, resume_file_path::Nothing, run_kernel::typeof(run_spineopt_kernel!)})
@ Base .\essentials.jl:894
[20] rerun_spineopt(url_out::String; mip_solver::Nothing, lp_solver::Nothing, add_user_variables::Function, add_constraints::Function, log_level::Int64, optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, resume_file_path::Nothing, use_direct_model::Bool, run_kernel::typeof(run_spineopt_kernel!))
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:258
[21] rerun_spineopt
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:235 [inlined]
[22] _run_spineopt(url_in::String, url_out::String; upgrade::Bool, log_level::Int64, filters::Dict{String, String}, templates::Tuple{}, kwargs::@kwargs{mip_solver::Nothing, lp_solver::Nothing, add_user_variables::SpineOpt.var"#44#54", add_constraints::SpineOpt.var"#45#55", optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, use_direct_model::Bool, resume_file_path::Nothing, run_kernel::typeof(run_spineopt_kernel!)})
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:178
[23] _run_spineopt
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:174 [inlined]
[24] #run_spineopt#35
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:101 [inlined]
[25] top-level scope
@ C:\Users\antes.spinetoolbox\work\spineopt_518dbc3d946543169caa5ce69180b44e_toolbox\run_spineOpt.jl:3
[26] include(fname::String)
@ Base.MainInclude .\client.jl:489
[27] top-level scope
@ none:1
in expression starting at C:\Users\antes.spinetoolbox\work\spineopt_518dbc3d946543169caa5ce69180b44e_toolbox\run_spineOpt.jl:3
caused by: MethodError: no method matching isnan(::Symbol)
Closest candidates are:
isnan(::BigFloat)
@ Base mpfr.jl:982
isnan(::Missing)
@ Base missing.jl:101
isnan(::DualNumbers.Dual)
@ DualNumbers C:\Users\antes.julia\packages\DualNumbers\5knFX\src\dual.jl:52
...
Stacktrace:
[1] _fix(var::JuMP.VariableRef, fix_value::Symbol)
@ SpineInterface C:\Users\antes.julia\packages\SpineInterface\uCIf7\src\update_model.jl:181
[2] fix(var::JuMP.VariableRef, call::SpineInterface.Call)
@ SpineInterface C:\Users\antes.julia\packages\SpineInterface\uCIf7\src\update_model.jl:176
[3] _variable(m::JuMP.Model, name::Symbol, ind::@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}, bin::Nothing, int::Nothing, lb::SpineInterface.Parameter, ub::Nothing, fix_value::SpineInterface.Parameter, internal_fix_value::Nothing, replacement_value::Nothing)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\variables\variable_common.jl:131
[4] #861
@ .\none:0 [inlined]
[5] iterate
@ .\generator.jl:47 [inlined]
[6] Dict{@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}, JuMP.VariableRef}(kv::Base.Generator{Vector{@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}}, SpineOpt.var"#861#862"{Nothing, Nothing, SpineInterface.Parameter, Nothing, SpineInterface.Parameter, Nothing, Nothing, JuMP.Model, Symbol}})
@ Base .\dict.jl:85
[7] dict_with_eltype
@ .\abstractdict.jl:581 [inlined]
[8] dict_with_eltype
@ .\abstractdict.jl:588 [inlined]
[9] Dict(kv::Base.Generator{Vector{@NamedTuple{node::SpineInterface.Object, stochastic_scenario::SpineInterface.Object, t::SpineInterface.TimeSlice}}, SpineOpt.var"#861#862"{Nothing, Nothing, SpineInterface.Parameter, Nothing, SpineInterface.Parameter, Nothing, Nothing, JuMP.Model, Symbol}})
@ Base .\dict.jl:109
[10] add_variable!(m::JuMP.Model, name::Symbol, indices::typeof(node_state_indices); bin::Nothing, int::Nothing, lb::SpineInterface.Parameter, ub::Nothing, initial_value::SpineInterface.Parameter, fix_value::SpineInterface.Parameter, internal_fix_value::Nothing, replacement_value::Nothing, non_anticipativity_time::Nothing, non_anticipativity_margin::Nothing)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\variables\variable_common.jl:56
[11] add_variable_node_state!(m::JuMP.Model)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\variables\variable_node_state.jl:43
[12] macro expansion
@ .\timing.jl:279 [inlined]
[13] macro expansion
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\util\misc.jl:51 [inlined]
[14] _add_variables!(m::JuMP.Model; add_user_variables::SpineOpt.var"#44#54", log_level::Int64)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:122
[15] macro expansion
@ .\timing.jl:279 [inlined]
[16] macro expansion
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\util\misc.jl:51 [inlined]
[17] init_model!(m::JuMP.Model; add_user_variables::Function, add_constraints::Function, log_level::Int64)
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:76
[18] init_model!
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:75 [inlined]
[19] rerun_spineopt_standard!(m::JuMP.Model, url_out::String; add_user_variables::Function, add_constraints::Function, log_level::Int64, optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, resume_file_path::Nothing, run_kernel::typeof(run_spineopt_kernel!))
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt_standard.jl:37
[20] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@kwargs{add_user_variables::SpineOpt.var"#44#54", add_constraints::SpineOpt.var"#45#55", log_level::Int64, optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, resume_file_path::Nothing, run_kernel::typeof(run_spineopt_kernel!)})
@ Base .\essentials.jl:894
[21] rerun_spineopt(url_out::String; mip_solver::Nothing, lp_solver::Nothing, add_user_variables::Function, add_constraints::Function, log_level::Int64, optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, resume_file_path::Nothing, use_direct_model::Bool, run_kernel::typeof(run_spineopt_kernel!))
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:258
[22] rerun_spineopt
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:235 [inlined]
[23] _run_spineopt(url_in::String, url_out::String; upgrade::Bool, log_level::Int64, filters::Dict{String, String}, templates::Tuple{}, kwargs::@kwargs{mip_solver::Nothing, lp_solver::Nothing, add_user_variables::SpineOpt.var"#44#54", add_constraints::SpineOpt.var"#45#55", optimize::Bool, update_names::Bool, alternative::String, write_as_roll::Int64, use_direct_model::Bool, resume_file_path::Nothing, run_kernel::typeof(run_spineopt_kernel!)})
@ SpineOpt C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:178
[24] _run_spineopt
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:174 [inlined]
[25] #run_spineopt#35
@ C:\Users\antes.julia\packages\SpineOpt\FPoFr\src\run_spineopt.jl:101 [inlined]
[26] top-level scope
@ C:\Users\antes.spinetoolbox\work\spineopt_518dbc3d946543169caa5ce69180b44e_toolbox\run_spineOpt.jl:3
[27] include(fname::String)
@ Base.MainInclude .\client.jl:489
[28] top-level scope
@ none:1
Beta Was this translation helpful? Give feedback.
All reactions