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, /**< implicit integer variable: Integrality of this variable is implied for every optimal
65  solution of the remaining problem after any fixing all integer and binary variables,
66  without the explicit need to enforce integrality further */
67  SCIP_VARTYPE_CONTINUOUS = 3 /**< continuous variable: \f$ lb \leq x \leq ub \f$ */
68 };
70 
71 /** domain change data type */
73 {
74  SCIP_DOMCHGTYPE_DYNAMIC = 0, /**< dynamic bound changes with size information of arrays */
75  SCIP_DOMCHGTYPE_BOTH = 1, /**< static domain changes: number of entries equals size of arrays */
76  SCIP_DOMCHGTYPE_BOUND = 2 /**< static domain changes without any hole changes */
77 };
79 
80 /** bound change type */
82 {
83  SCIP_BOUNDCHGTYPE_BRANCHING = 0, /**< bound change was due to a branching decision */
84  SCIP_BOUNDCHGTYPE_CONSINFER = 1, /**< bound change was due to an inference of a constraint (domain propagation) */
85  SCIP_BOUNDCHGTYPE_PROPINFER = 2 /**< bound change was due to an inference of a domain propagator */
86 };
88 
89 /** types of variable locks */
90 #define NLOCKTYPES 2 /**< number of lock types */
92 {
93  SCIP_LOCKTYPE_MODEL = 0, /**< variable locks for model and check constraints */
94  SCIP_LOCKTYPE_CONFLICT = 1 /**< variable locks for conflict constraints */
95 };
97 
98 typedef struct SCIP_DomChgBound SCIP_DOMCHGBOUND; /**< static domain change data for bound changes */
99 typedef struct SCIP_DomChgBoth SCIP_DOMCHGBOTH; /**< static domain change data for bound and hole changes */
100 typedef struct SCIP_DomChgDyn SCIP_DOMCHGDYN; /**< dynamic domain change data for bound and hole changes */
101 typedef union SCIP_DomChg SCIP_DOMCHG; /**< changes in domains of variables */
102 typedef struct SCIP_BoundChg SCIP_BOUNDCHG; /**< changes in bounds of variables */
103 typedef struct SCIP_BdChgIdx SCIP_BDCHGIDX; /**< bound change index in path from root to current node */
104 typedef struct SCIP_BdChgInfo SCIP_BDCHGINFO; /**< bound change information to track bound changes from root to current node */
105 typedef struct SCIP_BranchingData SCIP_BRANCHINGDATA; /**< data for branching decision bound changes */
106 typedef struct SCIP_InferenceData SCIP_INFERENCEDATA; /**< data for inferred bound changes */
107 typedef struct SCIP_HoleChg SCIP_HOLECHG; /**< changes in holelist of variables */
108 typedef struct SCIP_Hole SCIP_HOLE; /**< hole in a domain of an integer variable */
109 typedef struct SCIP_Holelist SCIP_HOLELIST; /**< list of holes in a domain of an integer variable */
110 typedef struct SCIP_Dom SCIP_DOM; /**< datastructures for storing domains of variables */
111 typedef struct SCIP_Original SCIP_ORIGINAL; /**< original variable information */
112 typedef struct SCIP_Aggregate SCIP_AGGREGATE; /**< aggregation information */
113 typedef struct SCIP_Multaggr SCIP_MULTAGGR; /**< multiple aggregation information */
114 typedef struct SCIP_Negate SCIP_NEGATE; /**< negation information */
115 typedef struct SCIP_Var SCIP_VAR; /**< variable of the problem */
116 typedef struct SCIP_VarData SCIP_VARDATA; /**< user variable data */
117 
118 /** frees user data of original variable (called when the original variable is freed)
119  *
120  * This method should free the user data of the original variable.
121  *
122  * input:
123  * - scip : SCIP main data structure
124  * - var : original variable the data to free is belonging to
125  * - vardata : pointer to the user variable data to free
126  */
127 #define SCIP_DECL_VARDELORIG(x) SCIP_RETCODE x (SCIP* scip, SCIP_VAR* var, SCIP_VARDATA** vardata)
128 
129 /** creates transformed variable for original user variable
130  *
131  * Because the original variable and the user data of the original variable should not be
132  * modified during the solving process, a transformed variable is created as a copy of
133  * the original variable. If the user variable data is never modified during the solving
134  * process anyways, it is enough to simple copy the user data's pointer. This is the
135  * default implementation, which is used when a NULL is given as VARTRANS method.
136  * If the user data may be modified during the solving process (e.g. during preprocessing),
137  * the VARTRANS method must be given and has to copy the user variable data to a different
138  * memory location.
139  *
140  * input:
141  * - scip : SCIP main data structure
142  * - sourcevar : original variable
143  * - sourcedata : source variable data to transform
144  * - targetvar : transformed variable
145  * - targetdata : pointer to store created transformed variable data
146  */
147 #define SCIP_DECL_VARTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_VAR* sourcevar, SCIP_VARDATA* sourcedata, SCIP_VAR* targetvar, SCIP_VARDATA** targetdata)
148 
149 /** frees user data of transformed variable (called when the transformed variable is freed)
150  *
151  * This method has to be implemented, if the VARTRANS method is not a simple pointer
152  * copy operation like in the default VARTRANS implementation. It should free the
153  * user data of the transformed variable, that was created in the VARTRANS method.
154  *
155  * input:
156  * - scip : SCIP main data structure
157  * - var : transformed variable the data to free is belonging to
158  * - vardata : pointer to the user variable data to free
159  */
160 #define SCIP_DECL_VARDELTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_VAR* var, SCIP_VARDATA** vardata)
161 
162 /** copies variable data of source SCIP variable for the target SCIP variable
163  *
164  * This method should copy the variable data of the source SCIP and create a target variable data for target
165  * variable. This callback is optimal. If the copying process was successful the target variable gets this variable
166  * data assigned. In case the result pointer is set to SCIP_DIDNOTRUN the target variable will have no variable data at
167  * all.
168  *
169  * The variable map and the constraint map can be used via the function SCIPgetVarCopy() and SCIPgetConsCopy(),
170  * respectively, to get for certain variables and constraints of the source SCIP the counter parts in the target
171  * SCIP. You should be very carefully in using these two methods since they could lead to infinity loop.
172  *
173  * input:
174  * - scip : target SCIP data structure
175  * - sourcescip : source SCIP main data structure
176  * - sourcevar : variable of the source SCIP
177  * - sourcedata : variable data of the source variable which should get copied
178  * - varmap, : a hashmap which stores the mapping of source variables to corresponding target variables
179  * - consmap, : a hashmap which stores the mapping of source constraints to corresponding target constraints
180  * - targetvar : variable of the (target) SCIP (targetvar is the copy of sourcevar)
181  * - targetdata : pointer to store created copy of the variable data for the (target) SCIP
182  *
183  * output:
184  * - result : pointer to store the result of the call
185  *
186  * possible return values for *result:
187  * - SCIP_DIDNOTRUN : the copying process was not performed
188  * - SCIP_SUCCESS : the copying process was successfully performed
189  */
190 #define SCIP_DECL_VARCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP* sourcescip, SCIP_VAR* sourcevar, SCIP_VARDATA* sourcedata, \
191  SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, SCIP_VAR* targetvar, SCIP_VARDATA** targetdata, SCIP_RESULT* result)
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif
SCIP_BoundchgType
Definition: type_var.h:81
SCIP_Varstatus
Definition: type_var.h:47
struct SCIP_VarData SCIP_VARDATA
Definition: type_var.h:116
struct SCIP_BranchingData SCIP_BRANCHINGDATA
Definition: type_var.h:105
enum SCIP_Varstatus SCIP_VARSTATUS
Definition: type_var.h:57
struct SCIP_InferenceData SCIP_INFERENCEDATA
Definition: type_var.h:106
enum SCIP_LockType SCIP_LOCKTYPE
Definition: type_var.h:96
SCIP_LockType
Definition: type_var.h:91
SCIP_DomchgType
Definition: type_var.h:72
enum SCIP_DomchgType SCIP_DOMCHGTYPE
Definition: type_var.h:78
enum SCIP_Vartype SCIP_VARTYPE
Definition: type_var.h:69
enum SCIP_BoundchgType SCIP_BOUNDCHGTYPE
Definition: type_var.h:87
SCIP_Vartype
Definition: type_var.h:60