readme
This commit is contained in:
139
README.md
139
README.md
@@ -1,3 +1,138 @@
|
|||||||
# feed-formula-calculator
|
# 饲料配方计算器
|
||||||
|
|
||||||
饲料配方计算器
|
## 说明
|
||||||
|
|
||||||
|
一个饲料配方计算脚本, 通过线性规划计算价格最优饲料配方。
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
|
||||||
|
将脚本内的 **<u>原料营养数据(ingredients) / 猪需求营养数据(requirements) / 市面配方(market_formula)</u>** 替换成真实的数据,
|
||||||
|
运行脚本即可
|
||||||
|
|
||||||
|
输出包括 [results](./results) 目录下的四个文件和中断直接输出的结果(内容基本相同), 终端输出结果类似如下:
|
||||||
|
|
||||||
|
```
|
||||||
|
C:\Users\xxx\python.exe C:\Users\xxx\feed_formula_calculator.py
|
||||||
|
Welcome to the CBC MILP Solver
|
||||||
|
Version: 2.10.3
|
||||||
|
Build Date: Dec 15 2019
|
||||||
|
|
||||||
|
command line - C:\Users\xxx/cbc.exe C:\Users\xxx\16f9f76a01ab4426ba80de86c285ecdb-pulp.mps -primalT -1e-12 -dualT -1e-12 -maxIt -10000000 -presolve -on -strategy -2 -randomC -123 -sec -10 -timeMode elapsed -branch -printingOptions all -solution C:\Users\xxx\16f9f76a01ab4426ba80de86c285ecdb-pulp.sol
|
||||||
|
At line 2 NAME MODEL
|
||||||
|
At line 3 ROWS
|
||||||
|
At line 14 COLUMNS
|
||||||
|
At line 120 RHS
|
||||||
|
At line 130 BOUNDS
|
||||||
|
At line 146 ENDATA
|
||||||
|
Problem MODEL has 9 rows, 15 columns and 90 elements
|
||||||
|
Coin0008I MODEL read with 0 errors
|
||||||
|
-1e-12 was provided for primalTolerance - valid range is 1e-20 to 1.79769e+308
|
||||||
|
-1e-12 was provided for dualTolerance - valid range is 1e-20 to 1.79769e+308
|
||||||
|
-10000000 was provided for maxIterations - valid range is 0 to 2147483647
|
||||||
|
presolve has value on
|
||||||
|
No match for on - ? for list of commands
|
||||||
|
-2 was provided for strategy - valid range is 0 to 2
|
||||||
|
-123 was provided for randomCbcSeed - valid range is -1 to 2147483647
|
||||||
|
-10 was provided for seconds - valid range is -1 to 1.79769e+308
|
||||||
|
Option for timeMode changed from cpu to elapsed
|
||||||
|
Presolve 9 (0) rows, 15 (0) columns and 90 (0) elements
|
||||||
|
0 Obj 0 Primal inf 3.1648143 (7)
|
||||||
|
9 Obj 2054.9281
|
||||||
|
Optimal - objective value 2054.9281
|
||||||
|
Optimal objective 2054.928067 - 9 iterations time 0.002
|
||||||
|
Option for printingOptions changed from normal to all
|
||||||
|
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00
|
||||||
|
|
||||||
|
|
||||||
|
=== 优化配方结果 ===
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 原料 | 比例 (%) | 成本 (元/吨) |
|
||||||
|
+=============+==========+============+
|
||||||
|
| 构树叶_未加工 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 构树叶_发酵 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 玉米胚芽_压榨 | 73.58 | 1250.87 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 麦麸 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 米糠 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 牧草_苜蓿干 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 玉米 | 8.10 | 191.80 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 豆粕 | 15.79 | 521.05 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 植物油_豆油 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 赖氨酸_L盐 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 蛋氨酸_DL | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 预混料_维生素微量元素 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 鱼粉 | 1.52 | 76.15 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 骨粉 | 1.00 | 15.06 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
| 食盐 | 0.00 | 0.00 |
|
||||||
|
+-------------+----------+------------+
|
||||||
|
总价格: 2054.93 元/吨
|
||||||
|
一斤饲料价格: 1.03 元
|
||||||
|
|
||||||
|
=== 营养总量与需求偏差 ===
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 营养 | 实际值 | 需求值 | 需求类型 | 偏差 | 偏差比例(%) | 状态 |
|
||||||
|
+======+=======+=======+========+======+===========+======+
|
||||||
|
| 蛋氨酸 | 0.28 | 0.25 | 下限 | 0.03 | 12.00 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 能量 | 12.50 | 12.50 | 下限 | 0.00 | 0.00 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 赖氨酸 | 0.81 | 0.80 | 下限 | 0.01 | 1.25 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 钙 | 0.50 | 0.50 | 下限 | 0.00 | 0.00 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 磷 | 0.55 | 0.40 | 下限 | 0.15 | 37.50 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 蛋白 | 17.00 | 17.00 | 下限 | 0.00 | 0.00 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 纤维 | 6.00 | 6.00 | 上限 | 0.00 | 0.00 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
| 单宁 | 0.00 | 0.50 | 上限 | 0.50 | 100.00 | 达标 |
|
||||||
|
+------+-------+-------+--------+------+-----------+------+
|
||||||
|
|
||||||
|
=== 市面配方营养总量 ===
|
||||||
|
+------+-------+
|
||||||
|
| 营养 | 值 |
|
||||||
|
+======+=======+
|
||||||
|
| 蛋氨酸 | 0.31 |
|
||||||
|
+------+-------+
|
||||||
|
| 能量 | 11.56 |
|
||||||
|
+------+-------+
|
||||||
|
| 赖氨酸 | 0.86 |
|
||||||
|
+------+-------+
|
||||||
|
| 钙 | 0.82 |
|
||||||
|
+------+-------+
|
||||||
|
| 磷 | 0.82 |
|
||||||
|
+------+-------+
|
||||||
|
| 蛋白 | 17.76 |
|
||||||
|
+------+-------+
|
||||||
|
| 纤维 | 3.70 |
|
||||||
|
+------+-------+
|
||||||
|
| 单宁 | 0.00 |
|
||||||
|
+------+-------+
|
||||||
|
|
||||||
|
=== 市面配方成本与偏差 ===
|
||||||
|
+------------+---------+---------+--------+
|
||||||
|
| 项 | 市面配方 | 优化配方 | 偏差 |
|
||||||
|
+============+=========+=========+========+
|
||||||
|
| 总价格 (元/吨) | 2385.53 | 2054.93 | 330.60 |
|
||||||
|
+------------+---------+---------+--------+
|
||||||
|
| 一斤饲料价格 (元) | 1.19 | 1.03 | 0.16 |
|
||||||
|
+------------+---------+---------+--------+
|
||||||
|
|
||||||
|
所有结果已存至 results/ 文件夹
|
||||||
|
|
||||||
|
进程已结束,退出代码为 0
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user