Chapter 5.  More Samples

Table of Contents

CBC's Samples Directory

CBC's Samples Directory

The CBC distribution includes a number of .cpp sample files. Users are encouraged to use them as starting points for their own CBC projects. The files can be found in the COIN/Cbc/Samples/ directory. For the latest information on compiling and running these samples, please see the file COIN/Cbc/Samples/INSTALL. Most of them can be built by

make DRIVER=name

which produces an executable testit. Below is a list of some of the most useful sample files with a short description for each file.

Table 5.1. Basic Samples

Source file        Description
minimum.cpp This is a CBC "Hello, world" program. It reads a problem from an MPS file, and solves the problem.
sample2.cpp This is designed to be a file that a user could modify to get a useful driver program for his or her project. In particular, it demonstrates the use of Cgl's preprocess functionality. It uses CbcBranchUser.cpp, CbcCompareUser.cpp and CbcHeuristicUser.cpp with corresponding *.hpp files.

Table 5.2. Advanced Samples

Source file        Description
crew.cpp This sample, shows the use of advanced branching and a use of priorities. It uses CbcCompareUser.cpp with corresponding *.hpp files.
longthin.cpp This sample shows the advanced use of a solver. It also has coding for a greedy heuristic. The solver is given in CbcSolver2.hpp and CbcSolver2.cpp. The heuristic is given in CbcHeuristicGreedy.hpp and CbcHeuristicGreedy.cpp. It uses CbcBranchUser.cpp and CbcCompareUser.cpp with corresponding *.hpp files.
qmip.cpp This solves a quadratic mip. It is to show advanced use of a solver. The solver is given in ClpQuadInterface.hpp and ClpQuadInterface.cpp. It uses CbcBranchUser.cpp and CbcCompareUser.cpp with corresponding *.hpp files.
sos.cpp This artificially creates a Special Ordered set problem.
lotsize.cpp This artificially creates a lot sizing problem.