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