Previous Page: CPXcopybaseFirst PageNext Page: CPXcopylp

CPXcopyctype


Usage

Mixed Integer Users Only

Description

The CPXcopyctype() routine can be used to copy integer and binary variable declarations for a given LP problem. This routine allows the types of all the variables to be set in one function call. When CPXcopyctype() is called, any current solution information is freed.

Note that defining a variable j to be binary by setting the corresponding ctype[j]='B' does not change the bounds associated with that variable. This will cause a call to CPXmipopt() to fail if the value of the corresponding variable is not between 0 and 1 in the solution of the LP relaxation at the root of the search tree. Explicitly setting the bounds of binary variables to 0 and 1 is recommended.

Note also that if the type of the LP problem object is CPXPROB_LP, it will be changed to CPXPROB_MIP. This function will fail if the type of the LP problem object is CPXPROB_QP.

Return Value

The routine returns a zero on success, and a nonzero if an error occurs.

Synopsis

int CPXcopyctype (CPXENVptr env,
                  CPXLPptr lp,
                  char *ctype);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX routines.

CPXLPptr lp
A pointer to a CPLEX LP problem object as returned by CPXcreateprob().

char *ctype
An array of length CPXgetnumcols(env,lp) containing the type of each column in the constraint matrix.

CPX_CONTINUOUS  
`C'  
continuous variable  
CPX_BINARY  
`B'  
binary variable  
CPX_INTEGER  
`I'  
general integer variable  

Possible values for ctype[j]:

Example

status = CPXcopyctype (env, lp, ctype);

See Also

Example mipex1.c in the CPLEX User's Manual.

Previous Page: CPXcopybaseFirst PageNext Page: CPXcopylp