Initializing help system before first use

problem.presolverow

problem.presolverow


Purpose
Presolves a row formulated in terms of the original variables such that it can be added to a presolved problem. Returns a tuple of two elements containing, respectively, the presolved right-hand side and the 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;
  • 0: The row was successfully presolved;
  • 1: The row was presolved, but may be relaxed.

Synopsis
drhsp, status = problem.presolverow (qrtype, mcolso, dvalo, drhso, maxcoeffs, mcolsp, dvalp)
Arguments
qrtype 
The type of the row:
indicates a ≤ row;
indicates a ≥ row.
mcolso 
Array containing the column indices of the row to presolve.
dvalo 
Array containing the non-zero coefficients of the row to presolve.
drhso 
The right-hand side constant of the row to presolve.
maxcoeffs 
Maximum number of elements to return in the mcolsp and dvalp arrays.
mcolsp 
Array which will be filled with the column indices of the presolved row.
dvalp 
Array which will be filled with the coefficients of the presolved row.
Example
Adding the row 2x 1 + x 2 ≤ 1 to our presolved problem can be done as follows:
presind = []
prescoe = []
prhs, status = p.presolverow ('L', [1,2], [2,1], 1.0,
   p.attributes.cols, presind, prescoe)
Further information

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 problem.presolverow 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.

If problem.presolverow is 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.

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 problem.loadsecurevecs function. This way the Optimizer is left free to apply all possible reductions to the remaining columns.


Related topics