-->

How to check whether the model coded in CPLEX in .

2019-08-12 02:06发布

问题:

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.