Purpose
Writes the current
problem to an MPS or LP file.
Synopsis
int XPRS_CC XPRSwriteprob(XPRSprob prob, const char *filename, const char *flags);
WRITEPROB [-flags] [filename]
Arguments
prob
|
The current problem.
|
filename
|
A string of up to 200 characters to contain the file name to which the problem is to be written. If omitted, the default problem_name is used with a .mat extension, unless the l flag is used in which case the extension is .lp.
|
flags
|
Flags, which can be one or more of the following:
p
|
full precision of numerical values;
|
o
|
one element per line;
|
n
|
scaled;
|
s
|
scrambled vector names;
|
l
|
output in LP format;
|
x
|
output MPS file in hexadecimal format.
|
|
Example 1 (Library)
The following example outputs the current problem in full precision, LP format with scrambled vector
names to the file
problem_name.lp.
XPRSwriteprob(prob, "", "lps");
Example 2 (Console)
This instructs the Optimizer to write an MPS matrix to the file
myprob.mat on the C: drive in full precision.
Further information
If
XPRSloadlp,
XPRSloadglobal,
XPRSloadqglobal or
XPRSloadqp is used to obtain a matrix then there is no association between the objective function and the
N rows in the matrix and so a separate
N row
(called
__OBJ___) is created when you do an
XPRSwriteprob (
WRITEPROB).
Also if you do an
XPRSreadprob (
READPROB) and then change either the objective row
or the
N row in the matrix corresponding to the objective row, you lose the association
between the two and the
__OBJ___ row is created when you do an
XPRSwriteprob
(
WRITEPROB). To remove the objective row from the matrix when doing an
XPRSreadprob (
READPROB), set
KEEPNROWS to
-1 before
XPRSreadprob (
READPROB).
The hexadecimal format is useful for saving the exact internal precision of the matrix.
Warning: If
XPRSreadprob (
READPROB) is used to input
a problem, then the input file will be overwritten by
XPRSwriteprob (
WRITEPROB) if a new
filename is not specified.
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.