lanl-ansi / GasPowerModels.jl

Julia packages for joint optimization of natural gas and power transmission networks
https://lanl-ansi.github.io/GasPowerModels.jl/stable/
Other
25 stars 10 forks source link

Error during testing. #44

Closed wenjingsu16 closed 4 years ago

wenjingsu16 commented 4 years ago

Hi,

I followed the instruction to add the command (Pkg.add("GasPowerModels") and add JuMP Juniper Ipopt Cbc). Then I run the testing. But it gave me error as below. Thanks for your help.

[ Info: no explicit NLP constraints or objective provided using @NLconstraint or @NLobjective macros IEEE 14 Belgian case: Error During Test at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/gpf.jl:15 Got exception outside of a @test could not load library "/Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/usr/lib/libipopt.1.10.10.dylib" dlopen(/Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/usr/lib/libipopt.1.10.10.dylib, 1): Library not loaded: @rpath/libgfortran.5.dylib Referenced from: /Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/usr/lib/libipopt.1.10.10.dylib Reason: image not found Stacktrace: [1] createProblem(::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Int64, ::Int64, ::Ipopt.var"#eval_f_cb#18"{Ipopt.Optimizer}, ::Ipopt.var"#eval_g_cb#20"{Ipopt.Optimizer}, ::Ipopt.var"#eval_grad_f_cb#19"{Ipopt.Optimizer}, ::Ipopt.var"#eval_jac_g_cb#21"{Ipopt.Optimizer,Array{Tuple{Int64,Int64},1}}, ::Ipopt.var"#eval_h_cb#22"{Ipopt.Optimizer,Array{Tuple{Int64,Int64},1}}) at /Users/carriesu/.julia/packages/Ipopt/Iu7vT/src/Ipopt.jl:224 [2] optimize!(::Ipopt.Optimizer) at /Users/carriesu/.julia/packages/Ipopt/Iu7vT/src/MOI_wrapper.jl:684 [3] optimize!(::MathOptInterface.Utilities.CachingOptimizer{Ipopt.Optimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at /Users/carriesu/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:170 [4] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{Ipopt.Optimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}},MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}) at /Users/carriesu/.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:73 [5] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at /Users/carriesu/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:170 [6] optimize!(::Model, ::OptimizerFactory; bridge_constraints::Bool, ignore_optimize_hook::Bool) at /Users/carriesu/.julia/packages/JuMP/ibcEh/src/optimizer_interface.jl:132 [7] optimize! at /Users/carriesu/.julia/packages/JuMP/ibcEh/src/optimizer_interface.jl:105 [inlined] [8] optimize_get_status_backend(::Model; solver::OptimizerFactory) at /Users/carriesu/.julia/packages/Juniper/N3gty/src/util.jl:271 [9] solve_root_model!(::Juniper.JuniperProblem) at /Users/carriesu/.julia/packages/Juniper/N3gty/src/model.jl:63 [10] optimize!(::Juniper.Optimizer) at /Users/carriesu/.julia/packages/Juniper/N3gty/src/MOI_wrapper/MOI_wrapper.jl:285 [11] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{Juniper.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}) at /Users/carriesu/.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:73 [12] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at /Users/carriesu/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:170 [13] optimize!(::Model, ::OptimizerFactory; bridge_constraints::Bool, ignore_optimize_hook::Bool) at /Users/carriesu/.julia/packages/JuMP/ibcEh/src/optimizer_interface.jl:132 [14] optimize! at /Users/carriesu/.julia/packages/JuMP/ibcEh/src/optimizer_interface.jl:105 [inlined] [15] macro expansion at ./timing.jl:310 [inlined] [16] optimize!(::GenericPowerModel{SOCWRForm}, ::GenericGasModel{StandardMISOCPForm}, ::OptimizerFactory) at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/core/base.jl:72 [17] solve_generic_model(::GenericPowerModel{SOCWRForm}, ::GenericGasModel{StandardMISOCPForm}, ::OptimizerFactory; solution_builder::Function) at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/core/base.jl:63 [18] run_generic_model(::Dict{String,Any}, ::Dict{String,Any}, ::Type{T} where T, ::Type{T} where T, ::OptimizerFactory, ::typeof(GasPowerModels.post_gpf); power_ref_extensions::Array{Any,1}, solution_builder::Function, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/core/base.jl:29 [19] run_generic_model(::String, ::String, ::Type{T} where T, ::Type{T} where T, ::OptimizerFactory, ::typeof(GasPowerModels.post_gpf); solution_builder::Function, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/core/base.jl:23 [20] run_generic_model at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/core/base.jl:21 [inlined] [21] #run_gpf#26 at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/prob/gpf.jl:7 [inlined] [22] run_gpf(::String, ::String, ::Type{T} where T, ::Type{T} where T, ::OptimizerFactory) at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/src/prob/gpf.jl:7 [23] top-level scope at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/gpf.jl:16 [24] top-level scope at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Test/src/Test.jl:1115 [25] top-level scope at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/gpf.jl:16 [26] top-level scope at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Test/src/Test.jl:1115 [27] top-level scope at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/gpf.jl:15 [28] include(::String) at ./client.jl:457 [29] top-level scope at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/runtests.jl:42 [30] include(::String) at ./client.jl:457 [31] top-level scope at none:6 [32] eval(::Module, ::Any) at ./boot.jl:331 [33] exec_options(::Base.JLOptions) at ./client.jl:272 [34] _start() at ./client.jl:506

Test Summary: | Error Total test qp gf pf | 1 1 IEEE 14 Belgian case | 1 1 ERROR: LoadError: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken. in expression starting at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/gpf.jl:14 in expression starting at /Users/carriesu/.julia/packages/GasPowerModels/aycKw/test/runtests.jl:42 ERROR: Package GasPowerModels errored during testing

tasseff commented 4 years ago

This looks like a problem with Ipopt.jl. Can you try running

] test Ipopt

If that fails, perhaps try executing

] build Ipopt
wenjingsu16 commented 4 years ago

