Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Toroi01 opened this issue Mar 12, 2025 · 0 comments

Comments

@Toroi01
Copy link

Toroi01 commented Mar 12, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant