# GRBwrite

Filter Content By
Version
Languages

### GRBwrite

 int GRBwrite ( GRBmodel *model, const char *filename )

This routine is the general entry point for writing optimization data to a file. It can be used to write optimization models, solutions vectors, basis vectors, start vectors, or parameter settings. The type of data written is determined by the file suffix. File formats are described in the File Format section.

Note that writing a model to a file will process all pending model modifications. However, writing other model information (solutions, bases, etc.) will not.

Return value:

A non-zero return value indicates that a problem occurred while writing the file. Refer to the Error Code table for a list of possible return values. Details on the error can be obtained by calling GRBgeterrormsg.

Arguments:

model: The model containing the data to be written.

filename: The name of the file to be written. The file type is encoded in the file name suffix. Valid suffixes are .mps, .rew, .lp, or .rlp for writing the model itself, .ilp for writing just the IIS associated with an infeasible model (see GRBcomputeIIS for further information), .sol for writing the current solution, .mst for writing a start vector, .hnt for writing a hint file, .bas for writing an LP basis, or .prm for writing modified parameter settings. The files can be compressed, so additional suffixes of .gz, .bz2, or .7z are accepted.

Example usage:

  error = GRBwrite(model, "/tmp/model.rlp.gz");