Thanks for the quick response. The test of Ipopt failed. I tried to build Ipopt but it gave me the error below. Thanks for your help. I am new to Julia

Building Ipopt → ~/.julia/packages/Ipopt/Iu7vT/deps/build.log ┌ Error: Error building Ipopt: │ [ Info: Downloading https://github.com/JuliaOpt/IpoptBuilder/releases/download/v3.12.10-1-static-1/IpoptBuilder.v3.12.10.x86_64-apple-darwin14-gcc7.tar.gz to /Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/usr/downloads/IpoptBuilder.v3.12.10.x86_64-apple-darwin14-gcc7.tar.gz... │ ERROR: LoadError: Could not download https://github.com/JuliaOpt/IpoptBuilder/releases/download/v3.12.10-1-static-1/IpoptBuilder.v3.12.10.x86_64-apple-darwin14-gcc7.tar.gz to /Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/usr/downloads/IpoptBuilder.v3.12.10.x86_64-apple-darwin14-gcc7.tar.gz: │ ErrorException("") │ Stacktrace: │ [1] error(::String) at ./error.jl:33 │ [2] download(::String, ::String; verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:619 │ [3] download_verify(::String, ::String, ::String; verbose::Bool, force::Bool, quiet_download::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:688 │ [4] install(::String, ::String; prefix::Prefix, tarball_path::String, force::Bool, ignore_platform::Bool, verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/Prefix.jl:314 │ [5] top-level scope at /Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/build.jl:84 │ [6] include(::String) at ./client.jl:457 │ [7] top-level scope at none:5 │ in expression starting at /Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/build.jl:67 │ caused by [exception 1] │ │ Stacktrace: │ [1] error() at ./error.jl:42 │ [2] download(::String, ::String; verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:613 │ [3] download_verify(::String, ::String, ::String; verbose::Bool, force::Bool, quiet_download::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:688 │ [4] install(::String, ::String; prefix::Prefix, tarball_path::String, force::Bool, ignore_platform::Bool, verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/Prefix.jl:314 │ [5] top-level scope at /Users/carriesu/.julia/packages/Ipopt/Iu7vT/deps/build.jl:84 │ [6] include(::String) at ./client.jl:457 │ [7] top-level scope at none:5 [19:30:30] ] #=#=#
│ [19:30:30] curl: (60) Cert verify failed: BADCERT_NOT_TRUSTED │ [19:30:30] More details here: https://curl.haxx.se/docs/sslcerts.html │ [19:30:30] │ [19:30:30] curl failed to verify the legitimacy of the server and therefore could not │ [19:30:30] establish a secure connection to it. To learn more about this situation and │ [19:30:30] how to fix it, please visit the web page mentioned above. └ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

tasseff commented 4 years ago

I think this should be posted as an issue for Ipopt.jl. I'm not quite sure what the problem is, but it looks like Ipopt is not being downloaded because of an invalid SSL certificate on the website hosting the Ipopt binary.

wenjingsu16 commented 4 years ago

OK. I found the issue in https://github.com/jump-dev/Ipopt.jl/issues/94, which says that it is solved in the master. I tried to build ipopt master. But there is a conflicts in packages as below. (@v1.5) pkg> add Ipopt#master Cloning git-repo https://github.com/jump-dev/Ipopt.jl.git Updating git-repo https://github.com/jump-dev/Ipopt.jl.git Resolving package versions... ERROR: Unsatisfiable requirements detected for package GasModels [5e113713]: GasModels [5e113713] log: ├─possible versions are: [0.3.0, 0.3.2-0.3.5, 0.4.0-0.4.1, 0.5.0, 0.6.0, 0.7.0] or uninstalled ├─restricted by compatibility requirements with GasPowerModels [1fcaf345] to versions: 0.4.0-0.4.1 │ └─GasPowerModels [1fcaf345] log: │ ├─possible versions are: 0.1.0-0.1.1 or uninstalled │ └─restricted to versions * by an explicit requirement, leaving only versions 0.1.0-0.1.1 └─restricted by compatibility requirements with MathOptInterface [b8f27783] to versions: [0.3.0, 0.3.2-0.3.5, 0.5.0, 0.6.0, 0.7.0] or uninstalled — no versions left └─MathOptInterface [b8f27783] log: ├─possible versions are: [0.5.0-0.5.1, 0.6.0-0.6.4, 0.7.0, 0.8.0-0.8.4, 0.9.0-0.9.14] or uninstalled └─restricted to versions 0.9.5-0.9 by Ipopt [b6b21f68], leaving only versions 0.9.5-0.9.14 └─Ipopt [b6b21f68] log: ├─possible versions are: 0.6.3 or uninstalled └─Ipopt [b6b21f68] is fixed to version 0.6.3

wenjingsu16 commented 4 years ago

I checked my package status. I do have Ipopt somehow. But when I tried to follow the tutorial on the doc page. It shows as below. ipopt = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "print_level"=>0, "sb"=>"yes") ERROR: UndefVarError: optimizer_with_attributes not defined Stacktrace: [1] getproperty(::Module, ::Symbol) at ./Base.jl:26

