Skip to content

Issue on page /notebooks/01/02-production-planning-basic.html - Include Decorator Approach for Defining Expressions #91

@Toroi01

Description

@Toroi01

Hi,

I think it would be beneficial to also include the decorator approach for defining Expressions, similar to how it has been shown for Objective and Constraints. Currently, decorators are introduced in the Objective section, so some restructuring might be needed to integrate this addition.

I suggest something like the following:

@model.Expression()
def revenue(m):
    return 270 * m.y_U + 210 * m.y_V

@model.Expression()
def cost(m):
    return 10 * m.x_M + 50 * m.x_A + 40 * m.x_B

model.revenue.pprint()
model.cost.pprint()

Looking forward to your thoughts. Thanks!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions