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 compr.h 26 * @ingroup INTERNALAPI 27 * @brief internal methods for tree compressions 28 * @author Jakob Witzig 29 */ 30 31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 32 33 #ifndef __SCIP_COMPR_H__ 34 #define __SCIP_COMPR_H__ 35 36 37 #include "scip/def.h" 38 #include "blockmemshell/memory.h" 39 #include "scip/type_reopt.h" 40 #include "scip/type_retcode.h" 41 #include "scip/type_result.h" 42 #include "scip/type_set.h" 43 #include "scip/type_compr.h" 44 #include "scip/pub_compr.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /** copies the given tree compression to a new scip */ 51 SCIP_RETCODE SCIPcomprCopyInclude( 52 SCIP_COMPR* compr, /**< tree compression */ 53 SCIP_SET* set /**< SCIP_SET of SCIP to copy to */ 54 ); 55 56 /** creates a tree compression */ 57 SCIP_RETCODE SCIPcomprCreate( 58 SCIP_COMPR** compr, /**< pointer to tree compression data structure */ 59 SCIP_SET* set, /**< global SCIP settings */ 60 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 61 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */ 62 const char* name, /**< name of tree compression */ 63 const char* desc, /**< description of tree compression */ 64 int priority, /**< priority of the tree compression */ 65 int minnnodes, /**< minimal number of nodes for calling compression */ 66 SCIP_DECL_COMPRCOPY ((*comprcopy)), /**< copy method of tree compression or NULL if you don't want to copy 67 * your plugin into sub-SCIPs */ 68 SCIP_DECL_COMPRFREE ((*comprfree)), /**< destructor of tree compression */ 69 SCIP_DECL_COMPRINIT ((*comprinit)), /**< initialize tree compression */ 70 SCIP_DECL_COMPREXIT ((*comprexit)), /**< deinitialize tree compression */ 71 SCIP_DECL_COMPRINITSOL ((*comprinitsol)), /**< solving process initialization method of tree compression */ 72 SCIP_DECL_COMPREXITSOL ((*comprexitsol)), /**< solving process deinitialization method of tree compression */ 73 SCIP_DECL_COMPREXEC ((*comprexec)), /**< execution method of tree compression */ 74 SCIP_COMPRDATA* comprdata /**< tree compression data */ 75 ); 76 77 /** calls destructor and frees memory of tree compression */ 78 SCIP_RETCODE SCIPcomprFree( 79 SCIP_COMPR** compr, /**< pointer to tree compression data structure */ 80 SCIP_SET* set /**< global SCIP settings */ 81 ); 82 83 /** initializes tree compression */ 84 SCIP_RETCODE SCIPcomprInit( 85 SCIP_COMPR* compr, /**< tree compression */ 86 SCIP_SET* set /**< global SCIP settings */ 87 ); 88 89 /** calls exit method of tree compression */ 90 SCIP_RETCODE SCIPcomprExit( 91 SCIP_COMPR* compr, /**< tree compression */ 92 SCIP_SET* set /**< global SCIP settings */ 93 ); 94 95 /** informs tree compression that the branch and bound process is being started */ 96 SCIP_RETCODE SCIPcomprInitsol( 97 SCIP_COMPR* compr, /**< tree compression */ 98 SCIP_SET* set /**< global SCIP settings */ 99 ); 100 101 /** informs tree compression that the branch and bound process data is being freed */ 102 SCIP_RETCODE SCIPcomprExitsol( 103 SCIP_COMPR* compr, /**< tree compression */ 104 SCIP_SET* set /**< global SCIP settings */ 105 ); 106 107 /** calls execution method of tree compression */ 108 SCIP_RETCODE SCIPcomprExec( 109 SCIP_COMPR* compr, /**< tree compression */ 110 SCIP_SET* set, /**< global SCIP settings */ 111 SCIP_REOPT* reopt, /**< reoptimization data structure */ 112 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 113 ); 114 115 /** sets priority of tree compression */ 116 void SCIPcomprSetPriority( 117 SCIP_COMPR* compr, /**< tree compression */ 118 SCIP_SET* set, /**< global SCIP settings */ 119 int priority /**< new priority of the tree compression */ 120 ); 121 122 /** sets copy callback of tree compression */ 123 void SCIPcomprSetCopy( 124 SCIP_COMPR* compr, /**< tree compression */ 125 SCIP_DECL_COMPRCOPY ((*comprcopy)) /**< copy callback of tree compression or NULL if you don't want to copy your plugin into sub-SCIPs */ 126 ); 127 128 /** sets destructor callback of tree compression */ 129 void SCIPcomprSetFree( 130 SCIP_COMPR* compr, /**< tree compression */ 131 SCIP_DECL_COMPRFREE ((*comprfree)) /**< destructor of tree compression */ 132 ); 133 134 /** sets initialization callback of tree compression */ 135 void SCIPcomprSetInit( 136 SCIP_COMPR* compr, /**< tree compression */ 137 SCIP_DECL_COMPRINIT ((*comprinit)) /**< initialize tree compression */ 138 ); 139 140 /** sets deinitialization callback of tree compression */ 141 void SCIPcomprSetExit( 142 SCIP_COMPR* compr, /**< tree compression */ 143 SCIP_DECL_COMPREXIT ((*comprexit)) /**< deinitialize tree compression */ 144 ); 145 146 /** sets solving process initialization callback of tree compression */ 147 void SCIPcomprSetInitsol( 148 SCIP_COMPR* compr, /**< tree compression */ 149 SCIP_DECL_COMPRINITSOL ((*comprinitsol)) /**< solving process initialization callback of tree compression */ 150 ); 151 152 /** sets solving process deinitialization callback of tree compression */ 153 void SCIPcomprSetExitsol( 154 SCIP_COMPR* compr, /**< tree compression */ 155 SCIP_DECL_COMPREXITSOL ((*comprexitsol)) /**< solving process deinitialization callback of tree compression */ 156 ); 157 158 /** should the compression be executed at the given depth, frequency, timing, ... */ 159 SCIP_EXPORT 160 SCIP_Bool SCIPcomprShouldBeExecuted( 161 SCIP_COMPR* compr, /**< tree compression */ 162 int depth, /**< depth of current node */ 163 int nnodes /**< number of open nodes */ 164 ); 165 166 #ifdef __cplusplus 167 } 168 #endif 169 170 #endif 171