Algorithm for bilevel optimisation ==> implementation in Pyomo

49 views
Skip to first unread message

Niki T.

unread,
Jul 30, 2021, 1:47:50 PM7/30/21
to Pyomo Forum
I am trying to implement a bilevel model to pyomo. Specifically, when I get the results from the upper level, I want the lower level model to inherit values from the solution of the variables of the upper level. And I want to implement a for loop between the models, in order to iterate until their objective functions converge.

The algorithm I want to implement is attached. Both the upper and lower level models are MILP and will be solved with CPLEX.

My question is how can the lower level model inherit the values of the upper level as parameters. This is my implementation but it is not correct. How can I formulate this?


Upper level model
up = AbstractModel()
up.c = Set() 
up.h = Set() 
up.p = Set() 
up.t = RangeSet(130) 

up.INH = Var(up.p, up.h, up.t, within=NonNegativeIntegers) 


Lower level model
lp = AbstractModel()
lp.c = Set() 
lp.h = Set() 
lp.p = Set() 
lp.t = RangeSet(130) 

lp.INH2 = Param(lp.p, lp.h, lp.t, default=instance.INH)

Algorithm.png

Daniel Gebbran

unread,
Aug 8, 2021, 12:25:50 PM8/8/21
to Pyomo Forum
Hello Nicky,

If you haven't already, I suggest you start by looking at the examples in this presentation: https://www.osti.gov/servlets/purl/1526125
You can use an explicit bilevel environment within Pyomo for modelling your problem at hand.

Best regards,
Daniel Gebbran
Reply all
Reply to author
Forward
0 new messages