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

Connected

Exercise

Linear constrained biscuits

Congratulations! Your biscuit business has expanded. You now have two bakeries, \(A\) and \(B\), to help you deliver your biscuits nationwide.

Your bakeries can each make 100 biscuits a day and the cost of making a biscuit in bakery \(A\) is \(1.5\) the quantity \(q\) while in bakery \(B\) it is \(1.75q\).

Price is defined by \(150 - q\).

Your business is booming and you already have 140 biscuit pre-orders for the day. You want to maximize your profit for the day. How many biscuits should you make in each bakery?

minimize, Bounds, and LinearConstraint have been loaded for you and the revenue function R is already defined.

Instructions

100 XP
  • Define the cost function C using q[0] for the quantities in bakery \(A\) and q[1] for bakery \(B\).
  • Define the profit function.
  • Define the bounds and constraints for your optimization problem.
  • Perform optimization, saving to result.