How to check whether the model coded in CPLEX in .

2019-08-12 02:38发布

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条回答
我欲成王,谁敢阻挡
2楼-- · 2019-08-12 02:50

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.

查看更多
登录 后发表回答