| ILOG CPLEX 11.0 User's Manual > Discrete Optimization > Solving Mixed Integer Programming Problems (MIP) > Examples: Optimizing a Simple MIP Problem |
Examples: Optimizing a Simple MIP Problem |
INDEX
PREVIOUS
NEXT
|
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).
Also available among the examples distributed with the product is a Java implementation of the same MIP.
Also available among the examples distributed with the product are a C#.NET and a Visual Basic.NET implementation of the same MIP.
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-2007 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |