Previous Page: CPXreadcopyorderFirst PageNext Page: CPXreadcopyqp

CPXreadcopyprob


Description

This routine reads in an MPS, LP or SAV file into an existing CPLEX LP problem object. Any existing data associated with the problem object is destroyed. The problem can then be optimized via any one of the optimization routines. To determine the contents of the data, CPLEX query routines can be used.

The type of the file may be specified with the filetype argument. When the filetype argument is NULL, the end of the file name is checked for one of the strings .lp, .mps, .sav, .lp, .lp.gz, .lp.z, .mps, mps.gz, .mps.z, .sav, .sav.gz, or .sav.z.

If one of these strings is present, filetype is set accordingly. If filetype is NULL and none of these strings is at the end of the file name, the routine will automatically detect the type of the file by examining the first few bytes of the file.

Return Value

The routine returns a zero on success, and a nonzero if an error occurs.

Synopsis

int CPXreadcopyprob (CPXENVptr env,
                     CPXLPptr lp,
                     char *filename,
                     char *filetype);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX routines.

CPXLPptr lp
A pointer to a CPLEX LP problem object as returned by CPXcreateprob().

char *filename
The name of the file from which the problem should be read.

If the file name ends in .gz or .z the file will be read as a compressed file. Thus, a file name ending in .sav will be read as a SAV format file, while a file name ending in .sav.gz will be read as a compressed SAV format file.

If the file name does not end with a recognized type, CPLEX will attempt to auto-detect the file type.

char *filetype
A case insensitive string containing the type of the file. One of the following strings:

"SAV"  
Use SAV format  
"MPS"  
Use MPS format  
"LP"  
Use LP format  

This parameter may be NULL, in which case the file type is inferred from the last characters of the file name.

Example

status = CPXreadcopyprob (env, lp, "myprob.mps", NULL);

See Also

Example lpex2.c in the CPLEX User's Manual.

Previous Page: CPXreadcopyorderFirst PageNext Page: CPXreadcopyqp