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 type_var.h 17 * @ingroup TYPEDEFINITIONS 18 * @brief type definitions for problem variables 19 * @author Tobias Achterberg 20 * 21 * This file defines the interface for user variable data implemented in C. Each variable can be equipped with a 22 * variable data struct. This data can be accessed via the function SCIPgetVardata() at any time after it is created 23 * and before it is deleted. 24 * 25 * - \ref scip::ObjVardata "Corresponding C interface" 26 */ 27 28 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 29 30 #ifndef __SCIP_TYPE_VAR_H__ 31 #define __SCIP_TYPE_VAR_H__ 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /** status of problem variables */ 38 enum SCIP_Varstatus 39 { 40 SCIP_VARSTATUS_ORIGINAL = 0, /**< variable belongs to original problem */ 41 SCIP_VARSTATUS_LOOSE = 1, /**< variable is a loose variable of the transformed problem */ 42 SCIP_VARSTATUS_COLUMN = 2, /**< variable is a column of the transformed problem */ 43 SCIP_VARSTATUS_FIXED = 3, /**< variable is fixed to specific value in the transformed problem */ 44 SCIP_VARSTATUS_AGGREGATED = 4, /**< variable is aggregated to x = a*y + c in the transformed problem */ 45 SCIP_VARSTATUS_MULTAGGR = 5, /**< variable is aggregated to x = a_1*y_1 + ... + a_k*y_k + c */ 46 SCIP_VARSTATUS_NEGATED = 6 /**< variable is the negation of an original or transformed variable */ 47 }; 48 typedef enum SCIP_Varstatus SCIP_VARSTATUS; 49 50 /** variable type */ 51 enum SCIP_Vartype 52 { 53 SCIP_VARTYPE_BINARY = 0, /**< binary variable: \f$ x \in \{0,1\} \f$ */ 54 SCIP_VARTYPE_INTEGER = 1, /**< integer variable: \f$ x in \{lb, \dots, ub\} \f$ */ 55 SCIP_VARTYPE_IMPLINT = 2, /**< implicit integer variable: Integrality of this variable is implied for every optimal 56 solution of the remaining problem after any fixing all integer and binary variables, 57 without the explicit need to enforce integrality further */ 58 SCIP_VARTYPE_CONTINUOUS = 3 /**< continuous variable: \f$ lb \leq x \leq ub \f$ */ 59 }; 60 typedef enum SCIP_Vartype SCIP_VARTYPE; 61 62 /** domain change data type */ 63 enum SCIP_DomchgType 64 { 65 SCIP_DOMCHGTYPE_DYNAMIC = 0, /**< dynamic bound changes with size information of arrays */ 66 SCIP_DOMCHGTYPE_BOTH = 1, /**< static domain changes: number of entries equals size of arrays */ 67 SCIP_DOMCHGTYPE_BOUND = 2 /**< static domain changes without any hole changes */ 68 }; 69 typedef enum SCIP_DomchgType SCIP_DOMCHGTYPE; 70 71 /** bound change type */ 72 enum SCIP_BoundchgType 73 { 74 SCIP_BOUNDCHGTYPE_BRANCHING = 0, /**< bound change was due to a branching decision */ 75 SCIP_BOUNDCHGTYPE_CONSINFER = 1, /**< bound change was due to an inference of a constraint (domain propagation) */ 76 SCIP_BOUNDCHGTYPE_PROPINFER = 2 /**< bound change was due to an inference of a domain propagator */ 77 }; 78 typedef enum SCIP_BoundchgType SCIP_BOUNDCHGTYPE; 79 80 /** types of variable locks */ 81 #define NLOCKTYPES 2 /**< number of lock types */ 82 enum SCIP_LockType 83 { 84 SCIP_LOCKTYPE_MODEL = 0, /**< variable locks for model and check constraints */ 85 SCIP_LOCKTYPE_CONFLICT = 1 /**< variable locks for conflict constraints */ 86 }; 87 typedef enum SCIP_LockType SCIP_LOCKTYPE; 88 89 typedef struct SCIP_DomChgBound SCIP_DOMCHGBOUND; /**< static domain change data for bound changes */ 90 typedef struct SCIP_DomChgBoth SCIP_DOMCHGBOTH; /**< static domain change data for bound and hole changes */ 91 typedef struct SCIP_DomChgDyn SCIP_DOMCHGDYN; /**< dynamic domain change data for bound and hole changes */ 92 typedef union SCIP_DomChg SCIP_DOMCHG; /**< changes in domains of variables */ 93 typedef struct SCIP_BoundChg SCIP_BOUNDCHG; /**< changes in bounds of variables */ 94 typedef struct SCIP_BdChgIdx SCIP_BDCHGIDX; /**< bound change index in path from root to current node */ 95 typedef struct SCIP_BdChgInfo SCIP_BDCHGINFO; /**< bound change information to track bound changes from root to current node */ 96 typedef struct SCIP_BranchingData SCIP_BRANCHINGDATA; /**< data for branching decision bound changes */ 97 typedef struct SCIP_InferenceData SCIP_INFERENCEDATA; /**< data for inferred bound changes */ 98 typedef struct SCIP_HoleChg SCIP_HOLECHG; /**< changes in holelist of variables */ 99 typedef struct SCIP_Hole SCIP_HOLE; /**< hole in a domain of an integer variable */ 100 typedef struct SCIP_Holelist SCIP_HOLELIST; /**< list of holes in a domain of an integer variable */ 101 typedef struct SCIP_Dom SCIP_DOM; /**< datastructures for storing domains of variables */ 102 typedef struct SCIP_Original SCIP_ORIGINAL; /**< original variable information */ 103 typedef struct SCIP_Aggregate SCIP_AGGREGATE; /**< aggregation information */ 104 typedef struct SCIP_Multaggr SCIP_MULTAGGR; /**< multiple aggregation information */ 105 typedef struct SCIP_Negate SCIP_NEGATE; /**< negation information */ 106 typedef struct SCIP_Var SCIP_VAR; /**< variable of the problem */ 107 typedef struct SCIP_VarData SCIP_VARDATA; /**< user variable data */ 108 109 /** frees user data of original variable (called when the original variable is freed) 110 * 111 * This method should free the user data of the original variable. 112 * 113 * input: 114 * - scip : SCIP main data structure 115 * - var : original variable the data to free is belonging to 116 * - vardata : pointer to the user variable data to free 117 */ 118 #define SCIP_DECL_VARDELORIG(x) SCIP_RETCODE x (SCIP* scip, SCIP_VAR* var, SCIP_VARDATA** vardata) 119 120 /** creates transformed variable for original user variable 121 * 122 * Because the original variable and the user data of the original variable should not be 123 * modified during the solving process, a transformed variable is created as a copy of 124 * the original variable. If the user variable data is never modified during the solving 125 * process anyways, it is enough to simple copy the user data's pointer. This is the 126 * default implementation, which is used when a NULL is given as VARTRANS method. 127 * If the user data may be modified during the solving process (e.g. during preprocessing), 128 * the VARTRANS method must be given and has to copy the user variable data to a different 129 * memory location. 130 * 131 * input: 132 * - scip : SCIP main data structure 133 * - sourcevar : original variable 134 * - sourcedata : source variable data to transform 135 * - targetvar : transformed variable 136 * - targetdata : pointer to store created transformed variable data 137 */ 138 #define SCIP_DECL_VARTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_VAR* sourcevar, SCIP_VARDATA* sourcedata, SCIP_VAR* targetvar, SCIP_VARDATA** targetdata) 139 140 /** frees user data of transformed variable (called when the transformed variable is freed) 141 * 142 * This method has to be implemented, if the VARTRANS method is not a simple pointer 143 * copy operation like in the default VARTRANS implementation. It should free the 144 * user data of the transformed variable, that was created in the VARTRANS method. 145 * 146 * input: 147 * - scip : SCIP main data structure 148 * - var : transformed variable the data to free is belonging to 149 * - vardata : pointer to the user variable data to free 150 */ 151 #define SCIP_DECL_VARDELTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_VAR* var, SCIP_VARDATA** vardata) 152 153 /** copies variable data of source SCIP variable for the target SCIP variable 154 * 155 * This method should copy the variable data of the source SCIP and create a target variable data for target 156 * variable. This callback is optimal. If the copying process was successful the target variable gets this variable 157 * data assigned. In case the result pointer is set to SCIP_DIDNOTRUN the target variable will have no variable data at 158 * all. 159 * 160 * The variable map and the constraint map can be used via the function SCIPgetVarCopy() and SCIPgetConsCopy(), 161 * respectively, to get for certain variables and constraints of the source SCIP the counter parts in the target 162 * SCIP. You should be very carefully in using these two methods since they could lead to infinity loop. 163 * 164 * input: 165 * - scip : target SCIP data structure 166 * - sourcescip : source SCIP main data structure 167 * - sourcevar : variable of the source SCIP 168 * - sourcedata : variable data of the source variable which should get copied 169 * - varmap, : a hashmap which stores the mapping of source variables to corresponding target variables 170 * - consmap, : a hashmap which stores the mapping of source constraints to corresponding target constraints 171 * - targetvar : variable of the (target) SCIP (targetvar is the copy of sourcevar) 172 * - targetdata : pointer to store created copy of the variable data for the (target) SCIP 173 * 174 * output: 175 * - result : pointer to store the result of the call 176 * 177 * possible return values for *result: 178 * - SCIP_DIDNOTRUN : the copying process was not performed 179 * - SCIP_SUCCESS : the copying process was successfully performed 180 */ 181 #define SCIP_DECL_VARCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP* sourcescip, SCIP_VAR* sourcevar, SCIP_VARDATA* sourcedata, \ 182 SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, SCIP_VAR* targetvar, SCIP_VARDATA** targetdata, SCIP_RESULT* result) 183 184 #ifdef __cplusplus 185 } 186 #endif 187 188 #endif 189