【问题标题】:Mixed Linear Integer Programming using Coin-OR CBC使用 Coin-OR CBC 的混合线性整数规划
【发布时间】:2014-05-14 12:07:56
【问题描述】:

我在 Windows 命令行上使用 CBC 来解决混合整数线性规划问题,该问题非常有效,因为它可以在合理的时间内解决问题。

但是,我不知道如何让 CBC 打印形成最佳解决方案的变量值。

【问题讨论】:

    标签: mathematical-optimization linear-programming coin-or-cbc


    【解决方案1】:

    如果我正确理解了CBC User Guide 中的this 示例,您可以使用const double * CbcModel::bestSolution() 函数获得解决方案变量。

    此外,您应该能够使用以下函数识别每个变量的上下文:

    bool isBinary(int colIndex) const
    bool isContinuous(int colIndex) const
    bool isInteger(int colIndex) const
    

    【讨论】:

      【解决方案2】:

      使用

      solu sol.txt
      

      这会将解决方案写入名为 sol.txt 的文件中。您在文件中看不到的变量取值为零。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-11-21
        • 1970-01-01
        • 1970-01-01
        • 2018-03-25
        相关资源
        最近更新 更多