CPXXchgprobtype and CPXchgprobtype
The routine CPXXchgprobtype/CPXchgprobtype changes the current
problem to a related problem.
int CPXXchgprobtype( CPXCENVptr env, CPXLPptr lp, int type )
int CPXchgprobtype( CPXCENVptr env, CPXLPptr lp, int type )
Description
The routine CPXXchgprobtype/CPXchgprobtype changes the current
problem to a related problem. The problem types that can be
used appear in the table.
| Value | Symbolic Constant | Meaning |
0 |
CPXPROB_LP |
Linear program, no quadratic data stored. |
1 |
CPXPROB_MILP |
Problem both linear and integer constraints on the variables. |
3 |
CPXPROB_FIXEDMILP |
Problem integer variables fixed. |
5 |
CPXPROB_QP |
Problem with quadratic terms in the objective. |
7 |
CPXPROB_MIQP |
Problem with quadratic terms in the objective and integer variables among the constraints. |
8 |
CPXPROB_FIXEDMIQP |
Problem with quadratic terms in the objective and integer variables fixed. |
10 |
CPXPROB_QCP |
Problem with quadratic terms among the constraints. |
11 |
CPXPROB_MIQCP |
Problem with quadratic terms among the constraints and integer variables among the constraints. |
In fixed problem types, if the original problem included SOS constraints (special ordered sets), even noninteger variables in those constraints will be fixed; with the variables thus fixed, the SOS constraints will be discarded from the problem.
A mixed integer problem of type
CPXPROB_MILP or
CPXPROB_MIQP
can be changed to a fixed problem
(CPXPROB_FIXEDMILP
or CPXPROB_FIXEDMIQP),
where bounds on integer variables are fixed to the values
attained in the integer solution.
CPLEX does not currently permit you
to change a mixed integer problem of type
CPXPROB_MIQCP
to a fixed problem.
A mixed integer problem (or its related fixed type) can also be
changed to a continuous problem
(CPXPROB_LP,
CPXPROB_QP,
or CPXPROB_QCP).
This change causes any existing ctype
values to be permanently discarded from the problem object.
For documentation of ctype, see the routine
CPXXchgctype and CPXchgctype.
The original mixed integer problem can be recovered from the fixed
problem. If the current problem type is
CPXPROB_FIXEDMILP or
CPXPROB_FIXEDMIQP,
any calls to problem modification routines
fail. To modify the problem object,
the problem type should be changed to
CPXPROB_MILP or
CPXPROB_MIQP.
Changing a problem from a continuous type to a mixed integer type
causes a ctype array to be created
such that all variables are considered continuous.
A problem of type CPXPROB_MILP,
CPXPROB_MIQP, or CPXPROB_MIQCP
can be solved only by the routine
CPXXmipopt and CPXmipopt
even if all of its variables are continuous.
A quadratic problem (CPXPROB_QP,
CPXPROB_MIQP, CPXPROB_QCP, or
CPXPROB_MIQCP) can be changed
to a linear program (CPXPROB_LP), causing any existing
quadratic information to be permanently discarded from the problem object.
Changing a problem from a linear program (CPXPROB_LP or
CPXPROB_MILP) to a quadratic program
(CPXPROB_QP or
CPXPROB_MIQP) causes an empty quadratic matrix to be created
such that the problem is quadratic with the matrix Q = 0.
Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - lp
-
A pointer to a CPLEX LP problem object as returned by
CPXXcreateprob/CPXcreateprob. - type
- An integer specifying the desired problem type. See the previous discussion for possible values.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.Example
status = CPXchgprobtype (env, lp, CPXPROB_MILP);