我在Windows命令行上使用CBC来解决混合整数线性规划问题,它在合理的时间内解决了这个问题,效果很好。
但是,我不知道如何让CBC打印构成最优解的变量的值。
发布于 2014-05-14 21:36:41
如果我正确理解了CBC User Guide中的this示例,那么您可以使用const double * CbcModel::bestSolution()函数来获取解决方案变量。
此外,您应该能够通过使用以下函数来识别每个变量的上下文:
bool isBinary(int colIndex) const
bool isContinuous(int colIndex) const
bool isInteger(int colIndex) const发布于 2016-04-12 03:51:51
使用
solu sol.txt这将把解决方案写入一个名为sol.txt的文件中。您在文件中看不到的变量取值为零。
https://stackoverflow.com/questions/23654308
复制相似问题