Scippy

SCIP

Solving Constraint Integer Programs

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