excel - Excel Solver - 单位 5 后每份的价格变化
问题描述
我创建了以下 excel 文件,该文件使用求解器根据卡路里、脂肪、蛋白质和碳水化合物的限制提出最便宜的饮食。在这里归档
我想添加另一个约束条件,在第五个单位之后,土豆的价格变为 0.40 而不是 0.15。这个约束如何在 excel 中以线性方式建模?
谢谢
解决方案
这可以建模为:
potatoes = cheap_potatoes + expensive_potatoes
cheap_potatoes <= 5
potatoes, cheap_potatoes, expensive_potatoes >= 0
在目标函数中,替换0.15*potatoes
为0.15*cheap_potatoes + 0.4*expensive_potatoes
。由于cheap_potatoes
更便宜,目标(成本最小化)将自动尝试首先使用这些。
这在您的电子表格中实施应该不会太难。
PS。反过来(前 5 个很贵,之后更便宜)也很常见(批量折扣)。这有点难以建模(需要二进制变量)。
推荐阅读
- mysql - MySql 中的规范化和表
- c# - 'private (string, object)[] s;' 是什么意思?意思/做?
- javascript - 比较数组和过滤器,使用 MongoDB 聚合
- numpy - NumPy 中的 SVG 像素合成操作
- vb.net - Google.Analytics.Data.V1Alpha - 属性“daterange”只读
- csv - AWK:根据两列信息过滤数据
- python - LSTM 上的 Pytorch 修剪会增加模型大小?
- javascript - (Javascript)刷新页面后元素消失
- docker-compose - docker-compose 使用的环境文件如何跨生命周期环境进行管理
- python - plotly:如何在带分类 x 轴的条形图中添加不同的垂直线