While solving a constraint integer program, SCIP displays status information in a column-like fashion. The current number of processed branching tree nodes, the solving time, and the relative gap between primal and dual bound are examples of such display columns. There already exists a wide variety of display columns which can be activated or deactivated on demand, see src/scip/disp_default.c. Additionally, the user can implement his/her own display columns in order to track problem or algorithm specific values.
A complete list of all displays contained in this release can be found here.
We now explain how users can add their own display columns. We give the explanation for creating your own source file for each additional display column. Of course, you can collect different additional display columns in one source file. Take src/scip/disp_default.c, where all default display columns are collected, as an example. As all other default plugins, the default display column plugins and the display column template are written in C. C++ users can easily adapt the code by using the scip::ObjDisp wrapper base class and implement the scip_...() virtual methods instead of the SCIP_DECL_DISP... callback methods.
Additional documentation for the callback methods of a display column can be found in the file type_disp.h.
Here is what you have to do to implement a display column (assuming your display column is named "mydisplaycolumn"):
At the top of the new file "disp_mydisplaycolumn.c" you can find the display column properties. These are given as compiler defines. In the C++ wrapper class, you have to provide the display column properties by calling the constructor of the abstract base class scip::ObjDisp from within your constructor. The properties you have to set have the following meaning:
Below the header "Data structures" you can find a struct which is called "struct SCIP_DispData". In this data structure, you can store the data of your display column. For example, you should store the adjustable parameters of the display column in this data structure. If you are using C++, you can add display column data as usual as object variables to your class.
Defining display column data is optional. You can leave the struct empty.
At the bottom of "disp_mydisplaycolumn.c" you can find the interface method SCIPincludeDispMydisplaycolumn(), which also appears in "disp_mydisplaycolumn.h".
This method only has to be adjusted slightly. It is responsible for notifying SCIP of the presence of the display column by calling the method SCIPincludeDisp().
The interface method is called by the user, if (s)he wants to include the display column, i.e., if (s)he wants to use the display column in his application.
If you are using display column data, you have to allocate the memory for the data at this point. You can do this by calling:
You also have to initialize the fields in struct SCIP_DispData afterwards.
Display column plugins have only one fundamental callback method, namely the DISPOUTPUT method. This method has to be implemented for every display column; the other callback methods are optional. In the C++ wrapper class scip::ObjDisp, the scip_output() method (which corresponds to the DISPOUTPUT callback) is a virtual abstract member function. You have to implement it in order to be able to construct an object of your display column class.
Additional documentation for the callback methods can be found in type_disp.h.
The DISPOUTPUT callback is called after each pricing loop during node processing and after a node has been processed. In addition, at the root node, the callback is executed after each iteration of the price-and-cut loop. It should write the display column information for the current node to a given output file stream.
The additional callback methods do not need to be implemented in every case. They can be used, for example, to initialize and free private data.
The DISPCOPY callback is executed when a SCIP instance is copied, e.g. to solve a sub-SCIP. By defining this callback as
NULL the user disables the execution of the specified column. In general it is probably not needed to implement that callback since the output of the copied instance is usually suppressed. In the other case or for debugging the callback should be implement.
If you are using display column data, you have to implement this method in order to free the display column data. This can be done by the following procedure:
If you have allocated memory for fields in your display column data, remember to free this memory before freeing the display column data itself. If you are using the C++ wrapper class, this method is not available. Instead, just use the destructor of your class to free the member variables of your class.
The DISPINIT callback is executed after the problem is transformed. The display column may, e.g., use this call to initialize its display column data.
The DISPEXIT callback is executed before the transformed problem is freed. In this method, the display column should free all resources that have been allocated for the solving process in DISPINIT.
The DISPINITSOL callback is executed when the presolving is finished and the branch-and-bound process is about to begin. The display column may use this call to initialize its branch-and-bound specific data.
The DISPEXITSOL callback is executed before the branch-and-bound process is freed. The display column should use this call to clean up its branch-and-bound specific data.