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 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 72 SCIP_RETCODE SCIPincludeSepa( 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 101 SCIP_RETCODE SCIPincludeSepaBasic( 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 119 SCIP_RETCODE SCIPsetSepaCopy( 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 127 SCIP_RETCODE SCIPsetSepaFree( 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 135 SCIP_RETCODE SCIPsetSepaInit( 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 143 SCIP_RETCODE SCIPsetSepaExit( 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 151 SCIP_RETCODE SCIPsetSepaInitsol( 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 159 SCIP_RETCODE SCIPsetSepaExitsol( 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 167 SCIP_SEPA* SCIPfindSepa( 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 174 SCIP_SEPA** SCIPgetSepas( 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 186 SCIP_RETCODE SCIPsetSepaPriority( 187 SCIP* scip, /**< SCIP data structure */ 188 SCIP_SEPA* sepa, /**< separator */ 189 int priority /**< new priority of the separator */ 190 ); 191 192 /** gets value of minimal efficacy for a cut to enter the LP 193 * 194 * @pre This method can be called if @p scip is in one of the following stages: 195 * - \ref SCIP_STAGE_SOLVING 196 * 197 * @return value of "separating/minefficacyroot" if at root node, otherwise value of "separating/minefficacy" 198 */ 199 SCIP_EXPORT 200 SCIP_Real SCIPgetSepaMinEfficacy( 201 SCIP* scip /**< SCIP data structure */ 202 ); 203 204 #ifdef NDEBUG 205 #define SCIPgetSepaMinEfficacy(scip) (SCIPtreeGetCurrentDepth((scip)->tree) == 0 ? (scip)->set->sepa_minefficacyroot : (scip)->set->sepa_minefficacy) 206 #endif 207 208 /** @} */ 209 210 #ifdef __cplusplus 211 } 212 #endif 213 214 #endif 215