我使用 C# 在 CPLEX 中编写了一个 MIP。我声明了变量和约束并添加了目标,但我无法得到正确的答案。有没有办法将模型打印到字符串变量或类似的东西中,以检查我是否正确编码了我想要的模型?
最佳答案
您可以尝试将其导出为人类可读的 CPLEX LP 格式。
我既不使用 CPLEX 也不使用 .NET,但是根据 this website您正在寻找的功能是:
LOG CPLEX .NET Reference Manual
Cplex.ExportModel
MethodWrites the active model to the file specified by filename.
public virtual void ExportModel( String name );
Parameters
name
The name of the file to which the model is written. The extension of the filename determines the format in which to write the model file.Remarks
The file format is determined by the extension of the filename. The following extensions are recognized on most platforms:
.sav .mps .Lp [...]
希望这对您有所帮助。
关于c# - 如何检查.NET中用CPLEX编码的模型是否是真实模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23447636/