My package status is (@v1.5) pkg> status Status ~/.julia/environments/v1.5/Project.toml [9961bab8] Cbc v0.6.3 [e30172f5] Documenter v0.25.2 [1fcaf345] GasPowerModels v0.1.1 [b6b21f68] Ipopt v0.5.4 [4076af6c] JuMP v0.19.2 [2ddba703] Juniper v0.4.3

And I followed the tutorial to run the model. It shows as below. julia> run_gpf("../test/data/case14.m", "../test/data/belgian.json", SOCWRPowerModel, MISOCPGasModel, Ipopt.Optimizer) ERROR: UndefVarError: SOCWRPowerModel not defined Stacktrace:

tasseff commented 4 years ago

Try installing GasPowerModels via

] add GasPowerModels#master

and then making sure you read the development version of the documentation. The current README corresponds to this development version. You are using the README with GasPowerModels v0.1.1, which is substantially different than the current development version.

wenjingsu16 commented 4 years ago

I followed the commands from https://github.com/lanl-ansi/GasPowerModels.jl/blob/master/docs/src/quickguide.md which should be the quick guide for the master version. I tried to add GasPowerModels#master. The error I got is as below. ┌ Error: Error building Dierckx: │ [ Info: Downloading https://github.com/kbarbary/DierckxBuilder/releases/download/v1.0.0-1/libddierckx.v1.0.0.x86_64-apple-darwin14-gcc7.tar.gz to /Users/carriesu/.julia/packages/Dierckx/ZTanR/deps/usr/downloads/libddierckx.v1.0.0.x86_64-apple-darwin14-gcc7.tar.gz... │ ERROR: LoadError: Could not download https://github.com/kbarbary/DierckxBuilder/releases/download/v1.0.0-1/libddierckx.v1.0.0.x86_64-apple-darwin14-gcc7.tar.gz to /Users/carriesu/.julia/packages/Dierckx/ZTanR/deps/usr/downloads/libddierckx.v1.0.0.x86_64-apple-darwin14-gcc7.tar.gz: │ ErrorException("") │ Stacktrace: │ [1] error(::String) at ./error.jl:33 │ [2] download(::String, ::String; verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:619 │ [3] download_verify(::String, ::String, ::String; verbose::Bool, force::Bool, quiet_download::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:688 │ [4] install(::String, ::String; prefix::Prefix, tarball_path::String, force::Bool, ignore_platform::Bool, verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/Prefix.jl:314 │ [5] top-level scope at /Users/carriesu/.julia/packages/Dierckx/ZTanR/deps/build.jl:51 │ [6] include(::String) at ./client.jl:457 │ [7] top-level scope at none:5 │ in expression starting at /Users/carriesu/.julia/packages/Dierckx/ZTanR/deps/build.jl:49 │ caused by [exception 1] │ │ Stacktrace: │ [1] error() at ./error.jl:42 │ [2] download(::String, ::String; verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:613 │ [3] download_verify(::String, ::String, ::String; verbose::Bool, force::Bool, quiet_download::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/PlatformEngines.jl:688 │ [4] install(::String, ::String; prefix::Prefix, tarball_path::String, force::Bool, ignore_platform::Bool, verbose::Bool) at /Users/carriesu/.julia/packages/BinaryProvider/U2dKK/src/Prefix.jl:314 │ [5] top-level scope at /Users/carriesu/.julia/packages/Dierckx/ZTanR/deps/build.jl:51 │ [6] include(::String) at ./client.jl:457 │ [7] top-level scope at none:5 [11:48:34] ] #=#=#
│ [11:48:34] curl: (60) Cert verify failed: BADCERT_NOT_TRUSTED │ [11:48:34] More details here: https://curl.haxx.se/docs/sslcerts.html │ [11:48:34] │ [11:48:34] curl failed to verify the legitimacy of the server and therefore could not │ [11:48:34] establish a secure connection to it. To learn more about this situation and │ [11:48:34] how to fix it, please visit the web page mentioned above. └ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

