XPRSwritesol

WRITESOL


Purpose
Writes the current solution to a CSV format ASCII file, problem_name.asc (and .hdr).
Synopsis
int XPRS_CC XPRSwritesol(XPRSprob prob, const char *filename, const char *flags);
WRITESOL [filename] [-flags]
Arguments
prob 
The current problem.
filename 
A string of up to 200 characters containing the file name to which the solution is to be written. If omitted, the default problem_name will be used. The extensions .hdr and .asc will be appended.
flags 
Flags to control which optional fields are output:
sequence number;
name;
type;
basis status;
activity;
cost (columns), slack (rows);
lower bound;
upper bound;
dj (column; reduced costs), dual value (rows; shadow prices);
right hand side (rows).
If no flags are specified, all fields are output.
Additional flags:
outputs every MIP or goal programming solution saved;
outputs in full precision;
only outputs vectors with nonzero optimum value;
output the current LP solution instead of the MIP solution.
Related Controls
Double
Zero tolerance on print values.

String
Mask to restrict the row and column names output to file.

Example 1 (Library)
In this example the basis status is output (along with the sequence number) following optimization:
XPRSreadprob(prob, "richard", "");
XPRSminim(prob, "");
XPRSwritesol(prob, "", "sb");
Example 2 (Console)
Suppose we wish to produce files containing The Optimizer commands necessary to do this are:
OUTPUTMASK = "X???????"
WRITESOL XVALS -naq
OUTPUTMASK = "CO2?????"
WRITESOL CO2 -nar
Further information
1. The command produces two readable files: filename.hdr (the solution header file) and filename.asc (the CSV foramt solution file). The header file contains summary information, all in one line. The ASCII file contains one line of information for each row and column in the problem. Any fields appearing in the .asc file will be in the order the flags are described above. The order that the flags are specified by the user is irrelevant.
2. Additionally, the mask control OUTPUTMASK may be used to control which names are reported to the ASCII file. Only vectors whose names match OUTPUTMASK are output. OUTPUTMASK is set by default to "????????", so that all vectors are output.
3. If KEEPMIPSOL has been used to store a number of MIP or goal programming solutions, the e flag can be used to output solution information for every solution kept. The best solution found is still output to problem_name.hdr and problem_name.asc. Any other solutions are output to the header files problem_name.hd0, problem_name. hd1,... and ASCII solution files problem_name.as0, problem_name.as1,....
Related topics
XPRSgetlpsol, XPRSgetmipsol, XPRSwriterange (WRITERANGE), XPRSwriteprtsol (WRITEPRTSOL).


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.