CPXXcopylpwnames and CPXcopylpwnames

The routine CPXXcopylpwnames/CPXcopylpwnames copies LP data into a CPLEX problem object in the same way as the routine CPXXcopylp/CPXcopylp, but CPXXcopylpwnames/CPXcopylpwnames accepts additional arguments to specify the names of constraints and variables in the CPLEX problem object.

int  CPXXcopylpwnames( CPXCENVptr env, CPXLPptr lp, CPXDIM numcols, CPXDIM numrows, int objsense, double const * objective, double const * rhs, char const * sense, CPXNNZ const * matbeg, CPXDIM const * matcnt, CPXDIM const * matind, double const * matval, double const * lb, double const * ub, double const * rngval, char const *const * colname, char const *const * rowname )

int  CPXcopylpwnames( CPXCENVptr env, CPXLPptr lp, int numcols, int numrows, int objsense, double const * objective, double const * rhs, char const * sense, int const * matbeg, int const * matcnt, int const * matind, double const * matval, double const * lb, double const * ub, double const * rngval, char ** colname, char ** rowname )

Description

The routine CPXXcopylpwnames/CPXcopylpwnames copies LP data into a CPLEX problem object in the same way as the routine CPXXcopylp/CPXcopylp, but CPXXcopylpwnames/CPXcopylpwnames accepts additional arguments to specify the names of constraints and variables in the CPLEX problem object. That is, unlike the routine CPXXcopylp/CPXcopylp, CPXXcopylpwnames/CPXcopylpwnames also copies names. The arguments to CPXXcopylpwnames/CPXcopylpwnames define an objective function, constraint matrix, variable bounds, righthand side constraint senses, range values, names of constraints, and names of variables.

Table 1. Settings for objsense
objsense = 1 (CPX_MIN) minimize
objsense = -1 (CPX_MAX) maximize

Table 2. Settings for sense
sense[i] 'L' <= constraint
sense[i] 'E' = constraint
sense[i] 'G' >= constraint
sense[i] 'R' ranged constraint

With respect to the arguments matbeg (beginning of the matrix), matcnt (count of the matrix), matind (indices of the matrix), and matval (values of the matrix), CPLEX needs to know only the nonzero coefficients. These are grouped by column in the array matval. The nonzero elements of every column must be stored in sequential locations in this array with matbeg[j] containing the index of the beginning of column j and matcnt[j] containing the number of entries in column j. The components of matbeg must be in ascending order. For each k, matind[k] specifies the row number of the corresponding coefficient, matval[k].

These arrays are accessed as follows. Suppose that CPLEX wants to access the entries in some column j. These are assumed to be given by the array entries:


matval[matbeg[j]],.., matval[matbeg[j]+matcnt[j]-1]

The corresponding row indices are:


matind[matbeg[j]],.., matind[matbeg[j]+matcnt[j]-1]

Entries in matind are not required to be in row order. Duplicate entries in matind and matval within a single column are not allowed. The length of the arrays matbeg and matind should be at least numcols. The length of arrays matind and matval should be at least matbeg[numcols-1]+matcnt[numcols-1].

The arrays matbeg and matcnt may be NULL if one of numcols or numrows is 0 (zero); that is, if one dimension the matrix is 0 (zero) and can not contain any coefficients.

When you build or modify your problem with this routine, you can verify that the results are as you intended by calling CPXcheckcopylpwnames during application development.

Arguments

env
A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.
lp
A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
numcols
An integer that specifies the number of columns in the constraint matrix, or equivalently, the number of variables in the problem object.
numrows
An integer that specifies the number of rows in the constraint matrix, not including the objective function or bounds on the variables.
objsense
An integer that specifies whether the problem is a minimization or maximization problem. Table 1 shows its possible settings.
objective
An array of length at least numcols containing the objective function coefficients. This argument may be NULL.
rhs
An array of length at least numrows containing the righthand side value for each constraint in the constraint matrix. This argument may be NULL.
sense
An array of length at least numrows containing the sense of each constraint in the constraint matrix. Table 2 shows the possible settings. This argument may be NULL.
matbeg
An array that defines the constraint matrix. This argument may be NULL.
matcnt
An array that defines the constraint matrix. This argument may be NULL.
matind
An array that defines the constraint matrix. This argument may be NULL.
matval
An array that defines the constraint matrix. This argument may be NULL.
lb
An array of length at least numcols containing the lower bound on each of the variables. This argument may be NULL. Any lower bound that is set to a value less than or equal to that of the constant -CPX_INFBOUND is treated as negative infinity. CPX_INFBOUND is defined in the header file cpxconst.h.
ub
An array of length at least numcols containing the upper bound on each of the variables. This argument may be NULL. Any upper bound that is set to a value greater than or equal to that of the constant CPX_INFBOUND is treated as infinity. CPX_INFBOUND is defined in the header file cpxconst.h.
rngval
An array of length at least numrows containing the range value of each ranged constraint. Ranged rows are those designated by R in the sense array. If the row is not ranged, the rngval array entry is ignored. If rngval[i] > 0, then row i activity is in [rhs[i],rhs[i]+rngval[i]], and if rngval[i] <= 0, then row i activity is in [rhs[i]+rngval[i],rhs[i]]. This argument may be NULL.
colname
An array of length at least numcols containing pointers to character strings. Each string is terminated with the NULL character. These strings represent the names of the matrix columns or, equivalently, the variable names. May be NULL if no names are associated with the variables. If colname is not NULL, every variable must be given a name. The addresses in colname do not have to be in ascending order.
rowname
An array of length at least numrows containing pointers to character strings. Each string is terminated with the NULL character. These strings represent the names of the matrix rows or, equivalently, the constraint names. May be NULL if no names are associated with the constraints. If rowname is not NULL, every constraint must be given a name. The addresses in rowname do not have to be in ascending order.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


status = CPXcopylpwnames (env,
		   lp,
		   numcols,
		   numrows,
		   objsen,
		   obj,
		   rhs,
		   sense,
		   matbeg,
		   matcnt,
		   matind,
		   matval,
		   lb,
		   ub,
		   rngval,
		   colname,
		   rowname);