tasseff commented 4 years ago

This is interesting. It looks like most of the errors you've been encountering are due to a lack of common SSL certificates on your Mac. See the webpage mentioned in your error here. Let me look around and see if I can find a quick fix, but I'm also on a Mac and don't encounter these errors when installing packages.

wenjingsu16 commented 4 years ago

Thanks a lot I really want to run the model but encountered error every line. I downloaded Julia to run this model so I am not familiar with Julia.

tasseff commented 4 years ago

Here is the quickest fix I can find, do you want to give it a try?

https://discourse.julialang.org/t/curl-certificate-issue-with-pkg3-on-mac/33299/7

wenjingsu16 commented 4 years ago

Yes it worked. I downloaded homebrew and curl and appended the insecure. Now I am able to add Ipopt and GasPowerModel package. But I run into the error below when following the doc.

julia> using JuMP, Juniper, Ipopt, Cbc

[ Info: Precompiling Ipopt [b6b21f68-93f8-5de0-b562-5493be1d77c9]

julia> using GasPowerModels

julia> ipopt = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "print_level"=>0, "sb"=>"yes") ERROR: UndefVarError: optimizer_with_attributes not defined Stacktrace: [1] getproperty(::Module, ::Symbol) at ./Base.jl:26

tasseff commented 4 years ago

