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_KNAPSACK (128) Simplification of knapsack-type constraints through addition of an extra variable, which also helps bound the OF
PRESOLVE_ELIMEQ2 (256) Direct substitution of one variable in 2-element equality constraints; this requires changes to the constraint matrix. Elimeq2 simply eliminates a variable by substitution when you have 2-element equality constraints. This can sometimes cause fill-in of the constraint matrix, and also be a source of rounding errors which can lead to problems in the simplex.
PRESOLVE_IMPLIEDFREE (512) Identify implied free variables (releasing their explicit bounds)
PRESOLVE_REDUCEGCD (1024) Reduce (tighten) coefficients in integer models based on GCD argument. Reduce GCD is for mixed integer programs where it is possible to adjust the constraint coefficies due to integrality. This can cause the dual objective ("lower bound") to increase and may make it easier to prove optimality.
PRESOLVE_PROBEFIX (2048) Attempt to fix binary variables at one of their bounds
PRESOLVE_PROBEREDUCE (4096) Attempt to reduce coefficients in binary models
PRESOLVE_ROWDOMINATE (8192) Idenfify and delete qualifying constraints that are dominated by others, also fixes variables at a bound
PRESOLVE_COLDOMINATE (16384) Deletes variables (mainly binary), that are dominated by others (only one can be non-zero)
PRESOLVE_MERGEROWS (32768) Merges neighboring >= or <= constraints when the vectors are otherwise relatively identical into a single ranged constraint
PRESOLVE_IMPLIEDSLK (65536) Converts qualifying equalities to inequalities by converting a column singleton variable to slack. The routine also detects implicit duplicate slacks from inequality constraints, fixes and removes the redundant variable. This latter removal also tends to reduce the risk of degeneracy. The combined function of this option can have a dramatic simplifying effect on some models. Implied slacks is when, for example, there is a column singleton (with zero OF) in an equality constraint. In this case, the column can be deleted and the constraint converted to a LE constraint.
PRESOLVE_COLFIXDUAL (131072) Variable fixing and removal based on considering signs of the associated dual constraint. Dual fixing is when the (primal) variable can be fixed due to the implied value of the dual being infinite.
PRESOLVE_BOUNDS (262144) Does bound tightening based on full-row constraint information. This can assist in tightening the OF bound, eliminate variables and constraints. At the end of presolve, it is checked if any variables can be deemed free, thereby reducing any chance that degeneracy is introduced via this presolve option.
PRESOLVE_DUALS (524288) Calculate duals
PRESOLVE_SENSDUALS (1048576) Calculate sensitivity if there are integer variables

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

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, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_presolveloops, set_presolve, is_presolve