How do you add a piecewise linear constraint f(x) = x if x <= 1 else 2x - 1 if x > 1 in Pyomo?
model.f = Var()
model.constraint1 = Constraint(expr=model.f <= model.x)
model.constraint2 = Constraint(expr=model.f <= 2*model.x - 1 + M*(model.x <= 1))