write_basis

# write_basis Writes current basis to a file. unsigned char write_basis(lprec *lp, char *filename); Return Value Returns TRUE if basis could be written to filename and FALSE if not. A FALSE return value indicates an error. Specifically file could not be opened or not able to write in file. Parameters lp Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI filename Filename to write the basis to. Remarks The write_basis function writes the current basis to filename. This basis can later be reused by read_basis to reset a basis. Setting an initial basis can speed up the solver considerably. It is the starting point from where the algorithm continues to find an optimal solution. When a restart is done, lp_solve continues at the last basis, except if set_basis, default_basis, guess_basis or read_basis is called. The basis in the file is written in MPS bas file format. When filename is NULL, then output is written to output set by set_outputstream, set_outputfile. By default this is stdout. Example
    #include <stdio.h>
    #include <stdlib.h>
    #include "lp_lib.h"

    int main(void)
    {
      lprec *lp;
      int ret;

      /* Read LP model */
      lp = read_LP("model.lp", NORMAL, "test model");
      if(lp == NULL) {
        fprintf(stderr, "Unable to create new LP model\n");
        return(1);
      }

      ret = solve(lp);

      ret = write_basis(lp, "model.bas", NULL);

      delete_lp(lp);
      return(0);
    }
lp_solve API reference See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_basis, set_basis, default_basis, read_basis, guess_basis, get_basiscrash, set_basiscrash