Bắt đầu ngayBắt đầu miễn phí

PuLP for linear optimization

A farmer faces a diet problem for their cattle. The vet's recommendation is that each animal is fed at least 7 pounds of a mix of corn and soybean with at least 17% protein and 2% fat. Below are the relevant nutritional elements:

Food type Cost ($/lb) Protein (%) Fat (%)
corn 0.11 10 2.5
soybean 0.28 40 1

You will use this information to minimize costs subject to nutritional constraints.

pulp has been imported for you.

Bài tập này là một phần của khóa học

Introduction to Optimization in Python

Xem khóa học

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

# Define the model
model = ____

C = ____
S = ____
Chỉnh sửa và Chạy Mã