-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
UndefRefError: access to undefined reference #70
Comments
Could you share a minimal working example code that creates this error? Without it, it's hard to tell. |
Sure! Here is the whole model code. Thank you! ee2020_model=MCPModel() @variable(ee2020_model, a_cgoutputmax[pg in pg_techs,r in regions] <= 0) @variable(ee2020_model, b_demandmeet[r in regions]) @mapping(ee2020_model, cgoutputmax[pg in pg_techs,r in regions], sum(pg_s[pg,r,r1] for r1 in regions)-(GIC[r,pg]+newpg[pg,r])*GUH[r,pg]) @mapping(ee2020_model, kkt_newpg[pg in pg_techs,r in regions],drCAPCOST[pg]+a_cgoutputmax[pg,r]GUH[r,pg]) @mapping(ee2020_model,demandmeet[r in regions], sum(pg_b[pg,r,r1]*TEF[r1,r] for pg in pg_techs for r1 in regions)-DEM[r]0) @mapping(ee2020_model, kkt_pg_b[pg in pg_techs,r in regions,r1 in regions],dr*(pri_pg[pg,r1,r]+GRIDCOST[r1,r]) @mapping(ee2020_model, mc_pg[pg in pg_techs,r in regions,r1 in regions],pg_s[pg,r,r1]-pg_b[pg,r1,r]) @complementarity(ee2020_model, cgoutputmax, a_cgoutputmax) @complementarity(ee2020_model, kkt_newpg,newpg) @complementarity(ee2020_model, demandmeet,b_demandmeet) @complementarity(ee2020_model, kkt_pg_b, pg_b) @complementarity(ee2020_model, mc_pg,pri_pg) status = solveMCP(ee2020_model, solver=:PATH, convergence_tolerance=1e-8, output="yes", time_limit=3600) |
|
I upload the whole code and data on Github https://github.com/linyuantiaohe/julia_mcp_model_case Thank you a lot for help. This model can run in GAMS. I rewrite it in Julia, and there comes errors. |
You are repeating this twice: @complementarity(ee2020_model, kkt_rec_b, rec_b) One of them should be @complementarity(ee2020_model, kkt_rec_s, rec_s) After that, it runs well. I think your model is linear, isn't it? In such a case, you should better use |
Thank you so much for spending time on my mistake. And thank you for your suggestion, I will try it. |
Where may this error come from? I run the code to solve a MCP on M1 MacBook using rosetta. Could it be the reason?
UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ ./array.jl:924 [inlined]
[2] getindex
@ ./abstractarray.jl:1244 [inlined]
[3] _c_constraint_name(id_ptr::Ptr{Nothing}, i::Int32, buf_ptr::Ptr{UInt8}, buf_size::Int32)
@ PATHSolver ~/.julia/packages/PATHSolver/SXBNU/src/C_API.jl:231
[4] c_api_Path_Solve
@ ~/.julia/packages/PATHSolver/SXBNU/src/C_API.jl:512 [inlined]
[5] solve_mcp(F::Complementarity.var"#function_callback#5"{NLPEvaluator}, J::Complementarity.var"#jacobian_callback#7"{Complementarity.var"#j_eval#6"{NLPEvaluator}}, lb::Vector{Float64}, ub::Vector{Float64}, z::Vector{Float64}; nnz::Int64, variable_names::Vector{String}, constraint_names::Vector{String}, silent::Bool, generate_output::Int64, use_start::Bool, use_basics::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:convergence_tolerance, :output, :time_limit), Tuple{Float64, String, Int64}}})
@ PATHSolver ~/.julia/packages/PATHSolver/SXBNU/src/C_API.jl:626
[6] _solve_path!(m::Model; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:convergence_tolerance, :output, :time_limit), Tuple{Float64, String, Int64}}})
@ Complementarity ~/.julia/packages/Complementarity/a6hjV/src/mcp.jl:217
[7] solveMCP(m::Model; solver::Symbol, method::Symbol, linear::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:convergence_tolerance, :output, :time_limit), Tuple{Float64, String, Int64}}})
@ Complementarity ~/.julia/packages/Complementarity/a6hjV/src/mcp.jl:101
[8] top-level scope
@ ~/Mygithub/julia_helloworld/mcp.ipynb:68
The text was updated successfully, but these errors were encountered: