How to check whether the model coded in CPLEX in .NET is the true model?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 01:26:25

问题


I coded an MIP in CPLEX with C#. I declared variables and constraints and added the objective but I cannot get the correct answer. Is there a way to print the model into a string variable or something like in order to check whether I coded correctly the model I had in mind?


回答1:


You could try exporting it in CPLEX LP format, that is human readable.

I use neither CPLEX nor .NET, but according this website the function you are looking for is:

LOG CPLEX .NET Reference Manual Cplex.ExportModel Method

Writes 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
[...]

Hope this helps.



来源:https://stackoverflow.com/questions/23447636/how-to-check-whether-the-model-coded-in-cplex-in-net-is-the-true-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!