Could you type

] st

and post the package versions you are using? optimizer_with_attributes should be present in recent versions of JuMP.

tasseff commented 4 years ago

Also, try

] update

I just tagged a new release of GasPowerModels, so you don't need to add the recent version using the #master suffix.

wenjingsu16 commented 4 years ago

I updated the packages and tried to run the command again. It still shows the same error as below. Both GasPowerModel and JuMP are updated. Thanks (@v1.5) pkg> update Updating registry at ~/.julia/registries/General Updating git-repo https://github.com/JuliaRegistries/General.git Updating ~/.julia/environments/v1.5/Project.toml [9961bab8] ↑ Cbc v0.6.3 ⇒ v0.7.0 [1fcaf345] ↑ GasPowerModels v0.1.1 ⇒ v0.2.0 [b6b21f68] ↑ Ipopt v0.5.4 ⇒ v0.6.3 [4076af6c] ↑ JuMP v0.19.2 ⇒ v0.21.3 [2ddba703] ↑ Juniper v0.4.3 ⇒ v0.6.4 Updating ~/.julia/environments/v1.5/Manifest.toml [ae81ac8f] + ASL_jll v0.1.1+3 [4fba245c] + ArrayInterface v2.12.0 [6e4b80f9] + BenchmarkTools v0.5.0 [6e34b625] + Bzip2_jll v1.0.6+4 [fa961155] + CEnum v0.3.0 [9961bab8] ↑ Cbc v0.6.3 ⇒ v0.7.0 [38041ee0] + Cbc_jll v2.10.3+4 [3830e938] + Cgl_jll v0.60.2+5 [06985876] + Clp_jll v1.17.6+6 [523fee87] + CodecBzip2 v0.7.2 [944b1d66] + CodecZlib v0.7.0 [be027038] + CoinUtils_jll v2.11.3+3 [34da2185] - Compat v2.2.1 [39dd38d3] + Dierckx v0.4.2 [b4f34e82] + Distances v0.9.0 [6a86dc24] + FiniteDiff v2.6.0 [5e113713] ↑ GasModels v0.4.1 ⇒ v0.7.0 [1fcaf345] ↑ GasPowerModels v0.1.1 ⇒ v0.2.0 [cd3eb016] + HTTP v0.8.17 [2030c09a] ↑ InfrastructureModels v0.2.2 ⇒ v0.5.3 [83e8ac13] + IniFile v0.5.0 [b6b21f68] ↑ Ipopt v0.5.4 ⇒ v0.6.3 [9cc047cb] + Ipopt_jll v3.13.2+0 [7d188eb4] + JSONSchema v0.3.2 [4076af6c] ↑ JuMP v0.19.2 ⇒ v0.21.3 [2ddba703] ↑ Juniper v0.4.3 ⇒ v0.6.4 [d3d80556] + LineSearches v7.1.0 [d00139f3] + METIS_jll v5.1.0+4 [d7ed1dd3] + MUMPS_seq_jll v5.2.1+3 [b8f27783] ↑ MathOptInterface v0.8.4 ⇒ v0.9.14 [739be429] + MbedTLS v1.0.2 [c8ffd9c3] + MbedTLS_jll v2.16.6+1 [f28f55f0] ↑ Memento v0.12.1 ⇒ v1.1.1 [d8a4904e] + MutableArithmetics v0.2.10 [d41bc354] + NLSolversBase v7.7.0 [2774e3e8] + NLsolve v4.4.1 [656ef2d0] + OpenBLAS32_jll v0.3.9+4 [7da25872] + Osi_jll v0.108.5+3 [d96e819e] + Parameters v0.12.1 [c36e90e8] ↑ PowerModels v0.12.4 ⇒ v0.17.2 [189a3867] + Reexport v0.2.0 [ae029012] + Requires v1.0.1 [3bb67fe8] + TranscodingStreams v0.9.5 [3a884ed6] + UnPack v1.0.2 [a5390f91] + ZipFile v0.9.2 [8bb1440f] - DelimitedFiles [1a1011a3] - SharedArrays

