mobook / MO-book

Hands-On Optimization with Python
MIT License
153 stars 40 forks source link

Issue on page /notebooks/01/production-planning-basic.html #62

Closed LittlePanther-Susie closed 1 year ago

LittlePanther-Susie commented 1 year ago

The table in the previous page (https://mobook.github.io/MO-book/notebooks/01/production-planning.html) and constraint functions in code do not match.

Version Raw Material
required
Labor A
required
Labor B
required
Market
Demand
Price
U 10 g 1 hr 2 hr $\leq$ 40 units 270€
V 9 g 1 hr 1 hr unlimited 210€

Current code

@model.Constraint()
def labor_A(model):
    return 2 * model.y_U + 1 * model.y_V <= model.x_A

@model.Constraint()
def labor_B(model):
    return 1 * model.y_U + 1 * model.y_V <= model.x_B

Update

@model.Constraint()
def labor_A(model):
  return 1 * model.y_U + 1 * model.y_V <= model.x_A

@model.Constraint()
def labor_B(model):
  return 2 * model.y_U + 1 * model.y_V <= model.x_B
jckantor commented 1 year ago

Thanks, Susie. This was an error in transcribing details of a model to the notebook, and actually propagated through all three notebooks associated with Chapter 1 of the project. Thanks for pointing this one out! Corrections have been made, answers verified, so issue will be closed.