CPXXwriteprob and CPXwriteprob

The routine CPXXwriteprob/CPXwriteprob writes a CPLEX problem object to a file in one of the formats in the table.

int  CPXXwriteprob( CPXCENVptr env, CPXCLPptr lp, char const * filename_str, char const * filetype )

int  CPXwriteprob( CPXCENVptr env, CPXCLPptr lp, char const * filename_str, char const * filetype )

Description

The routine CPXXwriteprob/CPXwriteprob writes a CPLEX problem object to a file in one of the formats in the table. These formats are documented in the CPLEX File Formats Reference Manual and examples of their use appear in the CPLEX User's Manual.

Table 1. File formats
SAV Binary matrix and basis file
MPS MPS format
LP CPLEX LP format with names modified to conform to LP format
REW MPS format, with all names changed to generic names
RLP LP format, with all names changed to generic names
ALP LP format, with generic name of each variable, type of each variable, bound of each variable

When this routine is invoked, the current problem is written to a file. If the file name ends with one of the following extensions, a compressed file is written.

  • .bz2 for files compressed with BZip2.
  • .gz for files compressed with GNU Zip.

Arguments

env
A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.
lp
A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
filename_str
A character string containing the name of the file to which the problem is to be written, unless otherwise specified with the filetype argument. If the file name ends with .gz or .bz2, a compressed file is written in accordance with the selected file type.
filetype
A character string containing the type of the file, which can be one of the values in the table. May be NULL, in which case the type is inferred from the file name. The string is not case sensitive.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


status = CPXwriteprob (env, lp, "myprob.sav", NULL);

See also the example lpex1.c in the CPLEX User's Manual and in the standard distribution.