XPRSpresolverow
Purpose
Presolves a row formulated in terms of the original variables such that it can be added to a presolved matrix.
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.
|
||||||||||
|
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:
|
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 example
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 e.g. branching bounds or constraints, then dual reductions and duplicate column reductions should be disabled, by clearing the corresponding bits of
PRESOLVEOPS. By clearing these bits, the default value for
PRESOLVEOPS changes to 471.
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-2023 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.
