Initializing help system before first use

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:
indicates a ≤ row;
indicates a ≥ 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.
p_ncoefs 
Pointer to the integer where the number of elements in the colind and rowcoef arrays will be returned.
colind 
Integer array which will be filled with the column indices of the presolved row. It must be allocated to hold at least COLS elements.
rowcoef 
Double array which will be filled with the coefficients of the presolved row. It must be allocated to hold at least COLS elements.
p_rhs 
Pointer to the double where the presolved right-hand side will be returned.
p_status 
Status of the presolved row:
-3 
Failed to presolve the row due to presolve dual reductions;
-2 
Failed to presolve the row due to presolve duplicate column reductions;
-1 
Failed to presolve the row due to an error. Check the Optimizer error code for the cause;
The row was successfully presolved;
The row was presolved, but may be relaxed.
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.0 };
char rowtype = 'L';
double origrhs = 1.0;
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. This function applies to linear and convex quadratic (including second order conic) problems only.
2. 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.
3. 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.
4. 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-2025 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.