【问题标题】:Excel Solver - price per serving change after unit 5Excel Solver - 单位 5 后每份的价格变化
【发布时间】:2019-09-29 13:55:50
【问题描述】:

我创建了以下 excel 文件,该文件使用求解器根据卡路里、脂肪、蛋白质和碳水化合物的限制提出最便宜的饮食。 File here

我想添加另一个约束条件,在第五个单位之后,土豆的价格变为 0.40 而不是 0.15。这个约束在excel中是如何线性建模的?

谢谢

【问题讨论】:

    标签: excel linear-programming solver


    【解决方案1】:

    这可以建模为:

     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 个很贵,之后更便宜)也很常见(批量折扣)。这有点难以建模(需要二进制变量)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-17
      • 1970-01-01
      • 1970-01-01
      • 2015-04-24
      • 1970-01-01
      相关资源
      最近更新 更多