Where to find the CPLEX examples
Describes where to find the examples illustrating the use of OPL as a modeling and scripting language in the CPLEX Studio distribution.
This section presents examples that show how to use OPL as a modeling language and IBM ILOG Script for OPL as a scripting language. First look at the following tables, then find the examples you need from the following categories of problems.
The examples used in this documentation are designed to illustrate the features of the product. They should not be viewed as recommended methods or approaches for these problems.
All examples illustrating the use of OPL as a modeling and scripting language are in
<Install_dir>/opl/examples/opl
More optimization problems expressed as OPL models are available in
<Install_dir>/opl/examples/opl/models
and described in OPL model library.
The table titled Mathematical programming code examples presents an overview of the examples specifically written to illustrate OPL.
Legend:
-
The Problem column lists the types of problems in alphabetical order.
-
The Technique column specifies what kind of mathematical programming is applied in these models.
-
The Features column points out interesting characteristics or issues that OPL, as a modeling language, addresses in these examples.
-
The Project Location column specifies the directory that contains the corresponding project, model, and data files.
-
The Model File Name column provides direct links to the model files displayed in HTML format.
Abbreviations
Abbreviation | Full form of the abbreviation |
---|---|
IP | Integer Programming |
LP | Linear Programming |
MILP | Mixed Integer Linear Programming |
MIP | Mixed Integer Programming |
MIQP | Mixed Integer Quadratic Programming |
PWL | Piecewise Linear Programming |
QCP | Quadratically Constrained Programming |
QP | Quadratic Programming |
Problem | Technique | Features | Project Location | Model File Name |
---|---|---|---|---|
Blending problems | MILP |
Branch and bound Logical constraints |
examples/opl/blending examples/opl/foodmanufact examples/opl/oil |
|
Commodity flow problems (transportation) | MIP |
Sparsity Preprocessing script |
examples/opl/transp | |
Covering problems | IP | Resource Allocation | examples/opl/covering | covering.mod |
Cutting stock problems | IP |
Column Generation Flow control scripting Relaxation |
examples/opl/cutstock | |
Fixed-charge production problems | IP | Production expressed as integers |
examples/opl/fixed examples/opl/prodmilp |
|
Inventory problems | PWL | Piecewise linear function | examples/opl/sailco | |
Knapsack problems | IP |
CPLEX priorities External knapsack algorithm |
examples/opl/knapsack | |
Miscellaneous examples | IP | int-to-float and float-to-int conversion of variables | examples/opl/convert_example | convert_example.mod |
IP | Setting an initial solution to the solver | examples/opl/warmstart | warmstart.mod | |
Setting user’s preferences for conflict search | examples/opl/conflictIterator | conflictIterator.mod | ||
Setting user’s preferences for relaxation of conflicts | examples/opl/relaxationIterator | relaxationIterator.mod | ||
MIP | Quick start from OR to OPL | examples/opl/pmedian | pmedian.mod | |
External function calls | examples/java/externaldataread | |||
MIP | Multiple optimization of different models in a single environment | examples/opl/LagrangianRelaxation | LagrangianRelaxation.mod | |
Product mix problems | MILP | Data initialized in model file |
examples/opl/gas examples/opl/volsay |
|
Production problems |
MILP LP |
Tuples Named data Flow control script Spreadsheet, reading and writing data |
examples/opl/production examples/opl/mulprod examples/opl/xsteel |
|
Profiling | MILP | Better time and memory consumption | examples/opl/profiler | profiler.mod |
Quadratic problems |
QP MIQP QP QCP |
examples/opl/lifegameip examples/opl/miqpex1 examples/opl/qpex1 examples/opl/qcpex1 |
||
Relaxation of infeasible models | MIP |
Scheduling Feasibility and relaxation |
examples/opl/nurses | nurses.mod |
Warehouse location problems | MIP |
Internal data Scalability |
examples/opl/warehouse |
The following table provides a synoptic view in which the examples are sorted by industry. Each table entry provides a link to a description of each type of problem.
Manufacturing | Supply chain | Time tabling | Transportation | Miscellaneous |
---|---|---|---|---|
Blending problems | Inventory problems | Covering problems | Commodity flow problems | Knapsack problems |
Cutting stock problems | Profiling | Miscellaneous examples | ||
Fixed-charge production problems | Warehouse location problems | Quadratic problems | ||
Product mix problems | Relaxation of infeasible models | |||
Production problems |
The following table orders the examples by type of mathematical programming.
Integer Programming | Linear Programming | Mixed Integer Linear Programming | Mixed Integer Programming | Quadratic Programming |
---|---|---|---|---|
examples/opl/convert_example | examples/opl/mulprod | examples/opl/blending | examples/opl/nurses | examples/opl/lifegameip |
examples/opl/covering | examples/opl/xsteel | examples/opl/foodmanufact | examples/opl/pmedian | examples/opl/miqpex1 |
examples/opl/cutstock | examples/opl/gas | examples/opl/transp | examples/opl/qpex1 | |
examples/opl/fixed | examples/opl/oil | examples/opl/warehouse | examples/opl/qcpex1 | |
examples/opl/knapsack | examples/opl/production | |||
examples/opl/prodmilp | examples/opl/profiler | |||
examples/opl/sailco | examples/opl/volsay | |||
examples/opl/warmstart |