CPXcopyctype


Description

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.

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.

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.

Return Value

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

Synopsis

  int CPXcopyctype (CPXCENVptr env, CPXLPptr lp, const char *xctype);

Arguments

CPXCENVptr env

The pointer to the CPLEX environment as returned by CPXopenCPLEX().

CPXLPptr lp

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

const char *xctype

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

Possible values for ctype[j]:

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

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

Previous Page: CPXcopybase Return to Top Next Page: CPXcopylp