xprs_loadproblemdata
xprs_loadproblemdata(prob = NULL, problemdata)
prob
|
an XPRSprob object, or NULL to create a new one
|
problemdata
|
a named list that describes the input data. The 'problemdata' understands all input arguments of the function XPRSloadmiqcqp. See the details below.
|
# We load and solve the following Linear Program with 2 variables and 2 constraints. # min x_1 + x_2 # 5 x_1 + x_2 >= 7 # x_1 + 4 x_2 >= 9 # x_1,x_2 >= 0 library(xpress) # create a list object to hold all input problemdata <- list() # objective coefficients problemdata$objcoef <- c(1,1) # row coefficients problemdata$A <- matrix(c(5,1,1,4), nrow=2, byrow=TRUE) # right-hand side problemdata$rhs <- c(7,9) # row sense problemdata$rowtype <- c("G", "G") # lower bounds (defaulting to 0 if unspecified) problemdata$lb <- c(0,0) # upper bounds(defaulting to Inf if unspecified) problemdata$ub <- c(Inf,Inf) # names for writing to MPS/LP files problemdata$colname <- c("x_1", "x_2") # Problem Name displayed when the solver solves the problem. problemdata$probname <- "FirstExample" # load everything into a new XPRSprob 'p'. You may also use the equivalent # # p <- createprob() # xprs_loadproblemdata(p, problemdata=problemdata) # # for convenience and the use inside pipes, # xprs_loadproblemdata returns the prob pointer. # p <- xprs_loadproblemdata(problemdata=problemdata)
- ncols
- Number of structural columns in the matrix. This is optional and usually inferred from 'lb', 'ub', and 'objcoef' problemdata attributes
- nrows
- Number of rows in the matrix (not including the objective row). This is optional and usually inferred from 'rowtype', 'rhs', and 'rng' problemdata attributes
- start
- 0-based(!) integer array containing the offsets in the rowind and rowcoef arrays of the start of the elements for each column. This array is of length ncols or, if collen is NULL, length ncols+1. If collen is NULL the extra entry of start, start[ncols+1], contains the position in the rowind and rowcoef arrays at which an extra column would start, if it were present. In C, this value is also the length of the rowind and rowcoef arrays
- collen
- Integer array of length ncols containing the number of nonzero elements in each column. May be NULL if all elements are contiguous and start[ncols+1] contains the offset where the elements for column ncols+1 would start. This array is not required if the non-zero coefficients in the rowind and rowcoef arrays are continuous, and the start array has ncols+1 entries as described above. It may be NULL if not required
- rowind
- Integer array containing the 0-based(!) 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 rowind is start[ncols]+collen[ncols] or, if collen is NULL, start[ncols+1].
- rowcoef
- Double array containing the nonzero element values; length as for rowind
- A
- a dense or sparse matrix (column major or sparse triplet format) to input the linear constraint coefficients.
- rhs
- Double array of length nrows containing the right hand side coefficients of the rows. The right hand side value for a rng row gives the upper bound on the row
- rowtype
-
String array of length 'nrows' containing the row types:
- "L"
- indicates a '<=' constraint (use this one for quadratic constraints as well)
- "E"
- indicates an '=' constraint
- "G"
- indicates a '>=' constraint
- "R"
- indicates a rng constraint
- "N"
- indicates a nonbinding constraint
- rng
- Double array of length nrows containing the rng values for rng rows. Values for all other rows will be ignored. May be NULL if there are no ranged constraints. The lower bound on a rng row is the right hand side value minus the rng value. The sign of the rng value is ignored - the absolute value is used in all cases
- objcoef
- Double array of length 'ncols' containing the objective function coefficients
- lb
- Double array of length 'ncols' containing the lower bounds on the columns. Use XPRS_MINUSINFINITY to represent a lower bound of minus infinity
- ub
- Double array of length 'ncols' containing the upper bounds on the columns. Use XPRS_PLUSINFINITY to represent an upper bound of plus infinity
- nentities
- Number of binary, integer, semi-continuous, semi-continuous integer and partial integer entities. This is optional, as it can be inferred from 'gqtype', and 'entind'
- coltype
-
Character array of length nentities containing the entity types
- "B"
- binary variables
- "I"
- integer variables
- "P"
- partial integer variables
- "S"
- semi-continuous variables
- "R"
- semi-continuous integer variables
- entind
- Integer array of length nentities containing the column indices of the MIP entities
- limit
- Double array of length nentities containing the integer limits for the partial integer variables and lower bounds for semi-continuous and semi-continuous integer variables (any entries in the positions corresponding to binary and integer variables will be ignored). May be NULL if not required
- columntypes
- A single character array of length 'ncols'. Besides the column types for 'coltype', specify all continuous columns by "C"
- columnlimits
- A single numeric array of length 'ncols' to specify limits for partial integer variables and lower bounds for semi-continuous and semi-continuous integer variables. This is not needed if no such types are present
- Qobj
- a dense or sparse matrix (column major or sparse triplet format) to input the quadratic objective terms
- nobjqcoef
- Number of quadratic terms of the objective
- objqcol1
- Integer array of size nobjqcoef containing the 0-based(!) column index of the first variable in each quadratic objective term
- objqcol2
- Integer array of size nobjqcoef containing the 0-based(!) column index of the second variable in each quadratic objective term
- objqcoef
- Double vector of size nobjqcoef containing the quadratic objective coefficients
- Qrowlist
- list of dense or sparse numeric matrices (column major or sparse triplet format) of length 'nrows' that define the quadratic terms in each constraint.
- nqrows
- Number of rows containing quadratic matrices
- qrowind
- Integer vector of size qmn, containing the indices of rows with quadratic matrices in them. Note that the rows are expected to be defined in rowtype as type L
- nrowqcoefs
- Integer vector of size qmn, containing the number of nonzeros in each quadratic constraint matrix
- rowqcol1
- Integer vector of size nqcelem, where nqcelem equals the sum of the elements in nrowqcoefs (i.e. the total number of quadratic matrix elements in all the constraints). It contains the first column indices of the quadratic matrices. Indices for the first matrix are listed from 0 to qcnquads[0]-1, for the second matrix from qcnquads[0] to qcnquads[0]+ qcnquads[1]-1, etc
- rowqcol2
- Integer array of size nqcelem, containing the second index for the quadratic constraint matrices
- rowqcoef
- Double array of size nqcelem, containing the coefficients for the quadratic constraint matrices
- settype
-
Character array of length nsets containing the set types:
- 1
- SOS1 type sets
- 2
- SOS2 type sets
- nsets
- Number of SOS1 and SOS2 sets. This is readily inferred from settype and need not be specified.
- setstart
- Integer array containing the offsets in the setind and refval arrays indicating the start of the sets. This array is of length nsets+1, the last member containing the offset where set nsets+1 would start
- setind
- Integer array of length setstart[nsets]-1 containing the columns in each set
- refval
- Double array of length setstart[nsets]-1 containing the reference row entries for each member of the sets
- probname
- A string of up to MAXPROBNAMELENGTH characters containing a name for the problem
- colname
- (optional) a vector specifying a name for each column of the problem
- rowname
- (optional) a vector specifying a name for each row of the problem
© 2001-2025 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.