1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 Konrad-Zuse-Zentrum                            */
7 /*                            fuer Informationstechnik Berlin                */
8 /*                                                                           */
9 /*  SCIP is distributed under the terms of the ZIB Academic License.         */
10 /*                                                                           */
11 /*  You should have received a copy of the ZIB Academic License              */
12 /*  along with SCIP; see the file COPYING. If not visit scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   compr.h
17  * @ingroup INTERNALAPI
18  * @brief  internal methods for tree compressions
19  * @author Jakob Witzig
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_COMPR_H__
25 #define __SCIP_COMPR_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_reopt.h"
31 #include "scip/type_retcode.h"
32 #include "scip/type_result.h"
33 #include "scip/type_set.h"
34 #include "scip/type_compr.h"
35 #include "scip/pub_compr.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** copies the given tree compression to a new scip */
42 SCIP_RETCODE SCIPcomprCopyInclude(
43    SCIP_COMPR*           compr,              /**< tree compression */
44    SCIP_SET*             set                 /**< SCIP_SET of SCIP to copy to */
45    );
46 
47 /** creates a tree compression */
48 SCIP_RETCODE SCIPcomprCreate(
49    SCIP_COMPR**          compr,              /**< pointer to tree compression data structure */
50    SCIP_SET*             set,                /**< global SCIP settings */
51    SCIP_MESSAGEHDLR*     messagehdlr,        /**< message handler */
52    BMS_BLKMEM*           blkmem,             /**< block memory for parameter settings */
53    const char*           name,               /**< name of tree compression */
54    const char*           desc,               /**< description of tree compression */
55    int                   priority,           /**< priority of the tree compression */
56    int                   minnnodes,          /**< minimal number of nodes for calling compression */
57    SCIP_DECL_COMPRCOPY   ((*comprcopy)),     /**< copy method of tree compression or NULL if you don't want to copy
58                                               *   your plugin into sub-SCIPs */
59    SCIP_DECL_COMPRFREE   ((*comprfree)),     /**< destructor of tree compression */
60    SCIP_DECL_COMPRINIT   ((*comprinit)),     /**< initialize tree compression */
61    SCIP_DECL_COMPREXIT   ((*comprexit)),     /**< deinitialize tree compression */
62    SCIP_DECL_COMPRINITSOL ((*comprinitsol)), /**< solving process initialization method of tree compression */
63    SCIP_DECL_COMPREXITSOL ((*comprexitsol)), /**< solving process deinitialization method of tree compression */
64    SCIP_DECL_COMPREXEC   ((*comprexec)),     /**< execution method of tree compression */
65    SCIP_COMPRDATA*       comprdata           /**< tree compression data */
66    );
67 
68 /** calls destructor and frees memory of tree compression */
69 SCIP_RETCODE SCIPcomprFree(
70    SCIP_COMPR**          compr,              /**< pointer to tree compression data structure */
71    SCIP_SET*             set                 /**< global SCIP settings */
72    );
73 
74 /** initializes tree compression */
75 SCIP_RETCODE SCIPcomprInit(
76    SCIP_COMPR*           compr,              /**< tree compression */
77    SCIP_SET*             set                 /**< global SCIP settings */
78    );
79 
80 /** calls exit method of tree compression */
81 SCIP_RETCODE SCIPcomprExit(
82    SCIP_COMPR*           compr,              /**< tree compression */
83    SCIP_SET*             set                 /**< global SCIP settings */
84    );
85 
86 /** informs tree compression that the branch and bound process is being started */
87 SCIP_RETCODE SCIPcomprInitsol(
88    SCIP_COMPR*           compr,              /**< tree compression */
89    SCIP_SET*             set                 /**< global SCIP settings */
90    );
91 
92 /** informs tree compression that the branch and bound process data is being freed */
93 SCIP_RETCODE SCIPcomprExitsol(
94    SCIP_COMPR*           compr,              /**< tree compression */
95    SCIP_SET*             set                 /**< global SCIP settings */
96    );
97 
98 /** calls execution method of tree compression */
99 SCIP_RETCODE SCIPcomprExec(
100    SCIP_COMPR*           compr,              /**< tree compression */
101    SCIP_SET*             set,                /**< global SCIP settings */
102    SCIP_REOPT*           reopt,              /**< reoptimization data structure */
103    SCIP_RESULT*          result              /**< pointer to store the result of the callback method */
104    );
105 
106 /** sets priority of tree compression */
107 void SCIPcomprSetPriority(
108    SCIP_COMPR*           compr,              /**< tree compression */
109    SCIP_SET*             set,                /**< global SCIP settings */
110    int                   priority            /**< new priority of the tree compression */
111    );
112 
113 /** sets copy callback of tree compression */
114 void SCIPcomprSetCopy(
115    SCIP_COMPR*           compr,              /**< tree compression */
116    SCIP_DECL_COMPRCOPY   ((*comprcopy))      /**< copy callback of tree compression or NULL if you don't want to copy your plugin into sub-SCIPs */
117    );
118 
119 /** sets destructor callback of tree compression */
120 void SCIPcomprSetFree(
121    SCIP_COMPR*           compr,              /**< tree compression */
122    SCIP_DECL_COMPRFREE   ((*comprfree))      /**< destructor of tree compression */
123    );
124 
125 /** sets initialization callback of tree compression */
126 void SCIPcomprSetInit(
127    SCIP_COMPR*           compr,              /**< tree compression */
128    SCIP_DECL_COMPRINIT   ((*comprinit))      /**< initialize tree compression */
129    );
130 
131 /** sets deinitialization callback of tree compression */
132 void SCIPcomprSetExit(
133    SCIP_COMPR*           compr,              /**< tree compression */
134    SCIP_DECL_COMPREXIT   ((*comprexit))      /**< deinitialize tree compression */
135    );
136 
137 /** sets solving process initialization callback of tree compression */
138 void SCIPcomprSetInitsol(
139    SCIP_COMPR*           compr,              /**< tree compression */
140    SCIP_DECL_COMPRINITSOL ((*comprinitsol))  /**< solving process initialization callback of tree compression */
141    );
142 
143 /** sets solving process deinitialization callback of tree compression */
144 void SCIPcomprSetExitsol(
145    SCIP_COMPR*           compr,              /**< tree compression */
146    SCIP_DECL_COMPREXITSOL ((*comprexitsol))  /**< solving process deinitialization callback of tree compression */
147    );
148 
149 /** should the compression be executed at the given depth, frequency, timing, ... */
150 SCIP_EXPORT
151 SCIP_Bool SCIPcomprShouldBeExecuted(
152    SCIP_COMPR*           compr,              /**< tree compression */
153    int                   depth,              /**< depth of current node */
154    int                   nnodes              /**< number of open nodes */
155    );
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif
162