An LP file can be exported from OPL in two different ways:
- You can use the
oplrun
command line tool and option -e
to export the file (see here). This will create a file with the specified name.
- In the IDE, you can attach (or modify) a settings file to your run configuration. In that settings file set the export format option to LP. This will create an LP file the name of which is derived from the run configuration name.
In either case, the file will be exported right before the solving starts and a regular solve will ensue. So if you only want to export, you will have to interrupt the solve or set a parameter to stop the solve quickly. For the command line tool oplrun
you can use options like -Xbench
to avoid solving (see oplrun -X
for details).
Parameters are not written to an LP file, so you will have to create parameter settings in a different way. If you plan to solve models on the cloud then it is probably a good idea to create a parameter file with the respective settings.
Note that in general it is better to use the SAV format rather than the LP format, at least if you want to solve with CPLEX. SAV is a binary format. It is an exact representation of the problem. It also is the most compact representation. For LP columns may be reordered, numbers may be truncated, etc. All this may result in slight but unexpected performance differences.
Finally, since you asked for potential alternatives: IBM has a cloud service as well that directly supports solving OPL models from the IDE. Maybe this is an option for you? You can find details about this in the user manual here.