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 type_presol.h 26 * @ingroup TYPEDEFINITIONS 27 * @brief type definitions for presolvers 28 * @author Tobias Achterberg 29 */ 30 31 /** @defgroup DEFPLUGINS_PRESOL Default Presolvers 32 * @ingroup DEFPLUGINS 33 * @brief implementation files (.c files) of the default presolvers of SCIP 34 */ 35 36 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 37 38 #ifndef __SCIP_TYPE_PRESOL_H__ 39 #define __SCIP_TYPE_PRESOL_H__ 40 41 #include "scip/def.h" 42 #include "scip/type_retcode.h" 43 #include "scip/type_result.h" 44 #include "scip/type_scip.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 typedef struct SCIP_Presol SCIP_PRESOL; /**< presolver data structure */ 51 typedef struct SCIP_PresolData SCIP_PRESOLDATA; /**< presolver specific data */ 52 53 54 /** copy method for presolver plugins (called when SCIP copies plugins) 55 * 56 * input: 57 * - scip : SCIP main data structure 58 * - presol : the presolver itself 59 */ 60 #define SCIP_DECL_PRESOLCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol) 61 62 /** destructor of presolver to free user data (called when SCIP is exiting) 63 * 64 * input: 65 * - scip : SCIP main data structure 66 * - presol : the presolver itself 67 */ 68 #define SCIP_DECL_PRESOLFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol) 69 70 /** initialization method of presolver (called after problem was transformed) 71 * 72 * input: 73 * - scip : SCIP main data structure 74 * - presol : the presolver itself 75 */ 76 #define SCIP_DECL_PRESOLINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol) 77 78 /** deinitialization method of presolver (called before transformed problem is freed) 79 * 80 * input: 81 * - scip : SCIP main data structure 82 * - presol : the presolver itself 83 */ 84 #define SCIP_DECL_PRESOLEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol) 85 86 /** presolving initialization method of presolver (called when presolving is about to begin) 87 * 88 * This method is called when the presolving process is about to begin, even if presolving is turned off. 89 * The presolver may use this call to initialize its data structures. 90 * 91 * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the 92 * presolving deinitialization call (SCIP_DECL_PRESOLSEXITPRE()). 93 * 94 * input: 95 * - scip : SCIP main data structure 96 * - presol : the presolver itself 97 */ 98 #define SCIP_DECL_PRESOLINITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol) 99 100 /** presolving deinitialization method of presolver (called after presolving has been finished) 101 * 102 * This method is called after the presolving has been finished, even if presolving is turned off. 103 * The presolver may use this call e.g. to clean up or modify its data structures. 104 * 105 * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the 106 * presolving initialization call (SCIP_DECL_PRESOLINITPRE()). 107 * 108 * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the 109 * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL, 110 * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD. 111 * 112 * input: 113 * - scip : SCIP main data structure 114 * - presol : the presolver itself 115 */ 116 #define SCIP_DECL_PRESOLEXITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol) 117 118 /** execution method of presolver 119 * 120 * The presolver should go through the variables and constraints and tighten the domains or 121 * constraints. Each tightening should increase the given total numbers of changes. 122 * 123 * input: 124 * - scip : SCIP main data structure 125 * - presol : the presolver itself 126 * - nrounds : number of presolving rounds already done 127 * - presoltiming : current presolving timing 128 * - nnewfixedvars : number of variables fixed since the last call to the presolver 129 * - nnewaggrvars : number of variables aggregated since the last call to the presolver 130 * - nnewchgvartypes : number of variable type changes since the last call to the presolver 131 * - nnewchgbds : number of variable bounds tightened since the last call to the presolver 132 * - nnewholes : number of domain holes added since the last call to the presolver 133 * - nnewdelconss : number of deleted constraints since the last call to the presolver 134 * - nnewaddconss : number of added constraints since the last call to the presolver 135 * - nnewupgdconss : number of upgraded constraints since the last call to the presolver 136 * - nnewchgcoefs : number of changed coefficients since the last call to the presolver 137 * - nnewchgsides : number of changed left or right hand sides since the last call to the presolver 138 * 139 * @note the counters state the changes since the last call including the changes of this presolver during its last 140 * last call 141 * 142 * @note if the presolver uses dual information it is nesassary to check via calling SCIPallowWeakDualReds and 143 * SCIPallowStrongDualReds if dual reductions are allowed. 144 * 145 * input/output: 146 * - nfixedvars : pointer to total number of variables fixed of all presolvers 147 * - naggrvars : pointer to total number of variables aggregated of all presolvers 148 * - nchgvartypes : pointer to total number of variable type changes of all presolvers 149 * - nchgbds : pointer to total number of variable bounds tightened of all presolvers 150 * - naddholes : pointer to total number of domain holes added of all presolvers 151 * - ndelconss : pointer to total number of deleted constraints of all presolvers 152 * - naddconss : pointer to total number of added constraints of all presolvers 153 * - nupgdconss : pointer to total number of upgraded constraints of all presolvers 154 * - nchgcoefs : pointer to total number of changed coefficients of all presolvers 155 * - nchgsides : pointer to total number of changed left/right hand sides of all presolvers 156 * 157 * output: 158 * - result : pointer to store the result of the presolving call 159 * 160 * possible return values for *result: 161 * - SCIP_UNBOUNDED : at least one variable is not bounded by any constraint in obj. direction -> problem is unbounded 162 * - SCIP_CUTOFF : at least one constraint is infeasible in the variable's bounds -> problem is infeasible 163 * - SCIP_SUCCESS : the presolver found a reduction 164 * - SCIP_DIDNOTFIND : the presolver searched, but did not find a presolving change 165 * - SCIP_DIDNOTRUN : the presolver was skipped 166 */ 167 #define SCIP_DECL_PRESOLEXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol, int nrounds, SCIP_PRESOLTIMING presoltiming, \ 168 int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, \ 169 int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, \ 170 int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes, \ 171 int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result) 172 173 #ifdef __cplusplus 174 } 175 #endif 176 177 #endif 178