NO FRAMES

CPXcopyctype

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

The routine CPXcopyctype can be used to copy variable type information into a given problem. Variable types specify whether a variable is continuous, integer, binary, semi-continuous, or semi-integer. Adding ctype information automatically changes the problem type from continuous to mixed integer (from CPXPROB_LP to CPXPROB_MILP, from CPXPROB_QP to CPXPROB_MIQP, and from CPXPROB_QCP to CPXPROB_MIQCP), even if the provided ctype data specifies that all variables are continuous.

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. A later call to CPXmipopt will change the bounds to 0 (zero) and 1 (one) and issue a warning.

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

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

Example

 status = CPXcopyctype (env, lp, ctype);

See also the example mipex1.c distributed with the product.

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 if successful and nonzero if an error occurs.