# Can I export to .cpo file using OPL?

I have a model written in CPLEX OPL. Is there a way to export the model to .cpo extension?

In Python docplex module the syntax is as:

mdl.export_as_cpo()

But I could not find an equivalent command for the OPL in the OPL User's manual.

• Does this address your question ibm.com/support/knowledgecenter/SSSA5P_12.10.0/… ? – Mark L. Stone Dec 22 '19 at 21:46
• @MarkL.Stone Thanks a lot. I think that would work. Probably I have confused .cpo and .ops that I could not find it. – Mostafa Dec 22 '19 at 22:03
• @MarkL.Stone or Mostafa: Since the provided link seems to answer the question, would any of you mind writing that as an answer so that it can be voted/accepted? – EhsanK Dec 27 '19 at 21:14
• @ EhsanK You can have the honor. To produce my comment above, I jdid a couple of sec of Googling and don't know a damn thing about it - hence I asked whether that link addressed the question, because I wasn;t sure. – Mark L. Stone Dec 27 '19 at 21:31

The steps taken from the IBM Knowledge Center are:

• Create a new settings file
• Change the export format to CPO
• Add the settings file to the default run configuration
• Run the run configuration

Thanks to @Mark L. Stone who provided the link.

Other options:

1. Run your model from the command line using oplrun. Using option -d you can specify to dump your model into a cpo file.
2. Specify environment variable ILC_MODEL_DUMP_FILE. Before solving the model CP Optimizer tests this variable and if present it dumps the current model into the specified file (the variable can also specify the path to the file). It works for all applications that are using CP Optimizer, not only for OPL.