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

Connected

Exercise

Handling multiple elements

The farmer wants to replicate the previous optimization function to detail with more complicated meals for other animals on the farm.

The previous code has been provided. Can you adjust the previous code to make it better at handling multiple variables?

pulp has been imported for you.

Instructions

100 XP
  • Adjust the variable definition to use LpVariable.dicts(), saving them as variables with the name "Food".
  • Adjust the objective function to use lpSum().