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   sepa.h
17  * @ingroup INTERNALAPI
18  * @brief  internal methods for separators
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_SEPA_H__
25 #define __SCIP_SEPA_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_retcode.h"
31 #include "scip/type_result.h"
32 #include "scip/type_set.h"
33 #include "scip/type_stat.h"
34 #include "scip/type_sepastore.h"
35 #include "scip/type_sepa.h"
36 #include "scip/pub_sepa.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /** copies the given separator to a new scip */
43 SCIP_RETCODE SCIPsepaCopyInclude(
44    SCIP_SEPA*            sepa,               /**< separator */
45    SCIP_SET*             set                 /**< SCIP_SET of SCIP to copy to */
46    );
47 
48 /** creates a separator */
49 SCIP_RETCODE SCIPsepaCreate(
50    SCIP_SEPA**           sepa,               /**< pointer to separator data structure */
51    SCIP_SET*             set,                /**< global SCIP settings */
52    SCIP_MESSAGEHDLR*     messagehdlr,        /**< message handler */
53    BMS_BLKMEM*           blkmem,             /**< block memory for parameter settings */
54    const char*           name,               /**< name of separator */
55    const char*           desc,               /**< description of separator */
56    int                   priority,           /**< priority of separator (>= 0: before, < 0: after constraint handlers) */
57    int                   freq,               /**< frequency for calling separator */
58    SCIP_Real             maxbounddist,       /**< maximal relative distance from current node's dual bound to primal bound compared
59                                               *   to best node's dual bound for applying separation */
60    SCIP_Bool             usessubscip,        /**< does the separator use a secondary SCIP instance? */
61    SCIP_Bool             delay,              /**< should separator be delayed, if other separators found cuts? */
62    SCIP_DECL_SEPACOPY    ((*sepacopy)),      /**< copy method of separator or NULL if you don't want to copy your plugin into sub-SCIPs */
63    SCIP_DECL_SEPAFREE    ((*sepafree)),      /**< destructor of separator */
64    SCIP_DECL_SEPAINIT    ((*sepainit)),      /**< initialize separator */
65    SCIP_DECL_SEPAEXIT    ((*sepaexit)),      /**< deinitialize separator */
66    SCIP_DECL_SEPAINITSOL ((*sepainitsol)),   /**< solving process initialization method of separator */
67    SCIP_DECL_SEPAEXITSOL ((*sepaexitsol)),   /**< solving process deinitialization method of separator */
68    SCIP_DECL_SEPAEXECLP  ((*sepaexeclp)),    /**< LP solution separation method of separator */
69    SCIP_DECL_SEPAEXECSOL ((*sepaexecsol)),   /**< arbitrary primal solution separation method of separator */
70    SCIP_SEPADATA*        sepadata            /**< separator data */
71    );
72 
73 /** calls destructor and frees memory of separator */
74 SCIP_RETCODE SCIPsepaFree(
75    SCIP_SEPA**           sepa,               /**< pointer to separator data structure */
76    SCIP_SET*             set                 /**< global SCIP settings */
77    );
78 
79 /** initializes separator */
80 SCIP_RETCODE SCIPsepaInit(
81    SCIP_SEPA*            sepa,               /**< separator */
82    SCIP_SET*             set                 /**< global SCIP settings */
83    );
84 
85 /** calls exit method of separator */
86 SCIP_RETCODE SCIPsepaExit(
87    SCIP_SEPA*            sepa,               /**< separator */
88    SCIP_SET*             set                 /**< global SCIP settings */
89    );
90 
91 /** informs separator that the branch and bound process is being started */
92 SCIP_RETCODE SCIPsepaInitsol(
93    SCIP_SEPA*            sepa,               /**< separator */
94    SCIP_SET*             set                 /**< global SCIP settings */
95    );
96 
97 /** informs separator that the branch and bound process data is being freed */
98 SCIP_RETCODE SCIPsepaExitsol(
99    SCIP_SEPA*            sepa,               /**< separator */
100    SCIP_SET*             set                 /**< global SCIP settings */
101    );
102 
103 /** calls LP separation method of separator */
104 SCIP_RETCODE SCIPsepaExecLP(
105    SCIP_SEPA*            sepa,               /**< separator */
106    SCIP_SET*             set,                /**< global SCIP settings */
107    SCIP_STAT*            stat,               /**< dynamic problem statistics */
108    SCIP_SEPASTORE*       sepastore,          /**< separation storage */
109    int                   depth,              /**< depth of current node */
110    SCIP_Real             bounddist,          /**< current relative distance of local dual bound to global dual bound */
111    SCIP_Bool             allowlocal,         /**< should the separator be asked to separate local cuts */
112    SCIP_Bool             execdelayed,        /**< execute separator even if it is marked to be delayed */
113    SCIP_RESULT*          result              /**< pointer to store the result of the callback method */
114    );
115 
116 /** calls primal solution separation method of separator */
117 SCIP_RETCODE SCIPsepaExecSol(
118    SCIP_SEPA*            sepa,               /**< separator */
119    SCIP_SET*             set,                /**< global SCIP settings */
120    SCIP_STAT*            stat,               /**< dynamic problem statistics */
121    SCIP_SEPASTORE*       sepastore,          /**< separation storage */
122    SCIP_SOL*             sol,                /**< primal solution that should be separated */
123    int                   depth,              /**< depth of current node */
124    SCIP_Bool             allowlocal,         /**< should the separator be asked to separate local cuts */
125    SCIP_Bool             execdelayed,        /**< execute separator even if it is marked to be delayed */
126    SCIP_RESULT*          result              /**< pointer to store the result of the callback method */
127    );
128 
129 /** sets priority of separator */
130 void SCIPsepaSetPriority(
131    SCIP_SEPA*            sepa,               /**< separator */
132    SCIP_SET*             set,                /**< global SCIP settings */
133    int                   priority            /**< new priority of the separator */
134    );
135 
136 /** sets copy method of separator */
137 void SCIPsepaSetCopy(
138    SCIP_SEPA*            sepa,               /**< separator */
139    SCIP_DECL_SEPACOPY    ((*sepacopy))       /**< copy method of separator or NULL if you don't want to copy your plugin into sub-SCIPs */
140    );
141 
142 /** sets destructor method of separator */
143 void SCIPsepaSetFree(
144    SCIP_SEPA*            sepa,               /**< separator */
145    SCIP_DECL_SEPAFREE    ((*sepafree))       /**< destructor of separator */
146    );
147 
148 /** sets initialization method of separator */
149 void SCIPsepaSetInit(
150    SCIP_SEPA*            sepa,               /**< separator */
151    SCIP_DECL_SEPAINIT    ((*sepainit))       /**< initialize separator */
152    );
153 
154 /** sets deinitialization method of separator */
155 void SCIPsepaSetExit(
156    SCIP_SEPA*            sepa,               /**< separator */
157    SCIP_DECL_SEPAEXIT    ((*sepaexit))       /**< deinitialize separator */
158    );
159 
160 /** sets solving process initialization method of separator */
161 void SCIPsepaSetInitsol(
162    SCIP_SEPA*            sepa,               /**< separator */
163    SCIP_DECL_SEPAINITSOL ((*sepainitsol))    /**< solving process initialization method of separator */
164    );
165 
166 /** sets solving process deinitialization method of separator */
167 void SCIPsepaSetExitsol(
168    SCIP_SEPA*            sepa,               /**< separator */
169    SCIP_DECL_SEPAEXITSOL ((*sepaexitsol))    /**< solving process deinitialization method of separator */
170    );
171 
172 /** enables or disables all clocks of \p sepa, depending on the value of the flag */
173 void SCIPsepaEnableOrDisableClocks(
174    SCIP_SEPA*            sepa,               /**< the separator for which all clocks should be enabled or disabled */
175    SCIP_Bool             enable              /**< should the clocks of the separator be enabled? */
176    );
177 
178 /** increase count of applied cuts */
179 void SCIPsepaIncNAppliedCuts(
180    SCIP_SEPA*            sepa                /**< separator */
181    );
182 
183 /** increase count of found cuts */
184 void SCIPsepaIncNCutsFound(
185    SCIP_SEPA*            sepa                /**< separator */
186    );
187 
188 /** increase count of found cuts at current node */
189 void SCIPsepaIncNCutsFoundAtNode(
190    SCIP_SEPA*            sepa                /**< separator */
191    );
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif
198