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