write_mps, write_MPS

Write an mps model to a file.

int write_MPS(lprec *lp, FILE *stream);

int write_mps(lprec *lp, char *filename);

Return Value

write_mps and write_MPS return TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS

stream

Pointer to FILE structure.

filename

Filename to write the mps model to.

Remarks

The write_mps and write_MPS functions write the model to filename. write_MPS needs a file pointer to an already opened file. write_mps accepts the name of the file. The latter function will generally be more convenient.

The model in the file will be in mps-format.

Example

#include <stdio.h> 
#include <stdlib.h>
#include "lpkit.h" 
int main(void)
{ 
  lprec *lp;

  /* Create a new LP model */
  lp = make_lp(0, 0);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }
  
  write_mps(lp, "model.mps");
  
  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also delete_lp, copy_lp, make_lp, read_mps, read_MPS, read_lp, read_LP, write_lp, write_LP