我想知道如何在Python中正确解决以下问题?理论解应为= 300,t = 200。 d = 1。当我运行程序时,我得到a = 500,d = 1。子问题似乎没有解决。
from pyomo.environ import *
from pyomo.core import *
from pyomo.bilevel import *
M = ConcreteModel()
M.a = Var(bounds=(0,None))
M.d = Var(bounds=(None,None))
M.sub = SubModel(fixed=M.a)
M.sub.t = Var(bounds=(0,None))
M.o = Objective(expr=100*M.a*M.d,sense=maximize)
M.c1 = Constraint(expr=(M.a* M.d) <= 500)
M.c2 = Constraint(expr=(M.d*M.d) == 1)
M.sub.o = Objective(expr=500*M.sub.t*M.d, sense=maximize)
M.sub.c1 = Constraint(expr= ((M.sub.t* M.d)) == 200)
M.sub.c2 = Constraint(expr=((M.a*M.d+M.sub.t*M.d)) <= 500)