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_conflict.h 26 * @ingroup TYPEDEFINITIONS 27 * @brief type definitions for conflict analysis 28 * @author Tobias Achterberg 29 * 30 * This file defines the interface for conflict handler implemented in C. 31 * 32 */ 33 34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 35 36 #ifndef __SCIP_TYPE_CONFLICT_H__ 37 #define __SCIP_TYPE_CONFLICT_H__ 38 39 #include "scip/def.h" 40 #include "scip/type_scip.h" 41 #include "scip/type_retcode.h" 42 #include "scip/type_result.h" 43 #include "scip/type_tree.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 typedef struct SCIP_Conflicthdlr SCIP_CONFLICTHDLR; /**< conflict handler to process conflict sets */ 50 typedef struct SCIP_ConflicthdlrData SCIP_CONFLICTHDLRDATA; /**< conflict handler data */ 51 typedef struct SCIP_ConflictSet SCIP_CONFLICTSET; /**< set of conflicting bound changes */ 52 typedef struct SCIP_ProofSet SCIP_PROOFSET; /**< set of variables and coefficients describing a proof-constraint of type a^Tx <= rhs */ 53 typedef struct SCIP_LPBdChgs SCIP_LPBDCHGS; /**< set of LP bound changes */ 54 typedef struct SCIP_Conflict SCIP_CONFLICT; /**< conflict analysis data structure */ 55 56 /** types of conflicts */ 57 enum SCIP_ConflictType 58 { 59 SCIP_CONFTYPE_UNKNOWN = 0, /**< unknown type */ 60 SCIP_CONFTYPE_PROPAGATION = 1, /**< conflict results from propagation */ 61 SCIP_CONFTYPE_INFEASLP = 2, /**< conflict results from an infeasible LP relaxation */ 62 SCIP_CONFTYPE_BNDEXCEEDING = 3, /**< conflict results from a boundexceeding LP relaxation */ 63 SCIP_CONFTYPE_ALTINFPROOF = 4, /**< alternative proof of an infeasible LP relaxation */ 64 SCIP_CONFTYPE_ALTBNDPROOF = 5 /**< alternative proof of a boundexceeding LP relaxation */ 65 }; 66 typedef enum SCIP_ConflictType SCIP_CONFTYPE; 67 68 /** dualray presolving strategy */ 69 enum SCIP_ConflictPresolStrat 70 { 71 SCIP_CONFPRES_DISABLED = 0, /**< no presolving */ 72 SCIP_CONFPRES_ONLYLOCAL = 1, /**< keep variables contributing with its local bound */ 73 SCIP_CONFPRES_ONLYGLOBAL = 2, /**< keep variables contributing with its global bound */ 74 SCIP_CONFPRES_BOTH = 3 /**< keep variables contributing with its global bound and add a few 75 * variables contributing with its local bound such that the 76 * constraint is not globally redundant 77 */ 78 }; 79 typedef enum SCIP_ConflictPresolStrat SCIP_CONFPRES; 80 81 /** copy method for conflict handler plugins (called when SCIP copies plugins) 82 * 83 * input: 84 * - scip : SCIP main data structure 85 * - conflicthdlr : the conflict handler itself 86 */ 87 #define SCIP_DECL_CONFLICTCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr) 88 89 /** destructor of conflict handler to free conflict handler data (called when SCIP is exiting) 90 * 91 * input: 92 * - scip : SCIP main data structure 93 * - conflicthdlr : the conflict handler itself 94 */ 95 #define SCIP_DECL_CONFLICTFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr) 96 97 /** initialization method of conflict handler (called after problem was transformed) 98 * 99 * input: 100 * - scip : SCIP main data structure 101 * - conflicthdlr : the conflict handler itself 102 */ 103 #define SCIP_DECL_CONFLICTINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr) 104 105 /** deinitialization method of conflict handler (called before transformed problem is freed) 106 * 107 * input: 108 * - scip : SCIP main data structure 109 * - conflicthdlr : the conflict handler itself 110 */ 111 #define SCIP_DECL_CONFLICTEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr) 112 113 /** solving process initialization method of conflict handler (called when branch and bound process is about to begin) 114 * 115 * This method is called when the presolving was finished and the branch and bound process is about to begin. 116 * The conflict handler may use this call to initialize its branch and bound specific data. 117 * 118 * input: 119 * - scip : SCIP main data structure 120 * - conflicthdlr : the conflict handler itself 121 */ 122 #define SCIP_DECL_CONFLICTINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr) 123 124 /** solving process deinitialization method of conflict handler (called before branch and bound process data is freed) 125 * 126 * This method is called before the branch and bound process is freed. 127 * The conflict handler should use this call to clean up its branch and bound data. 128 * 129 * input: 130 * - scip : SCIP main data structure 131 * - conflicthdlr : the conflict handler itself 132 */ 133 #define SCIP_DECL_CONFLICTEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr) 134 135 /** conflict processing method of conflict handler (called when conflict was found) 136 * 137 * This method is called, when the conflict analysis found a conflict on variable bounds. 138 * The conflict handler may update its data accordingly and create a constraint out of the conflict set. 139 * If the parameter "resolved" is set, the conflict handler should not create a constraint, because 140 * a different conflict handler with higher priority already created a constraint. 141 * The bounds in the conflict set lead to a conflict (i.e. an infeasibility) when all enforced at the same time. 142 * Thus, a feasible conflict constraint must demand that at least one of the variables in the conflict 143 * set violates its corresponding bound, i.e., fulfills the negation of the bound change in the conflict set. 144 * For continuous variables, the negation has to be defined in a relaxed way: if, e.g., the bound in the conflict 145 * set is "x <= u", the negation to be used has to be "x >= u", and not "x > u". 146 * The given "bdchginfos" array representing the conflict set is only a reference to an internal 147 * buffer, that may be modified at any time by SCIP. The user must copy the needed information from the 148 * "bdchginfos" array to own data structures, if (s)he wants to use the information later. 149 * (S)he should not keep a pointer to the array or pointers to the single bdchginfos in the array, because these 150 * may get invalid afterwards. 151 * 152 * input: 153 * - scip : SCIP main data structure 154 * - conflicthdlr : the conflict handler itself 155 * - node : node to add resulting conflict constraint to (with SCIPaddConsNode()) 156 * - validnode : node at which the conflict constraint is valid (should be passed to SCIPaddConsNode()) 157 * - bdchginfos : array with bound changes that lead to a conflict 158 * - relaxedbds : array with relaxed bounds which are efficient to create a valid conflict 159 * - nbdchginfos : number of bound changes in the conflict set 160 * -.primalbound : the current primal bound, or -infininity if the conflict arises from an infeasible LP 161 * - separate : should the conflict constraint be separated? 162 * - local : is the conflict set only valid locally, i.e., should the constraint be created as local constraint? 163 * - dynamic : should the conflict constraint be made subject to aging? 164 * - removable : should the conflict's relaxation be made subject to LP aging and cleanup? 165 * - resolved : is the conflict set already used to create a constraint? 166 * - result : pointer to store the result of the conflict processing call 167 * 168 * possible return values for *result: 169 * - SCIP_CONSADDED : the conflict handler created a constraint out of the conflict set 170 * - SCIP_DIDNOTFIND : the conflict handler could not create a constraint out of the conflict set 171 * - SCIP_DIDNOTRUN : the conflict handler was skipped 172 */ 173 #define SCIP_DECL_CONFLICTEXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONFLICTHDLR* conflicthdlr, SCIP_NODE* node, \ 174 SCIP_NODE* validnode, SCIP_BDCHGINFO** bdchginfos, SCIP_Real* relaxedbds, int nbdchginfos, SCIP_CONFTYPE conftype, \ 175 SCIP_Bool cutoffinvolved, SCIP_Bool separate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, \ 176 SCIP_Bool resolved, SCIP_RESULT* result) 177 178 #ifdef __cplusplus 179 } 180 #endif 181 182 #endif 183