How to realize the Linear programming of Python Mathematical Modeling PuLP Library
This article mainly explains "how to achieve Python mathematical modeling PuLP library linear programming", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to achieve Python mathematical modeling PuLP library linear programming" bar!
Catalogue
1. Problem description
2. Using PuLP library to solve linear programming.
2.1 question 1
(1) Mathematical modeling
(2) Python programming
(3) running result
2.2 question 2
(1) Mathematical modeling
(2) Python programming
(3) running result
2.3 question 3
(1) Mathematical modeling
(2) Python programming
(3) running result
2.4 question 4
(1) Mathematical modeling
(2) Python programming
(3) running result
2.5 question 5: integer programming problem
(1) Mathematical modeling
(2) Python programming
(3) running result
1. Problem description
When a factory produces two kinds of beverages An and B, for every 100 cases of A beverages, 6 kg of raw materials and 10 workers are needed, with a profit of 100000 yuan; for every 100 cases of B drinks, 5 kg of raw materials and 20 workers are needed, with a profit of 90, 000 yuan.
Now the factory has a total of 60 kg of raw materials and 150 workers, and due to other conditions, the output of A beverage is limited to no more than 800 cases.
(1) how to arrange the production plan, that is, how much each of the two beverages are produced to maximize profits?
(2) if an investment of 8000 yuan can increase the raw material by 1 kg, should this investment be made? How much investment is reasonable?
(3) if the profit of every 100 cases of A beverage can be increased by 10,000 yuan, should the production plan be changed?
(4) if the profit can be increased by $10,000 per 100 cases of beverage A, and if the investment of $8000 can increase the raw material by 1 kg, should this investment be made? How much investment is reasonable?
(5) if bulk cartons are not allowed (production according to 100 cartons), how to arrange the production plan, that is, how much each of the two beverages are produced to maximize profits?
2. Using PuLP library to solve linear programming problem 1 (1) mathematical modeling.
Problem modeling:
Decision variables:
X1: a beverage output (unit: 100 cases)
X2: B beverage output (unit: 100 cases)
Objective function:
Max fx = 10*x1 + 9*x2
Constraints:
6*x1 + 5*x2