spine-tools / SpinePeriods.jl

GNU Lesser General Public License v3.0
4 stars 1 forks source link

Update SpinePeriods for Compatability with JuMP V1.14 #13

Closed DillonJ closed 1 year ago

DillonJ commented 1 year ago

Right now, running SpinePeriods gives errors about conflicts between Parameter and parameter_value in JuMP and SpineInterface in JuMP version 1.14 and higher

DillonJ commented 1 year ago

@manuelma I wonder could you take a look at this?

DillonJ commented 1 year ago
julia> # Running julia spine_periods_opt.jl http://127.0.0.1:58650 http://127.0.0.1:58653
2-element Vector{String}:
 "http://127.0.0.1:58650"
 "http://127.0.0.1:58653"
WARNING: using JuMP.parameter_value in module SpineInterface conflicts with an existing identifier.
WARNING: using JuMP.Parameter in module SpineInterface conflicts with an existing identifier.
WARNING: both JuMP and SpineInterface export "Parameter"; uses of it in module SpinePeriods must be qualified
[ Info: Reading database...
[ Info: Initializing model...
[ Info: Generating SpinePeriods temporal structure...
[ Info: Preprocessing data structure...
WARNING: both JuMP and SpineInterface export "parameter_value"; uses of it in module SpinePeriods must be qualified
ERROR: LoadError: UndefVarError: `parameter_value` not defined
Stacktrace:
  [1] (::SpinePeriods.var"#3#6"{SpineInterface.Object})(u::SpineInterface.Object)
    @ SpinePeriods .\none:0
  [2] iterate
    @ .\generator.jl:47 [inlined]
  [3] _all(f::Base.var"#372#374", itr::Base.Generator{Vector{SpineInterface.Object}, SpinePeriods.var"#3#6"{SpineInterface.Object}}, #unused#::Colon)
    @ Base .\reduce.jl:1282
  [4] all
    @ .\reduce.jl:1278 [inlined]
  [5] Dict(kv::Base.Generator{Vector{SpineInterface.Object}, SpinePeriods.var"#3#6"{SpineInterface.Object}})
    @ Base .\dict.jl:111
  [6] generate_resources()
    @ SpinePeriods C:\Workspace\Spine\SpinePeriods.jl\src\preprocess_data_structure.jl:59
  [7] preprocess_data_structure
    @ C:\Workspace\Spine\SpinePeriods.jl\src\preprocess_data_structure.jl:23 [inlined]
  [8] run_spine_periods_ordering(url_in::String, out_file::String; with_optimizer::MathOptInterface.OptimizerWithAttributes, alternative::String)
    @ SpinePeriods C:\Workspace\Spine\SpinePeriods.jl\src\run_spine_periods_ordering.jl:18
  [9] run_spine_periods_ordering
    @ C:\Workspace\Spine\SpinePeriods.jl\src\run_spine_periods_ordering.jl:6 [inlined]
 [10] run_spine_periods(url_in::String, out_file::String; with_optimizer::MathOptInterface.OptimizerWithAttributes, alternative::String)
    @ SpinePeriods C:\Workspace\Spine\SpinePeriods.jl\src\run_spine_periods.jl:24
 [11] top-level scope
    @ C:\Workspace\Spine\projects\fei_invest\spine_periods_opt.jl:8
 [12] include(fname::String)
    @ Base.MainInclude .\client.jl:478
 [13] top-level scope
    @ none:1
in expression starting at C:\Workspace\Spine\projects\fei_invest\spine_periods_opt.jl:8

caused by: UndefVarError: `parameter_value` not defined
Stacktrace:
  [1] (::SpinePeriods.var"#3#6"{SpineInterface.Object})(u::SpineInterface.Object)
    @ SpinePeriods .\none:0
  [2] iterate
    @ .\generator.jl:47 [inlined]
  [3] grow_to!(dest::Dict{Any, Any}, itr::Base.Generator{Vector{SpineInterface.Object}, SpinePeriods.var"#3#6"{SpineInterface.Object}})
    @ Base .\dict.jl:120
  [4] dict_with_eltype
    @ .\abstractdict.jl:590 [inlined]
  [5] Dict(kv::Base.Generator{Vector{SpineInterface.Object}, SpinePeriods.var"#3#6"{SpineInterface.Object}})
    @ Base .\dict.jl:109
  [6] generate_resources()
    @ SpinePeriods C:\Workspace\Spine\SpinePeriods.jl\src\preprocess_data_structure.jl:59
  [7] preprocess_data_structure
    @ C:\Workspace\Spine\SpinePeriods.jl\src\preprocess_data_structure.jl:23 [inlined]
  [8] run_spine_periods_ordering(url_in::String, out_file::String; with_optimizer::MathOptInterface.OptimizerWithAttributes, alternative::String)
    @ SpinePeriods C:\Workspace\Spine\SpinePeriods.jl\src\run_spine_periods_ordering.jl:18
  [9] run_spine_periods_ordering
    @ C:\Workspace\Spine\SpinePeriods.jl\src\run_spine_periods_ordering.jl:6 [inlined]
 [10] run_spine_periods(url_in::String, out_file::String; with_optimizer::MathOptInterface.OptimizerWithAttributes, alternative::String)
    @ SpinePeriods C:\Workspace\Spine\SpinePeriods.jl\src\run_spine_periods.jl:24
 [11] top-level scope
    @ C:\Workspace\Spine\projects\fei_invest\spine_periods_opt.jl:8
 [12] include(fname::String)
    @ Base.MainInclude .\client.jl:478
 [13] top-level scope
    @ none:1
manuelma commented 1 year ago

I did something quick so you can pull and try @DillonJ - I will test it now.

manuelma commented 1 year ago

Seems to work, closing.

DillonJ commented 1 year ago

Thanks @manuelma