KKT condition solves the bilevel optimization problem

Is there a package for solving bilevel optimization problems with KKT conditions? Specifically, the inequality constrained KKT conditions are linearized by the large M method. Finally, the two-layer problem is turned into a single layer.
I would be very grateful if you could help me!

large M method : Branch and bound method
kπ==0
Can be equivalent to
k<=Mw;
π<=M(1-w);
w 0-1 variables
M An infinite number

Maybe https://github.com/matbesancon/BilevelOptimization.jl?

1 Like

Checkout: https://github.com/joaquimg/BilevelJuMP.jl

2 Likes

I’ll try. Thank you

I’ll try it. Thank you


We have encountered some problems in installing this package. Please guide us. Thank you!!!

This is a question for @joaquimg

That is a version compatibility issue.
I will look into it.
@abcde can you send the result of
] st
So that I can see you package version and provide a fix faster.

[ Info: Precompiling BilevelJuMP [485130c0-026e-11ea-0f1a-6992cd14145c]
ERROR: LoadError: LoadError: UndefVarError: OptimizerFactory not defined
Stacktrace:
[1] top-level scope at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\Dualization\w9SXv\src\dualize.jl:82
[2] include(::Module, ::String) at .\Base.jl:377
[3] include(::String) at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\Dualization\w9SXv\src\Dualization.jl:1
[4] top-level scope at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\Dualization\w9SXv\src\Dualization.jl:29
[5] include(::Module, ::String) at .\Base.jl:377
[6] top-level scope at none:2
[7] eval at .\boot.jl:331 [inlined]
[8] eval(::Expr) at .\client.jl:449
[9] top-level scope at .\none:3
in expression starting at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\Dualization\w9SXv\src\dualize.jl:82
in expression starting at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\Dualization\w9SXv\src\Dualization.jl:29
ERROR: LoadError: Failed to precompile Dualization [191a621a-6537-11e9-281d-650236a99e60] to C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\compiled\v1.4\Dualization\4dgyK_7Kp2G.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
[3] _require(::Base.PkgId) at .\loading.jl:1029
[4] require(::Base.PkgId) at .\loading.jl:927
[5] require(::Module, ::Symbol) at .\loading.jl:922
[6] include(::Module, ::String) at .\Base.jl:377
[7] top-level scope at none:2
[8] eval at .\boot.jl:331 [inlined]
[9] eval(::Expr) at .\client.jl:449
[10] top-level scope at .\none:3
in expression starting at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\BilevelJuMP\SMaq9\src\BilevelJuMP.jl:7
ERROR: LoadError: Failed to precompile BilevelJuMP [485130c0-026e-11ea-0f1a-6992cd14145c] to C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\compiled\v1.4\BilevelJuMP\IKUgG_7Kp2G.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
[3] _require(::Base.PkgId) at .\loading.jl:1029
[4] require(::Base.PkgId) at .\loading.jl:927
[5] require(::Module, ::Symbol) at .\loading.jl:922
in expression starting at untitled-45e6eb6976edbac250090377eb48b5d1:1
Hello,This is my program reporting error,thanks

This problem is fixed on master,
] add Example#master
should fix it.
I will release version 0.2.0 today.

2 Likes

Update, version 0.2.0 was just released with a fix to that problem.

1 Like

批注 2020-07-21 232530
ERROR: Unsatisfiable requirements detected for package Weave [44d3d7a6]:
Weave [44d3d7a6] log:
├─Weave [44d3d7a6] has no known versions!
└─restricted to versions * by an explicit requirement — no versions left

sorry,I still can’t install this package, error as shown in the figure。I’m helpless :sob:

That does not seem related to BilevelJuMP.

Try removing weave: ] rm Weave

Otherwise, try a new environment from scratch:

] activate choose_an_env_name
] add BilevelJuMP

i got it. thank you so much.

sorry,excuse me again. I have installed the package and run the example in the readme file. I still report the following error. I don’t know what the reason is.

No problem.
I see you added version 0.1.0
The readme is for the latest version: 0.2.0
Add Bilevel was the very first command after activating the new env?
Can you run

] st

And send the result here?

11

I re installed juliapro, and this time I added the installation package without error, but running the example in the readme file is still the same problem.

So how do I add a 0.2.0 package

This looks like a dependency problem, because you have BilevelJuMP v0.1.0 while the latest is 0.2.0. Some locked package might be blocking other.
try exactly:

] activate db
] add BilevelJuMP

nothing else.