Optimization, Operations Research, Data Science, Hands On Tutorials, Python.
model.demand_constr = pyo.Constraint(model.J, rule=demand_rule) Let us define the objective function and once again use CBC to solve the problem. Notice that this time, I defined the objective using the expr keyword argument, which receives directly a pyomo expression. model.obj =