Purpose
Allows columns to be added to the
matrix after passing it to the Optimizer using the input routines.
Synopsis
int XPRS_CC XPRSaddcols(XPRSprob prob, int newcol, int newnz, const double objx[], const int mstart[], const int mrwind[],
const double dmatval[], const double bdl[], const double bdu[]);
Arguments
prob
|
The current problem.
|
newcol
|
Number of new columns.
|
newnz
|
Number of new nonzeros in the added columns.
|
objx
|
Double array of length newcol containing the objective function coefficients of the new columns.
|
mstart
|
Integer array of length newcol+1 containing the offsets in the mrwind and dmatval arrays of the start of the elements for each column.
|
mrwind
|
Integer array of length newnz containing the row indices for the elements in each column.
|
dmatval
|
Double array of length newnz containing the element values.
|
bdl
|
Double array of length newcol containing the lower bounds on the added columns.
|
bdu
|
Double array of length newcol containing the upper bounds on the added columns.
|
Related Controls
Integer
|
Number of extra columns to be allowed for.
|
|
Number of extra matrix elements to be allowed for.
|
|
Number of extra global entities to be allowed for.
|
Double
|
Zero tolerance on matrix elements.
|
Example
Using
XPRSaddcols, the following transforms (a) into (b) and then names the new variable using
XPRSaddnames:
obj[0] = 3;
mstart[] = {0, 3};
mrwind[] = {0, 1, 3};
matval[] = {2.0, 1.0, 3.0};
bdl[0] = 0.0; bdu[0] = 12.0;
...
XPRSaddcols(prob,1,3,obj,mstart,mrwind,matval,bdl,bdu);
XPRSaddnames(prob,2,"z",2,2);
Further information
1. For maximum efficiency, space for the extra rows and elements should be reserved
by setting the
EXTRACOLS,
EXTRAELEMS and
EXTRAMIPENTS controls before loading the problem.
2. The double constants
XPRS_PLUSINFINITY and
XPRS_MINUSINFINITY defined in
the library header file can be used to represent plus and minus
infinity
respectively in the bound arrays.
3. If the columns are added to a MIP problem then they will be continuous variables.
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.