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