Examples of Benders algorithm
CPLEX provides examples that implement Benders algorithm.
CPLEX offers a variety of examples of Benders algorithm in all APIs.
- In the Callable Library (C API), see
benders.corxbenders.c. - In the C++ API, see
ilobenders.cpp. - In the Java API, see
Benders.java. - In the .NET API, see
Benders.cs. - In the Python API, see
benders.py.
Those examples read a model from a file. If the user also provides an annotation file for
that model, CPLEX uses those annotations. Otherwise, CPLEX automatically decomposes the
problem, as explained in
Benders decomposition: CPLEX default. CPLEX then
writes the resulting annotations to a file named benders.ann.
CPLEX then solves the problem according to that decomposition.
For an explanation of how to annotate a model, see Annotating a model for CPLEX.
For examples that demonstrate how to annotate a model, see these samples as well:
- In the C++ API, see
facility.cpp. - In the Java API, see
Facility.java. - In the .NET API, see
Facility.cs.