ILOG CPLEX 10.1 User's Manual > Discrete Optimization > Solving Mixed Integer Programming Problems (MIP) > Example: Optimizing a Basic MIP Problem |
Example: Optimizing a Basic MIP Problem |
INDEX
![]() |
These examples illustrate how to optimize a MIP with the ILOG CPLEX Component Libraries.
The example derives from ilolpex8.cpp
. Here are the differences between that linear program and this mixed integer program:
populatebyrow
added the variables, objective, and constraints to the model created by the method IloModel model(env)
.
The example derives from lpex8.c
. Here are the differences between that linear program and this mixed integer program:
setproblemdata
has a parameter, ctype
, to set the types of the variables to indicate which ones must assume integer values. The routine CPXcopyctype
associates this data with the problem that CPXcreateprob
creates.
CPXmipopt
to optimize the problem, rather than CPXlpopt
.
CPXgetstat
, CPXgetobjval
, CPXgetx
, and CPXgetslack
(instead of CPXsolution
) to get a solution.
CPXchgprobtype
to change the problem type to CPXPROB_FIXEDMILP
.
CPXprimopt
to optimize that problem.
CPXsolution
to get a solution to the fixed problem.
Copyright © 1987-2006 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |