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 prop.h 26 * @ingroup INTERNALAPI 27 * @brief internal methods for propagators 28 * @author Tobias Achterberg 29 */ 30 31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 32 33 #ifndef __SCIP_PROP_H__ 34 #define __SCIP_PROP_H__ 35 36 37 #include "scip/def.h" 38 #include "blockmemshell/memory.h" 39 #include "scip/type_retcode.h" 40 #include "scip/type_result.h" 41 #include "scip/type_set.h" 42 #include "scip/type_stat.h" 43 #include "scip/type_lp.h" 44 #include "scip/type_var.h" 45 #include "scip/type_prop.h" 46 #include "scip/pub_prop.h" 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 /** copies the given propagator to a new scip */ 53 SCIP_RETCODE SCIPpropCopyInclude( 54 SCIP_PROP* prop, /**< propagator */ 55 SCIP_SET* set /**< SCIP_SET of SCIP to copy to */ 56 ); 57 58 /** creates a propagator */ 59 SCIP_RETCODE SCIPpropCreate( 60 SCIP_PROP** prop, /**< pointer to propagator data structure */ 61 SCIP_SET* set, /**< global SCIP settings */ 62 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 63 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */ 64 const char* name, /**< name of propagator */ 65 const char* desc, /**< description of propagator */ 66 int priority, /**< priority of propagator (>= 0: before, < 0: after constraint handlers) */ 67 int freq, /**< frequency for calling propagator */ 68 SCIP_Bool delay, /**< should propagator be delayed, if other propagators found reductions? */ 69 SCIP_PROPTIMING timingmask, /**< positions in the node solving loop where propagator should be executed */ 70 int presolpriority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */ 71 int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */ 72 SCIP_PRESOLTIMING presoltiming, /**< timing mask of the propagator's presolving method */ 73 SCIP_DECL_PROPCOPY ((*propcopy)), /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */ 74 SCIP_DECL_PROPFREE ((*propfree)), /**< destructor of propagator */ 75 SCIP_DECL_PROPINIT ((*propinit)), /**< initialize propagator */ 76 SCIP_DECL_PROPEXIT ((*propexit)), /**< deinitialize propagator */ 77 SCIP_DECL_PROPINITPRE ((*propinitpre)), /**< presolving initialization method of propagator */ 78 SCIP_DECL_PROPEXITPRE ((*propexitpre)), /**< presolving deinitialization method of propagator */ 79 SCIP_DECL_PROPINITSOL ((*propinitsol)), /**< solving process initialization method of propagator */ 80 SCIP_DECL_PROPEXITSOL ((*propexitsol)), /**< solving process deinitialization method of propagator */ 81 SCIP_DECL_PROPPRESOL ((*proppresol)), /**< presolving method */ 82 SCIP_DECL_PROPEXEC ((*propexec)), /**< execution method of propagator */ 83 SCIP_DECL_PROPRESPROP ((*propresprop)), /**< propagation conflict resolving method */ 84 SCIP_PROPDATA* propdata /**< propagator data */ 85 ); 86 87 /** calls destructor and frees memory of propagator */ 88 SCIP_RETCODE SCIPpropFree( 89 SCIP_PROP** prop, /**< pointer to propagator data structure */ 90 SCIP_SET* set /**< global SCIP settings */ 91 ); 92 93 /** initializes propagator */ 94 SCIP_RETCODE SCIPpropInit( 95 SCIP_PROP* prop, /**< propagator */ 96 SCIP_SET* set /**< global SCIP settings */ 97 ); 98 99 /** calls exit method of propagator */ 100 SCIP_RETCODE SCIPpropExit( 101 SCIP_PROP* prop, /**< propagator */ 102 SCIP_SET* set /**< global SCIP settings */ 103 ); 104 105 /** informs propagator that the presolving process is being started */ 106 SCIP_RETCODE SCIPpropInitpre( 107 SCIP_PROP* prop, /**< propagator */ 108 SCIP_SET* set /**< global SCIP settings */ 109 ); 110 111 /** informs propagator that the presolving is finished */ 112 SCIP_RETCODE SCIPpropExitpre( 113 SCIP_PROP* prop, /**< propagator */ 114 SCIP_SET* set /**< global SCIP settings */ 115 ); 116 117 /** informs propagator that the branch and bound process is being started */ 118 SCIP_RETCODE SCIPpropInitsol( 119 SCIP_PROP* prop, /**< propagator */ 120 SCIP_SET* set /**< global SCIP settings */ 121 ); 122 123 /** informs propagator that the branch and bound process data is being freed */ 124 SCIP_RETCODE SCIPpropExitsol( 125 SCIP_PROP* prop, /**< propagator */ 126 SCIP_SET* set, /**< global SCIP settings */ 127 SCIP_Bool restart /**< was this exit solve call triggered by a restart? */ 128 ); 129 130 /** executes presolving method of propagator */ 131 SCIP_RETCODE SCIPpropPresol( 132 SCIP_PROP* prop, /**< propagator */ 133 SCIP_SET* set, /**< global SCIP settings */ 134 SCIP_PRESOLTIMING timing, /**< current presolving timing */ 135 int nrounds, /**< number of presolving rounds already done */ 136 int* nfixedvars, /**< pointer to total number of variables fixed of all presolvers */ 137 int* naggrvars, /**< pointer to total number of variables aggregated of all presolvers */ 138 int* nchgvartypes, /**< pointer to total number of variable type changes of all presolvers */ 139 int* nchgbds, /**< pointer to total number of variable bounds tightened of all presolvers */ 140 int* naddholes, /**< pointer to total number of domain holes added of all presolvers */ 141 int* ndelconss, /**< pointer to total number of deleted constraints of all presolvers */ 142 int* naddconss, /**< pointer to total number of added constraints of all presolvers */ 143 int* nupgdconss, /**< pointer to total number of upgraded constraints of all presolvers */ 144 int* nchgcoefs, /**< pointer to total number of changed coefficients of all presolvers */ 145 int* nchgsides, /**< pointer to total number of changed left/right hand sides of all presolvers */ 146 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 147 ); 148 149 /** calls execution method of propagator */ 150 SCIP_RETCODE SCIPpropExec( 151 SCIP_PROP* prop, /**< propagator */ 152 SCIP_SET* set, /**< global SCIP settings */ 153 SCIP_STAT* stat, /**< dynamic problem statistics */ 154 int depth, /**< depth of current node */ 155 SCIP_Bool execdelayed, /**< execute propagator even if it is marked to be delayed */ 156 SCIP_Bool instrongbranching, /**< are we currently doing strong branching? */ 157 SCIP_PROPTIMING proptiming, /**< current point in the node solving process */ 158 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 159 ); 160 161 /** resolves the given conflicting bound, that was deduced by the given propagator, by putting all "reason" bounds 162 * leading to the deduction into the conflict queue with calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), 163 * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar(); 164 * 165 * @note it is sufficient to explain the relaxed bound change 166 */ 167 SCIP_RETCODE SCIPpropResolvePropagation( 168 SCIP_PROP* prop, /**< propagator */ 169 SCIP_SET* set, /**< global SCIP settings */ 170 SCIP_VAR* infervar, /**< variable whose bound was deduced by the constraint */ 171 int inferinfo, /**< user inference information attached to the bound change */ 172 SCIP_BOUNDTYPE inferboundtype, /**< bound that was deduced (lower or upper bound) */ 173 SCIP_BDCHGIDX* bdchgidx, /**< bound change index, representing the point of time where change took place */ 174 SCIP_Real relaxedbd, /**< the relaxed bound */ 175 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 176 ); 177 178 /** sets priority of propagator */ 179 void SCIPpropSetPriority( 180 SCIP_PROP* prop, /**< propagator */ 181 SCIP_SET* set, /**< global SCIP settings */ 182 int priority /**< new priority of the propagator */ 183 ); 184 185 /** sets presolving priority of propagator */ 186 void SCIPpropSetPresolPriority( 187 SCIP_PROP* prop, /**< propagator */ 188 SCIP_SET* set, /**< global SCIP settings */ 189 int presolpriority /**< new priority of the propagator */ 190 ); 191 192 /** sets copy method of propagator */ 193 void SCIPpropSetCopy( 194 SCIP_PROP* prop, /**< propagator */ 195 SCIP_DECL_PROPCOPY ((*propcopy)) /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */ 196 ); 197 198 /** sets destructor method of propagator */ 199 void SCIPpropSetFree( 200 SCIP_PROP* prop, /**< propagator */ 201 SCIP_DECL_PROPFREE ((*propfree)) /**< destructor of propagator */ 202 ); 203 204 /** sets initialization method of propagator */ 205 void SCIPpropSetInit( 206 SCIP_PROP* prop, /**< propagator */ 207 SCIP_DECL_PROPINIT ((*propinit)) /**< initialize propagator */ 208 ); 209 210 /** sets deinitialization method of propagator */ 211 void SCIPpropSetExit( 212 SCIP_PROP* prop, /**< propagator */ 213 SCIP_DECL_PROPEXIT ((*propexit)) /**< deinitialize propagator */ 214 ); 215 216 /** sets solving process initialization method of propagator */ 217 void SCIPpropSetInitsol( 218 SCIP_PROP* prop, /**< propagator */ 219 SCIP_DECL_PROPINITSOL((*propinitsol)) /**< solving process initialization method of propagator */ 220 ); 221 222 /** sets solving process deinitialization method of propagator */ 223 void SCIPpropSetExitsol( 224 SCIP_PROP* prop, /**< propagator */ 225 SCIP_DECL_PROPEXITSOL ((*propexitsol)) /**< solving process deinitialization method of propagator */ 226 ); 227 228 /** sets preprocessing initialization method of propagator */ 229 void SCIPpropSetInitpre( 230 SCIP_PROP* prop, /**< propagator */ 231 SCIP_DECL_PROPINITPRE((*propinitpre)) /**< preprocessing initialization method of propagator */ 232 ); 233 234 /** sets preprocessing deinitialization method of propagator */ 235 void SCIPpropSetExitpre( 236 SCIP_PROP* prop, /**< propagator */ 237 SCIP_DECL_PROPEXITPRE((*propexitpre)) /**< preprocessing deinitialization method of propagator */ 238 ); 239 240 /** sets presolving method of propagator */ 241 SCIP_RETCODE SCIPpropSetPresol( 242 SCIP_PROP* prop, /**< propagator */ 243 SCIP_DECL_PROPPRESOL ((*proppresol)), /**< presolving method */ 244 int presolpriority, /**< presolving priority of the propagator (>= 0: before, < 0: after constraint handlers) */ 245 int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */ 246 SCIP_PRESOLTIMING presoltiming /**< timing mask of the propagator's presolving method */ 247 ); 248 249 /** sets propagation conflict resolving callback of propagator */ 250 void SCIPpropSetResprop( 251 SCIP_PROP* prop, /**< propagator */ 252 SCIP_DECL_PROPRESPROP ((*propresprop)) /**< propagation conflict resolving callback */ 253 ); 254 255 /** enables or disables all clocks of \p prop, depending on the value of the flag */ 256 void SCIPpropEnableOrDisableClocks( 257 SCIP_PROP* prop, /**< the propagator for which all clocks should be enabled or disabled */ 258 SCIP_Bool enable /**< should the clocks of the propagator be enabled? */ 259 ); 260 261 #ifdef __cplusplus 262 } 263 #endif 264 265 #endif 266