XPRSaddrows


Purpose
Allows rows to be added to the matrix after passing it to the Optimizer using the input routines.
Synopsis
int XPRS_CC XPRSaddrows(XPRSprob prob, int newrow, int newnz, const char qrtype[], const double rhs[], const double range[], const int mstart[], const int mclind[], const double dmatval[]);
Arguments
prob 
The current problem.
newrow 
Number of new rows.
newnz 
Number of new nonzeros in the added rows.
qrtype 
Character array of length newrow containing the row types:
indicates a Maths/leq.png row;
indicates Maths/geq.png row;
indicates an = row.
indicates a range constraint;
indicates a nonbinding constraint.
rhs 
Double array of length newrow containing the right hand side elements.
range 
Integer array of length newrow containing the offsets in the mclind and dmatval arrays of the start of the elements for each row. This may be NULL if there are no ranged constraints. The values in the range array will only be read for R type rows. The entries for other type rows will be ignored.
mstart 
Integer array of length newrow+1 containing the offsets in the mclind and dmatval arrays of the start of the elements for each row.
mclind 
Integer array of length newnz containing the (contiguous) column indices for the elements in each row.
dmatval 
Double array of length newnz containing the (contiguous) element values.
Related Controls
Integer
Number of extra matrix elements to be allowed for.
Number of extra rows to be allowed for.

Double
Zero tolerance on matrix elements.

Example
Suppose the current problem was:

maximize: 2x + y + 3z
subject to: x + 4y + 2z Maths/leq.png 24
y + z Maths/leq.png 5
3x + y Maths/leq.png 20
x + y + 3z Maths/leq.png 9

Then the following adds the row 8x + 9y + 10z Maths/leq.png 25 to the problem and names it NewRow:
qrtype[0] = "L";
rhs[0] = 25.0;
mstart[] = {0, 3};
mclind[] = {0, 1, 2};
dmatval[] = {8.0, 9.0, 10.0};
...
XPRSaddrows(prob,1,3,qrtype,rhs,NULL,mstart,mclind, dmatval);
XPRSaddnames(prob,1,"NewRow",4,4);
Further information
For maximum efficiency, space for the extra rows and elements should be reserved by setting the EXTRAROWS and EXTRAELEMS controls before loading the problem.
Related topics
XPRSaddcols, XPRSaddcuts, XPRSaddnames, XPRSdelrows.


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.