12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Examples: Optimizing a Simple MIP ProblemThese examples illustrate how to optimize a MIP with the <strong>ILOG</strong> <strong>CPLEX</strong> ComponentLibraries.ilomipex1.cppThe example derives from ilolpex8.cpp. Here are the differences between that linearprogram and this mixed integer program:◆◆The problem to solve is slightly different. It appears in Stating a MIP Problem onpage 256.The routine populatebyrow added the variables, objective, and constraints to themodel created by the method IloModel model(env).MIPex1.javaAlso available among the examples distributed with the product is a Java implementation ofthe same MIP.MIPex1.cs and MIPex1.vbAlso available among the examples distributed with the product are a C#.NET and a VisualBasic.NET implementation of the same MIP.mipex1.cThe example derives from lpex8.c. Here are the differences between that linear programand this mixed integer program:◆◆◆◆The problem to solve is slightly different. It appears in Stating a MIP Problem onpage 256.The routine setproblemdata has a parameter, ctype, to set the types of the variablesto indicate which ones must assume integer values. The routine CPXcopyctypeassociates this data with the problem that CPXcreateprob creates.The example calls CPXmipopt to optimize the problem, rather than CPXlpopt.The example calls the routines CPXgetstat, CPXgetobjval, CPXgetx, andCPXgetslack (instead of CPXsolution) to get a solution.You do not get dual variables this way. If you want dual variables, you must do thefollowing:●Use CPXchgprobtype to change the problem type to CPXPROB_FIXEDMILP.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 299

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!