is_presolve
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.
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
testmask
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 |
PRESOLVE_IMPLIEDFREE (512) |
Identify implied free variables (releasing their explicit bounds) |
PRESOLVE_REDUCEGCD (1024) |
Reduce (tighten) coefficients in integer models based on GCD argument |
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 |
PRESOLVE_COLFIXDUAL (131072) |
Variable fixing and removal based on considering signs of the associated dual constraint |
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 |
Remarks
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.
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 = is_presolve(lp, PRESOLVE_ROWS | PRESOLVE_COLS); /* Will return FALSE */
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, set_presolve, get_presolve, get_presolveloops
|