> Discrete Optimization > Solving Mixed Integer Programming Problems (MIP) > Changing Problem Type in MIPs

Concert Technology applications treat all models as capable of containing integer variables, and thus these variable declarations may be added or deleted at will. When extracting a model with integer variables, it will automatically detect it as a MIP and make the required adjustments to internal data structures.

However, the other ways of using ILOG CPLEX, the Callable Library and the Interactive Optimizer, require an explicit notion of a Problem Type to distinguish continuous LPs, QPs, and QCPs from MIPs. Techniques to determine the Problem Type with the Callable Library and the Interactive Optimizer are discussed in this topic.

When you enter a problem, ILOG CPLEX determines the Problem Type from the available information. If the problem is read from a file (LP, MPS, or SAV format, for example), or entered interactively, the Problem Type is determined according to Table 13.3.

Table 13.3 Problem Type Definitions
Problem Type 
No Integer Variables 
Has Integer Variables 
No Quadratic Terms in the Objective Function 
Has Quadratic Terms in the Objective Function 
Has Quadratic Terms in Constraints 
lp 

 

 

 
qp 

 

 

 
qcp 

 

 
possibly 
milp 

 

 

 
miqp 

 

 

 
miqcp 

 

 
possibly 

However, if you enter a problem with no integer variables, so that its Problem Type is initially lp, qp, or qcp, and you then wish to modify the problem to contain integer variables, this is accomplished by first changing the Problem Type to milp, miqcp, or miqp. Conversely, if you have entered an MILP, MIQCP, or MIQP model and wish to remove all the integer declarations and thus convert the model to a continuous formulation, you can change the Problem Type to lp, qp, or qcp. Note that deleting each of the integer variable declarations individually still leaves the Problem Type as milp, miqp, or miqcp, although in most instances the distinction between this problem and its lp counterpart is somewhat arbitrary in terms of the steps that will be taken to solve it.

Thus, when using the Interactive Optimizer, you use the command change problem with one of the following options:

From the Callable Library, use the routine CPXchgprobtype to change the Problem Type to CPXPROB_MILP, CPXPROB_MIQCP, or CPXPROB_MIQP for the MILP, MIQCP, and MIQP case respectively, and then assign integer declarations to the variables through the CPXcopyctype function. Conversely, remove all integer declarations from the problem by using CPXchgprobtype with Problem Type CPXPROB_LP, CPXPROB_QCP, or CPXPROB_QP.

At the end of a MIP optimization, the optimal values for the variables are directly available. However, you may wish to obtain information about the LP, QP, or QCP associated with this optimal solution (for example, to know the reduced costs for the continuous variables of the problem at this solution). To do this, you will want to change the problem to be of type Fixed, either fixed_milp for the MILP case or fixed_miqp for the MIQP case. The fixed MIP is the continuous problem in which the integer variables are fixed at the values they attained in the best integer solution. After changing the problem type, you can then call any of the continuous optimizers to re-optimize, and then display solution information for the continuous version of the problem. If you then wish to change the problem type back to the associated milp or miqp, you can do so without loss of information in the model.

Changing Variable Type

The command change type adds (or removes) the restriction on a variable that it must be an integer. In the Interactive Optimizer, when you enter the command change type, the system prompts you to enter the variable that you want to change, and then it prompts you to enter the type (c for continuous, b for binary, i for general integer, s for semi-continuous, n for semi-integer).

You can change a variable to binary even if its bounds are not 0 (zero) and 1 (one). However, in such a case, the optimizer will change the bounds to be 0 and 1.

If you change the type of a variable to be semi-continuous or semi-integer, be sure to create both a lower bound and an upper bound for it. These variable types specify that at an optimal solution the value for the variable must be either exactly zero or else be between the lower and upper bounds (and further subject to the restriction that the value be an integer, in the case of semi-integer variables).

By the way, a problem may be changed to a mixed integer problem, even if all its variables are continuous.

Note
It is not required to specify explicit bounds on general integer variables. However, if during the branch and cut algorithm a variable exceeds 2,100,000,000 in magnitude of its solution, an error termination will occur. In practice, it is wise to limit integer variables to values far smaller than the stated limit, or numerical difficulties may occur; trying to enforce the difference between 1,000,000 and 1,000,001 on a finite precision computer might work but could be difficult due to roundoff.