get_presolve

Returns if a presolve must be done before solving.

int get_presolve(lprec *lp);

Return Value

get_presolve returns the current presolve setting. Can by the combination (OR) of any of the following values:

PRESOLVE_NONE (0) No presolve at all
PRESOLVE_ROWS (1) Presolve rows
PRESOLVE_COLS (2) Presolve columns
PRESOLVE_LINDEP (4) Eliminate linearly dependent rows
PRESOLVE_SOS (32) Convert constraints to SOSes (only SOS1 handled)
PRESOLVE_REDUCEMIP (64) If the phase 1 solution process finds that a constraint is redundant then this constraint is deleted
PRESOLVE_DUALS (128) Calculate duals
PRESOLVE_SENSDUALS (256) Calculate sensitivity

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

Remarks

The get_presolve function returns if a presolve must be done before solving. Presolve looks at the model and tries to simplify it so that solving times are shorter. For example a constraint on only one variable is converted to a bound on this variable (and the constraint is deleted). Note that the model dimensions can change because of this, so be careful with this. Both rows and columns can be deleted by the presolve.
The default is not (PRESOLVE_NONE) doing a presolve.

Example

#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"

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

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

  presolve = get_presolve(lp); /* returns the current presolve level */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_presolve, is_presolve