Closed ghackebeil closed 4 years ago
Do we have a simple example for this?
I received a message from Mukesh Rungta of Air Liquide with the following toy example:
def pyomo_create_model(options, model_options):
M = ConcreteModel()
M.x = Var(bounds=(0,None))
M.y = Var(bounds=(0,None))
M.o = Objective(expr=M.x - 4*M.y)
M.sub = SubModel(fixed=M.x)
M.sub.o = Objective(expr=M.y*M.x)
M.sub.c1 = Constraint(expr=- M.x - M.y <= -3)
M.sub.c2 = Constraint(expr=-2*M.x + M.y <= 0)
M.sub.c3 = Constraint(expr= 2*M.x + M.y <= 12)
M.sub.c4 = Constraint(expr=-3*M.x + 2*M.y <= -4)
return M
The error message from the MPEC transformation is:
AttributeError: 'GeneralCanonicalRepn' object has no attribute 'variables'
pyomo.bilevel has been deprecated so closing this.
This transform implicitly assumes it is given a linear model by treating the constraint canonical repn as a LinearCanonicalRepn object. This leads to a confusing error message when the model has nonlinear constraints.