NO FRAMES

CPXnewcols

public int CPXnewcols(CPXCENVptr env, CPXLPptr lp, int ccnt, const double * obj, const double * lb, const double * ub, const char * xctype, char ** colname)
Definition file: cplex.h

The routine CPXnewcols adds empty columns to a specified CPLEX problem object. This routine may be called any time after a call to CPXcreateprob.

For each column, the user can specify the objective coefficient, the lower and upper bounds, the variable type, and name of the variable. The added columns are indexed to put them at the end of the problem. Thus, if ccnt columns are added to a problem object already having k columns, the new columns have indices k, k+1, ... k+ccnt-1. The constraint coefficients in the new columns are zero; the constraint coefficients can be changed with calls to CPXchgcoef, CPXchgcoeflist, or CPXaddrows.

The routine CPXnewcols is very similar to the routine CPXnewrows. It can be used to add variables to a problem object without specifying the matrix coefficients.

Types of new variables: values of ctype[j]
CPX_CONTINUOUS'C'continuous variable j
CPX_BINARY'B'binary variable j
CPX_INTEGER'I'general integer variable j
CPX_SEMICONT'S'semi-continuous variable j
CPX_SEMIINT'N'semi-integer variable j

Example

 status = CPXnewcols (env, lp, ccnt, obj, lb, ub, NULL, NULL);
 

See also the example lpex8.c in the ILOG CPLEX User's Manual and in the standard distribution.

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

A pointer to a CPLEX problem object as returned by CPXcreateprob.

ccnt

An integer that specifies the number of new variables being added to the problem object.

obj

An array of length ccnt containing the objective function coefficients of the new variables. This array may be NULL, in which case the new objective coefficients are all set to 0 (zero).

lb

An array of length ccnt containing the lower bound on each of the new variables. 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 cplex.h. This array may be NULL, in which case the new lower bounds are all set to 0 (zero).

ub

An array of length ccnt containing the upper bound on each of the new variables. 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 cplex.h. This array may be NULL, in which case the new upper bounds are all set to CPX_INFBOUND.

xctype

An array of length ccnt containing the type of each of the new variables. Possible values appear in the table. This array may be NULL, in which case the new variables are created as continuous type.

colname

An array of length ccnt containing pointers to character strings that specify the names of the new variables added to the problem object. May be NULL, in which case the new columns are assigned default names if the columns already resident in the problem object have names; otherwise, no names are associated with the variables. If column names are passed to CPXnewcols but existing variables have no names assigned, default names are created for the existing variables.

Returns:

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