Giter VIP home page Giter VIP logo

optimalbids.jl's Introduction

optimalbids.jl's People

Contributors

github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

optimalbids.jl's Issues

Prep Release 1.3.0

  • Make PowerModelsMarkets profit calculation compatible with ChainRules.

Remove MATLAB test case files

Remove MATLAB test case files and, perhaps, add functionality to PowerModelsMarkets to download files from known matpower set locations.

No errors when no inequality is added

On the example with Nonconvex.jl, there is a comment saying that it doesn't work when no inequalities are added.

add_ineq_constraint!(model, x -> -1) # errors when no inequality is added!

When I run the code as-is, I find that the maximum Profit is 78849.85061111911, with the Multiplicative Factor of 27.239617121582047, as can be seen on the following image:

with inequality

However, if I run without the inequality, not only the code works but I find a higher maximum Profit, at the value of 80897.18985312385, with the Multiplicative Factor of 30.44499859189181, as can be seen on the following image:

no inequalities

In the next image, it is possible to see both solutions on the same graphic, where the higher value represents the case without the inequality.

both with and without inequality

NonconvexNLopt errors when using profit_for_bid!

Ipopt calls Zygote which errors with the following error:

ERROR: map is not defined on dictionaries
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] map(f::Function, #unused#::Dict{String, Any})
    @ Base ./abstractarray.jl:2880
  [3] ∇map(cx::Zygote.Context, f::InfrastructureModels.var"#6#7", args::Dict{String, Any})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/lib/array.jl:197
  [4] _pullback(cx::Zygote.Context, #unused#::typeof(collect), g::Base.Generator{Dict{String, Any}, InfrastructureModels.var"#6#7"})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/lib/array.jl:244
  [5] _pullback
    @ ~/.julia/packages/InfrastructureModels/zufh0/src/core/base.jl:213 [inlined]
  [6] _pullback(::Zygote.Context, ::typeof(InfrastructureModels._populate_ref_it!), ::Dict{Symbol, Any}, ::Dict{String, Any}, ::Set{String}, ::String)
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
  [7] _pullback
    @ ~/.julia/packages/InfrastructureModels/zufh0/src/core/base.jl:148 [inlined]
  [8] _pullback(::Zygote.Context, ::typeof(InfrastructureModels.ref_initialize), ::Dict{String, Any}, ::String, ::Set{String})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
  [9] _pullback
    @ ~/.julia/packages/InfrastructureModels/zufh0/src/core/base.jl:83 [inlined]
 [10] _pullback(::Zygote.Context, ::InfrastructureModels.var"##InitializeInfrastructureModel#3", ::Dict{Symbol, Any}, ::Dict{String, Dict{String, Bool}}, ::JuMP.Model, ::typeof(InfrastructureModels.InitializeInfrastructureModel), ::Type{DCPPowerModel}, ::Dict{String, Any}, ::Set{String}, ::Symbol)
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [11] _pullback
    @ ~/.julia/packages/InfrastructureModels/zufh0/src/core/base.jl:81 [inlined]
 [12] _pullback(::Zygote.Context, ::InfrastructureModels.var"#InitializeInfrastructureModel##kw", ::NamedTuple{(:setting,), Tuple{Dict{String, Dict{String, Bool}}}}, ::typeof(InfrastructureModels.InitializeInfrastructureModel), ::Type{DCPPowerModel}, ::Dict{String, Any}, ::Set{String}, ::Symbol)
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [13] _pullback
    @ ~/.julia/packages/InfrastructureModels/zufh0/src/core/base.jl:356 [inlined]
 [14] _pullback(::Zygote.Context, ::InfrastructureModels.var"##instantiate_model#23", ::Vector{Any}, ::Base.Pairs{Symbol, Dict{String, Dict{String, Bool}}, Tuple{Symbol}, NamedTuple{(:setting,), Tuple{Dict{String, Dict{String, Bool}}}}}, ::typeof(InfrastructureModels.instantiate_model), ::Dict{String, Any}, ::Type{DCPPowerModel}, ::typeof(build_opf), ::typeof(ref_add_core!), ::Set{String}, ::Symbol)
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [15] _pullback
    @ ~/.julia/packages/InfrastructureModels/zufh0/src/core/base.jl:354 [inlined]
 [16] _pullback(::Zygote.Context, ::InfrastructureModels.var"#instantiate_model##kw", ::NamedTuple{(:setting,), Tuple{Dict{String, Dict{String, Bool}}}}, ::typeof(InfrastructureModels.instantiate_model), ::Dict{String, Any}, ::Type{DCPPowerModel}, ::typeof(build_opf), ::typeof(ref_add_core!), ::Set{String}, ::Symbol)
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [17] _pullback
    @ ~/.julia/packages/PowerModels/nn5HX/src/core/base.jl:67 [inlined]
--- the last 2 lines are repeated 1 more time ---
 [20] _pullback(::Zygote.Context, ::PowerModels.var"#instantiate_model##kw", ::NamedTuple{(:setting,), Tuple{Dict{String, Dict{String, Bool}}}}, ::typeof(instantiate_model), ::Dict{String, Any}, ::Type{DCPPowerModel}, ::typeof(build_opf))
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [21] _pullback
    @ ~/Workspace/OptimalBids.jl/src/PowerModelsMarkets/PowerModelsMarkets.jl:187 [inlined]
 [22] _pullback(ctx::Zygote.Context, f::typeof(clear_market!), args::PowerModelsMarket)
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [23] _pullback
    @ ~/Workspace/OptimalBids.jl/src/OptimalBids.jl:47 [inlined]
 [24] _pullback(::Zygote.Context, ::typeof(profit_for_bid!), ::PowerModelsMarket, ::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [25] _pullback
    @ ./REPL[51]:2 [inlined]
 [26] _pullback(ctx::Zygote.Context, f::typeof(profit_function), args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [27] _apply
    @ ./boot.jl:814 [inlined]
 [28] adjoint
    @ ~/.julia/packages/Zygote/FPUm3/src/lib/lib.jl:200 [inlined]
 [29] _pullback
    @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
 [30] _pullback
    @ ~/.julia/packages/NonconvexCore/YjDSM/src/functions/functions.jl:170 [inlined]
 [31] _pullback(::Zygote.Context, ::NonconvexCore.var"##_#8", ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::NonconvexCore.Objective{typeof(profit_function), Base.RefValue{Float64}, Set{Symbol}}, ::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [32] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:814
 [33] adjoint
    @ ~/.julia/packages/Zygote/FPUm3/src/lib/lib.jl:200 [inlined]
 [34] _pullback
    @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
 [35] _pullback
    @ ~/.julia/packages/NonconvexCore/YjDSM/src/functions/functions.jl:170 [inlined]
 [36] _pullback(ctx::Zygote.Context, f::NonconvexCore.Objective{typeof(profit_function), Base.RefValue{Float64}, Set{Symbol}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [37] _pullback
    @ ~/.julia/packages/NonconvexCore/YjDSM/src/models/vec_model.jl:90 [inlined]
 [38] _pullback(ctx::Zygote.Context, f::NonconvexCore.var"#133#140"{Model{Vector{Any}}, NonconvexCore.Unflatten{Vector{Float64}, typeof(identity)}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [39] _apply
    @ ./boot.jl:814 [inlined]
 [40] adjoint
    @ ~/.julia/packages/Zygote/FPUm3/src/lib/lib.jl:200 [inlined]
 [41] _pullback
    @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
 [42] _pullback
    @ ~/.julia/packages/NonconvexCore/YjDSM/src/functions/functions.jl:170 [inlined]
 [43] _pullback(::Zygote.Context, ::NonconvexCore.var"##_#8", ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::NonconvexCore.Objective{NonconvexCore.var"#133#140"{Model{Vector{Any}}, NonconvexCore.Unflatten{Vector{Float64}, typeof(identity)}}, Base.RefValue{Float64}, Set{Symbol}}, ::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [44] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:814
 [45] adjoint
    @ ~/.julia/packages/Zygote/FPUm3/src/lib/lib.jl:200 [inlined]
 [46] _pullback
    @ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:65 [inlined]
 [47] _pullback
    @ ~/.julia/packages/NonconvexCore/YjDSM/src/functions/functions.jl:170 [inlined]
 [48] _pullback
    @ ~/.julia/packages/NonconvexCore/YjDSM/src/functions/counting_function.jl:9 [inlined]
 [49] _pullback(ctx::Zygote.Context, f::NonconvexCore.CountingFunction{NonconvexCore.Objective{NonconvexCore.var"#133#140"{Model{Vector{Any}}, NonconvexCore.Unflatten{Vector{Float64}, typeof(identity)}}, Base.RefValue{Float64}, Set{Symbol}}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface2.jl:0
 [50] _pullback(f::Function, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface.jl:34
 [51] pullback(f::Function, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface.jl:40
 [52] gradient(f::Function, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface.jl:75
 [53] (::NonconvexIpopt.var"#eval_grad_f#13"{NonconvexCore.CountingFunction{NonconvexCore.Objective{NonconvexCore.var"#133#140"{Model{Vector{Any}}, NonconvexCore.Unflatten{Vector{Float64}, typeof(identity)}}, Base.RefValue{Float64}, Set{Symbol}}}})(x::Vector{Float64}, grad_f::Vector{Float64})
    @ NonconvexIpopt ~/.julia/packages/NonconvexIpopt/4F7iF/src/ipopt.jl:135
 [54] _Eval_Grad_F_CB(n::Int32, x_ptr::Ptr{Float64}, #unused#::Int32, grad_f::Ptr{Float64}, user_data::Ptr{Nothing})
    @ Ipopt ~/.julia/packages/Ipopt/gZvYd/src/C_wrapper.jl:49
 [55] IpoptSolve(prob::Ipopt.IpoptProblem)
    @ Ipopt ~/.julia/packages/Ipopt/gZvYd/src/C_wrapper.jl:431
 [56] optimize!(workspace::NonconvexIpopt.IpoptWorkspace{NonconvexCore.VecModel{Vector{Float64}}, Ipopt.IpoptProblem, Vector{Float64}, IpoptOptions{NamedTuple{(:hessian_approximation, :jac_c_constant, :jac_d_constant), Tuple{String, String, String}}}, Base.RefValue{Int64}})

Bandaid solution: JuliaNonconvex/NonconvexNLopt.jl#3

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.