XPRSloadlp


Purpose
Enables the user to pass a matrix directly to the Optimizer, rather than reading the matrix from a file.
Synopsis
int XPRS_CC XPRSloadlp(XPRSprob prob, const char *probname, int ncol, int nrow, const char qrtype[], const double rhs[], const double range[], const double obj[], const int mstart[], const int mnel[], const int mrwind[], const double dmatval[], const double dlb[], const double dub[]);
Arguments
prob 
The current problem.
probname 
A string of up to 200 characters containing a names for the problem.
ncol 
Number of structural columns in the matrix.
nrow 
Number of rows in the matrix (not including the objective). Objective coefficients must be supplied in the obj array, and the objective function should not be included in any of the other arrays.
qrtype 
Character array of length nrow containing the row types:
indicates a Maths/leq.png constraint;
indicates an = constraint;
indicates a Maths/geq.png constraint;
indicates a range constraint;
indicates a nonbinding constraint.
rhs 
Double array of length nrow containing the right hand side coefficients of the rows. The right hand side value for a range row gives the upper bound on the row.
range 
Double array of length nrow containing the range values for range rows. Values for all other rows will be ignored. May be NULL if not required. The lower bound on a range row is the right hand side value minus the range value. The sign of the range value is ignored - the absolute value is used in all cases.
obj 
Double array of length ncol containing the objective function coefficients.
mstart 
Integer array containing the offsets in the mrwind and dmatval arrays of the start of the elements for each column. This array is of length ncol or, if mnel is NULL, length ncol+1. If mnel is NULL, the extra entry of mstart, mstart[ncol], contains the position in the mrwind and dmatval arrays at which an extra column would start, if it were present. In C, this value is also the length of the mrwind and dmatval arrays.
mnel 
Integer array of length ncol containing the number of nonzero elements in each column. May be NULL if not required. This array is not required if the non-zero coefficients in the mrwind and dmatval arrays are continuous, and the mstart array has ncol+1 entries as described above. It may be NULL if not required.
mrwind 
Integer array containing the row indices for the nonzero elements in each column. If the indices are input contiguously, with the columns in ascending order, the length of the mrwind is mstart[ncol-1]+mnel[ncol-1] or, if mnel is NULL, mstart[ncol].
dmatval 
Double array containing the nonzero element values; length as for mrwind.
dlb 
Double array of length ncol containing the lower bounds on the columns. Use XPRS_MINUSINFINITY to represent a lower bound of minus infinity.
dub 
Double array of length ncol containing the upper bounds on the columns. Use XPRS_PLUSINFINITY to represent an upper cound of plus infinity.
Related Controls
Integer
Number of extra columns to be allowed for.
Number of extra matrix elements to be allowed for.
Number of extra elements to allow for in presolve.
Number of extra rows to be allowed for.
Status for nonbinding rows.
Type of scaling.

Double
Zero tolerance on matrix elements.

Example
Given an LP problem:

maximize: x + y
subject to: 2x Maths/geq.png 3
x + 2y Maths/geq.png 3
x + y Maths/geq.png 1

the following shows how this may be loaded into the Optimizer using XPRSloadlp:
char probname[] = "small";
int ncol = 2, nrow = 3;
char qrtype[]    = {"G","G","G"};
double rhs[]     = { 3 , 3 , 1 };
double obj[]     = { 1 , 1 };
int mstart[]     = { 0 , 3 , 5 };
int mrwind[]     = { 0 , 1 , 2 , 1 , 2 };
double dmatval[] = { 2 , 1 , 1 , 2 , 1 };
double dlb[]   = { 0 , 0 };
double dub[]   = {XPRS_PLUSINFINITY,XPRS_PLUSINFINITY};

XPRSloadlp(prob, probname, ncol, nrow, qrtype, rhs, NULL, 
           obj, mstart, NULL, mrwind, dmatval, dlb, dub)
Further information
1. The row and column indices follow the usual C convention of going from 0 to nrow-1 and 0 to ncol-1 respectively.
2. The double constants XPRS_PLUSINFINITY and XPRS_MINUSINFINITY are defined in the Optimizer library header file.
3. For a range constraint, the value in the rhs array specifies the upper bound on the constraint, while the value in the range array specifies the range on the constraint. So a range constraint j is interpreted as:

rhsj-|rangej| Maths/leq.png
Maths/sum.png
i
aijxi Maths/leq.png rhsj

Related topics
XPRSloadglobal, XPRSloadqglobal, XPRSloadqp, XPRSreadprob.


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