Returns if presolve level specified in testmask is active.

unsigned char is_presolve(lprec *lp, int testmask);

Return Value

is_presolve returns TRUE or FALSE.



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


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. This is no longer active since it is very rare that this is effective, and also that it adds code complications and delayed presolve effects that are not captured properly.
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


The is_presolve function returns a flag if the presolve level specified in testmask is active. 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 (FALSE) doing a presolve.


#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");

  presolve = is_presolve(lp, PRESOLVE_ROWS | PRESOLVE_COLS); /* Will return FALSE */


lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_presolve, get_presolve, get_presolveloops