XPRSpresolverow
Purpose
Presolves a row formulated in terms of the original variables such that it can be added to a presolved matrix.
Topic areas
Synopsis
int XPRS_CC XPRSpresolverow(XPRSprob prob, char rowtype, int norigcoefs, const int origcolind[], const double origrowcoef[], double origrhs, int maxcoefs, int * p_ncoefs, int colind[], double rowcoef[], double * p_rhs, int * p_status);
Arguments
|
prob
|
The current problem.
|
||||||||||||||
|
rowtype
|
The type of the row:
|
||||||||||||||
|
norigcoefs
|
Number of elements in the
origcolind and
origrowcoef arrays.
|
||||||||||||||
|
origcolind
|
Integer array of length
norigcoefs containing the column indices of the row to presolve.
|
||||||||||||||
|
origrowcoef
|
Double array of length
norigcoefs containing the non-zero coefficients of the row to presolve.
|
||||||||||||||
|
origrhs
|
The right-hand side constant of the row to presolve.
|
||||||||||||||
|
maxcoefs
|
Maximum number of elements to return in the
colind and
rowcoef arrays. The function will not write more elements than this to
colind or
rowcoef, even if the presolved row is longer.
|
||||||||||||||
|
p_ncoefs
|
Pointer to the integer where the number of non-zero elements in the presolved row will be returned (this may be bigger than
maxcoefs).
|
||||||||||||||
|
colind
|
|||||||||||||||
|
rowcoef
|
|||||||||||||||
|
p_rhs
|
Pointer to the double where the presolved right-hand side will be returned.
|
||||||||||||||
|
p_status
|
Status of the presolved row:
May be
NULL if not required.
|
Related controls
Integer
|
Turns presolve on or off.
|
|
|
Selects the presolve operations.
|
Example
Suppose we want to add the row 2x
1 + x
2 ≤ 1 to our presolved matrix. This could be done in the following way:
int mindo[] = { 1, 2 };
int origrowcoef[] = { 2.0, 1 };
char rowtype = 'L';
double origrhs = 1;
int ncols, ncoefs, status, mtype, mstart[2], *mindp;
double rhs, *rowcoef;
...
XPRSgetintattrib(prob, XPRS_COLS, &ncols);
mindp = (int*) malloc(ncols*sizeof(int));
rowcoef = (double*) malloc(ncols*sizeof(double));
XPRSpresolverow(prob, rowtype, 2, mindo, origrowcoef, origrhs, ncols,
&ncoefs, mindp, rowcoef, &rhs, &status);
if (status >= 0) {
mtype = 0;
mstart[0] = 0; mstart[1] = ncoefs;
XPRSaddcuts(prob, 1, &mtype, &rowtype, &rhs, mstart, mindp,
rowcoef);
}
See also examples
els_usercuts.c, tsp.c.
Further information
1. There are certain presolve operations that can prevent a row from being presolved exactly. If the row contains a coefficient for a column that was eliminated due to duplicate column reductions or singleton column reductions, the row might have to be relaxed to remain valid for the presolved problem. The relaxation will be done automatically by the XPRSpresolverow function, but a return status of
+1 will be returned. If it is not possible to relax the row, a status of
-2 will be returned instead. Likewise, it is possible that certain dual reductions prevents the row from being presolved. In such a case a status of -3 will be returned instead. Also transforming a convex quadratic objective transfer row to a convex quadratic objective and nonlinear eliminations will lead to a row not being presolved and return a status of -5 instead.
2. If
XPRSpresolverow will be used for presolving hard constraints, such as e.g. branching bounds or delayed constraints, then dual reductions should be disabled, by setting
MIPDUALREDUCTIONS to 0.
3. If the user knows in advance which columns will have non-zero coefficients in rows that will be presolved, it is possible to protect these individual columns through the
XPRSloadsecurevecs function. This way the Optimizer is left free to apply all possible reductions to the remaining columns.
Related topics
© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation ("FICO"). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.