julia> using JuMP, Juniper, Ipopt, Cbc

julia> using GasPowerModels

julia> ipopt = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "print_level"=>0, "sb"=>"yes") ERROR: UndefVarError: optimizer_with_attributes not defined Stacktrace: [1] getproperty(::Module, ::Symbol) at ./Base.jl:26

tasseff commented 4 years ago

Are you running the Julia commands from the same place you are running the update command? In your update, you have a prefix in the command of (@v1.5) but not in the commands where you're trying to run GasPowerModels. It looks like you are using one instance of Julia when you upgraded and another when you actually execute the commands.

tasseff commented 4 years ago

My mistake, maybe that is not the case, here. I do know that if you have the recent version of JuMP (which you appear to have gotten based on your update command), JuMP.optimizer_with_attributes should definitely be defined.

tasseff commented 4 years ago

Could you exit and relaunch Julia, then show the contents of

] st
wenjingsu16 commented 4 years ago

I checked and do not think that I have another version of Julia. I am just running Julia in Mac terminal. I relaunched Julia and optimizer_with_attributes is defined now. But I ran into another error following the commands as below. Thanks so much for your help.

julia> g_file = "examples/data/matgas/belgian-ne_opf.m" # Gas network. "examples/data/matgas/belgian-ne_opf.m"

julia> p_file = "examples/data/matpower/case14-ne.m" "examples/data/matpower/case14-ne.m"

julia> result = run_ne_opf(g_file, p_file, g_type, p_type, juniper; gm_solution_processors=[GasPowerModels._GM.sol_psqr_to_p!], pm_solution_processors=[GasPowerModels._PM.sol_data_model!]) ERROR: SystemError: opening file "examples/data/matgas/belgian-ne_opf.m": No such file or directory Stacktrace: [1] systemerror(::String, ::Int32; extrainfo::Nothing) at ./error.jl:168 [2] #systemerror#48 at ./error.jl:167 [inlined] [3] systemerror at ./error.jl:167 [inlined] [4] open(::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing) at ./iostream.jl:284 [5] open at ./iostream.jl:273 [inlined] [6] open(::GasModels.var"#5#6"{Bool,String}, ::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./io.jl:323 [7] open at ./io.jl:323 [inlined] [8] #parse_file#4 at /Users/carriesu/.julia/packages/GasModels/QWp0k/src/io/common.jl:25 [inlined] [9] parse_file at /Users/carriesu/.julia/packages/GasModels/QWp0k/src/io/common.jl:25 [inlined] [10] run_model(::String, ::String, ::Type{T} where T, ::Type{T} where T, ::MathOptInterface.OptimizerWithAttributes, ::typeof(build_ne_opf); gm_solution_processors::Array{typeof(GasModels.sol_psqr_to_p!),1}, pm_solution_processors::Array{typeof(PowerModels.sol_data_model!),1}, gm_ref_extensions::Array{Function,1}, pm_ref_extensions::Array{Function,1}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/carriesu/.julia/packages/GasPowerModels/08yMP/src/core/base.jl:137 [11] #run_ne_opf#93 at /Users/carriesu/.julia/packages/GasPowerModels/08yMP/src/prob/ne_opf.jl:9 [inlined]

tasseff commented 4 years ago

Ah, good find! Yes, I named the file wrong. I just pushed a change on the master branch that fixes this.

Also, make sure you're running the commands in a directory relative to these examples. If you don't have the examples, I'd recommend downloading the full source using git clone git@github.com:lanl-ansi/GasPowerModels.jl.git, running julia from within the GasPowerModels.jl directory, then executing the commands listed in the README.

wenjingsu16 commented 4 years ago

Thanks. I checked the directory on the laptop and changed the name to 14belgium-ne_opf locally. Now I am able to run it.