C++ examples
These examples in C++ use the Concert Technology C++ API of CPLEX .
The following examples are delivered with CPLEX.
| benders.cpp | demonstrates a Benders decomposition. |
| ilobendersatsp.cpp | demonstrates legacy lazy constraint callbacks to separate integer feasible LP solutions and legacy user cut callbacks to separate fractional infeasible LP solutions in a do-it-yourself Benders decomposition of an asymmetric traveling salesperson problem. |
| ilobendersatsp2.cpp | demonstrates generic callbacks to separate integer feasible LP solutions in a context of lazy constraints as well as generic callbacks to separate fractional infeasible LP solutions in a context of user cuts, all in a do-it-yourself Benders decomposition of an asymmetric traveling salesperson problem. |
| blend.cpp | is a blending problem. |
| cutstock.cpp | is a cutting-stock model illustrating column generation. |
iloconflictex1.cpp |
demonstrates how to use the conflict refiner. |
| etsp.cpp | is a scheduling problem with costs for earliness and for tardiness. |
| facility.cpp | is a warehouse-location problem. Optionally, the example can apply a Benders decomposition. |
| fixcost1.cpp | is a production planning problem with fixed costs. |
| ilofixnet.cpp | uses indicator constraints to avoid numeric difficulty in a fixed-charge network flow problem. |
| foodmanufact.cpp | implements a solution to the food production planning problem, well known from the modeling textbook of H. P. Williams. |
| ilogenericbranch.cpp | demonstrates how to perform customized branching using the generic callback. |
| iloadmipex1.cpp | uses node and branch callbacks to optimize a MIP. |
| iloadmipex2.cpp | uses a heuristic callback to optimize a MIP. |
| iloadmipex3.cpp | uses a branch callback on a MIP with special ordered sets (SOS). |
| iloadmipex4.cpp | demonstrates how to add lazy constraints and user cuts. |
| iloadmipex5.cpp | adds cuts through the cut callback for a MIP. |
| iloadmipex6.cpp | starts a MIP optimization from an LP solution. |
| iloadmipex8.cpp | demonstrates how to add lazy constraints and user cuts with the generic callback. |
| iloadmipex9.cpp | uses a generic callback invoking a heuristic. |
| ilodiet.cpp | is a linear program that can be generated by columns (add foods to the diet) or by rows (add requirements to the diet); optionally, demonstrates how to model a multiobjective problem by creating a second objective. |
| ilomultiobjex1.cpp | demonstrates how to read in and optimize a multiobjective problem. |
| ilogoalex1.cpp | uses the goal API to branch. |
| ilogoalex2.cpp | uses the goal API to add cuts. |
| ilogoalex3.cpp | uses the goal API to add node evaluators; it derives from ilogoalex1.cpp. |
| ilolpex1.cpp | is equivalent to lpex1.c; it shows how to populate data in a model. |
| ilolpex2.cpp | is equivalent to lpex2.c; it shows how to add data from a file. |
| ilolpex3.cpp | is equivalent to lpex3.c; it shows how to add rows to a model and re-optimize. |
| ilolpex4.cpp | is equivalent to lpex4.c; it illustrates callbacks. |
| ilolpex6.cpp | is equivalent to lpex6.c; it shows how to load a basis. |
| ilolpex7.cpp | is equivalent to lpex7.c; it shows how to access names of columns. |
| ilomipex1.cpp | is equivalent to mipex1.c; it is a basic MIP. |
| ilomipex2.cpp | is equivalent to mipex2.c; another basic MIP with data from files. |
| ilomipex3.cpp | is equivalent to mipex3.c; it demonstrates special ordered sets (SOSs) and priorities. |
| ilomipex4.cpp | demonstrates how to use an aborter to interrupt optimization and how to use informational callbacks for logging, timing, or setting a node limit. |
| ilomiqpex1.cpp | is equivalent to miqpex1.c (quadratic objective in MIP). |
| iloqpex1.cpp | is equivalent to qpex1.c (quadratic objective). |
| iloqpex2.cpp | is equivalent to qpex2.c (quadratic objective with data read from a file). |
| iloqpex3.cpp | uses the Concert Technology interface for quadratic expressions to enter and to modify a model with quadratic expressions in linear combination in the objective function. |
| iloindefqpex1.cpp | enters and solves an indefinite quadratic program (nonPSD QP) to a local optimum. |
| iloqcpex1.cpp | solves a quadratically constrained problem. |
| ilopopulate.cpp | shows how to generate and store multiple solutions in the solution pool. |
| ilosocpex1.cpp | shows how to access dual values and reduced costs in SOCP models. |
| iloqcpdual.cpp | shows how to access dual values and reduced costs in quadratically constrained programming models (QCP). |
| iloglobalqpex1.cpp | shows how to read a convex or nonconvex quadratic programming model (QP) or mixed integer quadratic programming model (MIQP) and solve it for a first order or global optimum. |
| ilotuneset.cpp | analyzes a set of models and suggests nondefault parameter settings for better performance. |
| inout1.cpp | is a production model. |
| inout3.cpp | is another production model. |
| mixblend.cpp | is a blending problem with integer variables. |
| rates.cpp | is a planning problem with semi-continuous variables. |
| ilosteel.cpp | is equivalent to rowsteel.c, steeldrv.c, steelsub.c;
it solves the model known as steelT.mod in
the AMPL book by Fourer, Gay, and Kernighan. |
| ilotransport.cpp | uses a piecewise linear cost function. |
| warehouse.cpp | is a warehouse-assignment problem using goals. |