NO FRAMES

CPXcopyctype

int CPXPUBLIC CPXcopyctype(CPXCENVptr env, CPXLPptr lp, const char * xctype)
Definition file: cplex.h
Include files: cplex.h

The routine CPXcopyctype can be used to copy variable type information to a given problem. Variable types indicate whether a variable is continuous, integer, binary, semi-continuous, or semi-integer. If the type of the problem object is CPXPROB_LP, it is changed to CPXPROB_MILP. If the type of the problem object is CPXPROB_QP, it is changed to CPXPROB_MIQP. If the type of the problem object is CPXPROB_QCP, it is changed to CPXPROB_MIQCP.

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
Defining a variable j to be binary by setting the corresponding ctype[j]='B' does not change the bounds associated with that variable. Because a call to CPXmipopt fails 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.
Table 1: Possible values for elements of xctype
CPX_CONTINUOUS'C'continuous variable
CPX_BINARY'B'binary variable
CPX_INTEGER'I'general integer variable
CPX_SEMICONT'S'semi-continuous variable
CPX_SEMIINT'N'semi-integer variable

Example

 status = CPXcopyctype (env, lp, ctype);

See also the example mipex1.c 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.

xctype

An array of length CPXgetnumcols(env,lp) containing the type of each column in the constraint matrix. Possible values appear in Table 1.

Returns:

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