Scippy

SCIP

Solving Constraint Integer Programs

scip_sepa.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2022 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 scip_sepa.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for separator plugins
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Leona Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_SEPA_H__
32 #define __SCIP_SCIP_SEPA_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_result.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 #include "scip/type_sepa.h"
40 #include "scip/type_sol.h"
41 
42 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
43  * this structure except the interface methods in scip.c.
44  * In optimized mode, the structure is included in scip.h, because some of the methods
45  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
46  * Additionally, the internal "set.h" is included, such that the defines in set.h are
47  * available in optimized mode.
48  */
49 #ifdef NDEBUG
50 #include "scip/struct_scip.h"
51 #include "scip/struct_set.h"
52 #include "scip/tree.h"
53 #endif
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /**@addtogroup PublicSeparatorMethods
60  *
61  * @{
62  */
63 
64 /** creates a separator and includes it in SCIP.
65  *
66  * @note method has all separator callbacks as arguments and is thus changed every time a new
67  * callback is added
68  * in future releases; consider using SCIPincludeSepaBasic() and setter functions
69  * if you seek for a method which is less likely to change in future releases
70  */
71 SCIP_EXPORT
73  SCIP* scip, /**< SCIP data structure */
74  const char* name, /**< name of separator */
75  const char* desc, /**< description of separator */
76  int priority, /**< priority of separator (>= 0: before, < 0: after constraint handlers) */
77  int freq, /**< frequency for calling separator */
78  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound compared
79  * to best node's dual bound for applying separation */
80  SCIP_Bool usessubscip, /**< does the separator use a secondary SCIP instance? */
81  SCIP_Bool delay, /**< should separator be delayed, if other separators found cuts? */
82  SCIP_DECL_SEPACOPY ((*sepacopy)), /**< copy method of separator or NULL if you don't want to copy your plugin into sub-SCIPs */
83  SCIP_DECL_SEPAFREE ((*sepafree)), /**< destructor of separator */
84  SCIP_DECL_SEPAINIT ((*sepainit)), /**< initialize separator */
85  SCIP_DECL_SEPAEXIT ((*sepaexit)), /**< deinitialize separator */
86  SCIP_DECL_SEPAINITSOL ((*sepainitsol)), /**< solving process initialization method of separator */
87  SCIP_DECL_SEPAEXITSOL ((*sepaexitsol)), /**< solving process deinitialization method of separator */
88  SCIP_DECL_SEPAEXECLP ((*sepaexeclp)), /**< LP solution separation method of separator */
89  SCIP_DECL_SEPAEXECSOL ((*sepaexecsol)), /**< arbitrary primal solution separation method of separator */
90  SCIP_SEPADATA* sepadata /**< separator data */
91  );
92 
93 /** creates a separator and includes it in SCIP with its most fundamental callbacks. All non-fundamental
94  * (or optional) callbacks as, e.g., init and exit callbacks, will be set to NULL.
95  * Optional callbacks can be set via specific setter functions, see SCIPsetSepaInit(), SCIPsetSepaFree(),
96  * SCIPsetSepaInitsol(), SCIPsetSepaExitsol(), SCIPsetSepaCopy(), SCIPsetExit().
97  *
98  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeSepa() instead
99  */
100 SCIP_EXPORT
102  SCIP* scip, /**< SCIP data structure */
103  SCIP_SEPA** sepa, /**< reference to a separator, or NULL */
104  const char* name, /**< name of separator */
105  const char* desc, /**< description of separator */
106  int priority, /**< priority of separator (>= 0: before, < 0: after constraint handlers) */
107  int freq, /**< frequency for calling separator */
108  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound compared
109  * to best node's dual bound for applying separation */
110  SCIP_Bool usessubscip, /**< does the separator use a secondary SCIP instance? */
111  SCIP_Bool delay, /**< should separator be delayed, if other separators found cuts? */
112  SCIP_DECL_SEPAEXECLP ((*sepaexeclp)), /**< LP solution separation method of separator */
113  SCIP_DECL_SEPAEXECSOL ((*sepaexecsol)), /**< arbitrary primal solution separation method of separator */
114  SCIP_SEPADATA* sepadata /**< separator data */
115  );
116 
117 /** sets copy method of separator */
118 SCIP_EXPORT
120  SCIP* scip, /**< SCIP data structure */
121  SCIP_SEPA* sepa, /**< separator */
122  SCIP_DECL_SEPACOPY ((*sepacopy)) /**< copy method of separator or NULL if you don't want to copy your plugin into sub-SCIPs */
123  );
124 
125 /** sets destructor method of separator */
126 SCIP_EXPORT
128  SCIP* scip, /**< SCIP data structure */
129  SCIP_SEPA* sepa, /**< separator */
130  SCIP_DECL_SEPAFREE ((*sepafree)) /**< destructor of separator */
131  );
132 
133 /** sets initialization method of separator */
134 SCIP_EXPORT
136  SCIP* scip, /**< SCIP data structure */
137  SCIP_SEPA* sepa, /**< separator */
138  SCIP_DECL_SEPAINIT ((*sepainit)) /**< initialize separator */
139  );
140 
141 /** sets deinitialization method of separator */
142 SCIP_EXPORT
144  SCIP* scip, /**< SCIP data structure */
145  SCIP_SEPA* sepa, /**< separator */
146  SCIP_DECL_SEPAEXIT ((*sepaexit)) /**< deinitialize separator */
147  );
148 
149 /** sets solving process initialization method of separator */
150 SCIP_EXPORT
152  SCIP* scip, /**< SCIP data structure */
153  SCIP_SEPA* sepa, /**< separator */
154  SCIP_DECL_SEPAINITSOL ((*sepainitsol)) /**< solving process initialization method of separator */
155  );
156 
157 /** sets solving process deinitialization method of separator */
158 SCIP_EXPORT
160  SCIP* scip, /**< SCIP data structure */
161  SCIP_SEPA* sepa, /**< separator */
162  SCIP_DECL_SEPAEXITSOL ((*sepaexitsol)) /**< solving process deinitialization method of separator */
163  );
164 
165 /** returns the separator of the given name, or NULL if not existing */
166 SCIP_EXPORT
168  SCIP* scip, /**< SCIP data structure */
169  const char* name /**< name of separator */
170  );
171 
172 /** returns the array of currently available separators */
173 SCIP_EXPORT
175  SCIP* scip /**< SCIP data structure */
176  );
177 
178 /** returns the number of currently available separators */
179 SCIP_EXPORT
180 int SCIPgetNSepas(
181  SCIP* scip /**< SCIP data structure */
182  );
183 
184 /** sets the priority of a separator */
185 SCIP_EXPORT
187  SCIP* scip, /**< SCIP data structure */
188  SCIP_SEPA* sepa, /**< separator */
189  int priority /**< new priority of the separator */
190  );
191 
192 /** declares separator to be a parent separator
193  *
194  * Parent separators generate cuts of several types. To distinguish these cuts, they create child separators, which are
195  * only needed to detect which cuts are applied.
196  */
197 SCIP_EXPORT
199  SCIP* scip, /**< SCIP data structure */
200  SCIP_SEPA* sepa /**< separator */
201  );
202 
203 /** sets the parent separator
204  *
205  * Informs SCIP that the separator @p sepa depends on the parent separator @p parentsepa.
206  */
207 SCIP_EXPORT
209  SCIP* scip, /**< SCIP data structure */
210  SCIP_SEPA* sepa, /**< separator */
211  SCIP_SEPA* parentsepa /**< parent separator */
212  );
213 
214 /** gets value of minimal efficacy for a cut to enter the LP
215  *
216  * @pre This method can be called if @p scip is in one of the following stages:
217  * - \ref SCIP_STAGE_SOLVING
218  *
219  * @return value of "separating/minefficacyroot" if at root node, otherwise value of "separating/minefficacy"
220  */
221 SCIP_EXPORT
223  SCIP* scip /**< SCIP data structure */
224  );
225 
226 #ifdef NDEBUG
227 #define SCIPgetSepaMinEfficacy(scip) (SCIPtreeGetCurrentDepth((scip)->tree) == 0 ? (scip)->set->sepa_minefficacyroot : (scip)->set->sepa_minefficacy)
228 #endif
229 
230 /** @} */
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif
internal methods for branch and bound tree
SCIP_SEPA * SCIPfindSepa(SCIP *scip, const char *name)
Definition: scip_sepa.c:238
void SCIPsetSepaParentsepa(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPA *parentsepa)
Definition: scip_sepa.c:309
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_RETCODE SCIPsetSepaPriority(SCIP *scip, SCIP_SEPA *sepa, int priority)
Definition: scip_sepa.c:275
type definitions for return codes for SCIP methods
#define SCIP_DECL_SEPAEXECLP(x)
Definition: type_sepa.h:127
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
Definition: scip_sepa.c:142
#define SCIP_DECL_SEPACOPY(x)
Definition: type_sepa.h:52
SCIP_RETCODE SCIPincludeSepa(SCIP *scip, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPACOPY((*sepacopy)), SCIP_DECL_SEPAFREE((*sepafree)), SCIP_DECL_SEPAINIT((*sepainit)), SCIP_DECL_SEPAEXIT((*sepaexit)), SCIP_DECL_SEPAINITSOL((*sepainitsol)), SCIP_DECL_SEPAEXITSOL((*sepaexitsol)), SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata)
Definition: scip_sepa.c:53
SCIP_RETCODE SCIPsetSepaExit(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAEXIT((*sepaexit)))
Definition: scip_sepa.c:190
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPsetSepaInitsol(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAINITSOL((*sepainitsol)))
Definition: scip_sepa.c:206
SCIP_Real SCIPgetSepaMinEfficacy(SCIP *scip)
Definition: scip_sepa.c:330
SCIP main data structure.
void SCIPsetSepaIsParentsepa(SCIP *scip, SCIP_SEPA *sepa)
Definition: scip_sepa.c:294
SCIP_RETCODE SCIPincludeSepaBasic(SCIP *scip, SCIP_SEPA **sepa, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata)
Definition: scip_sepa.c:100
SCIP_RETCODE SCIPsetSepaExitsol(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAEXITSOL((*sepaexitsol)))
Definition: scip_sepa.c:222
#define SCIP_Bool
Definition: def.h:84
#define SCIP_DECL_SEPAINIT(x)
Definition: type_sepa.h:68
#define SCIP_DECL_SEPAEXITSOL(x)
Definition: type_sepa.h:98
#define SCIP_DECL_SEPAEXECSOL(x)
Definition: type_sepa.h:157
type definitions for storing primal CIP solutions
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
Definition: scip_sepa.c:158
SCIP_RETCODE SCIPsetSepaInit(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAINIT((*sepainit)))
Definition: scip_sepa.c:174
#define SCIP_DECL_SEPAEXIT(x)
Definition: type_sepa.h:76
type definitions for separators
#define SCIP_DECL_SEPAINITSOL(x)
Definition: type_sepa.h:87
#define SCIP_Real
Definition: def.h:177
result codes for SCIP callback methods
SCIP_SEPA ** SCIPgetSepas(SCIP *scip)
Definition: scip_sepa.c:251
int SCIPgetNSepas(SCIP *scip)
Definition: scip_sepa.c:264
common defines and data types used in all packages of SCIP
datastructures for global SCIP settings
#define SCIP_DECL_SEPAFREE(x)
Definition: type_sepa.h:60
struct SCIP_SepaData SCIP_SEPADATA
Definition: type_sepa.h:43