1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Optimization in Python

Connected

Exercise

Shadow prices with juice

A firm is employing two machines \(M_1\) and \(M_2\) to put grapefruit juice (\(g\)) and orange juice (\(o\)) in bottles. Its goal is to maximize profit subject to the constraints

M1: \(6g + 5.5o \leq 40\) and M2: \(3g + 2.5o \leq 20\)

The constraints reflect the productivity and availability of machines. For example, M1 is available for 40 hours per week and needs 6 hours to bottle 1 ton of grapefruit juice and 5.5 hours for a ton of orange juice.

There is an additional supply constraint where the firm only receives a maximum of 6 tons of grapefruit a week, and 12 tons of oranges. These are the upper bounds.

pulp has been imported for you and model has been defined as well as the variables g and o for grapefruit and orange juice.

Instructions

100 XP
  • Complete the for loop to include a check to see if shadow price is positive.
  • Enter the variable that measures marginal increase in objective when constraint is relaxed.
  • Enter the variable that measures how tight the constraint is.