Scippy

SCIP

Solving Constraint Integer Programs

type_event.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-2020 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_event.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief type definitions for managing events
19  * @author Tobias Achterberg
20  * @author Leona Gottwald
21  *
22  * This file defines the interface for event handler implemented in C.
23  *
24  * - \ref scip::ObjEventhdlr "C++ wrapper class"
25  */
26 
27 /** @defgroup DEFPLUGINS_EVENT Default event handlers
28  * @ingroup DEFPLUGINS
29  * @brief implementation files (.c files) of the default event handlers of SCIP
30  */
31 
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #ifndef __SCIP_TYPE_EVENT_H__
35 #define __SCIP_TYPE_EVENT_H__
36 
37 #include "scip/def.h"
38 #include "scip/type_retcode.h"
39 #include "scip/type_scip.h"
40 
41 #if !defined(_MSC_VER) || _MSC_VER > 1600
42 #ifdef __cplusplus
43 #define __STDC_FORMAT_MACROS
44 #endif
45 #include <inttypes.h>
46 #else
47 #define PRIx64 "llx"
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /*
55  * event types
56  */
57 
58 #define SCIP_EVENTTYPE_DISABLED UINT64_C(0x000000000) /**< the event was disabled and has no effect any longer */
59 
60 /* variable events */
61 #define SCIP_EVENTTYPE_VARADDED UINT64_C(0x000000001) /**< a variable has been added to the transformed problem */
62 #define SCIP_EVENTTYPE_VARDELETED UINT64_C(0x000000002) /**< a variable will be deleted from the transformed problem */
63 #define SCIP_EVENTTYPE_VARFIXED UINT64_C(0x000000004) /**< a variable has been fixed, aggregated, or multi-aggregated */
64 #define SCIP_EVENTTYPE_VARUNLOCKED UINT64_C(0x000000008) /**< the number of rounding locks of a variable was reduced to zero or one */
65 #define SCIP_EVENTTYPE_OBJCHANGED UINT64_C(0x000000010) /**< the objective value of a variable has been changed */
66 #define SCIP_EVENTTYPE_GLBCHANGED UINT64_C(0x000000020) /**< the global lower bound of a variable has been changed */
67 #define SCIP_EVENTTYPE_GUBCHANGED UINT64_C(0x000000040) /**< the global upper bound of a variable has been changed */
68 #define SCIP_EVENTTYPE_LBTIGHTENED UINT64_C(0x000000080) /**< the local lower bound of a variable has been increased */
69 #define SCIP_EVENTTYPE_LBRELAXED UINT64_C(0x000000100) /**< the local lower bound of a variable has been decreased */
70 #define SCIP_EVENTTYPE_UBTIGHTENED UINT64_C(0x000000200) /**< the local upper bound of a variable has been decreased */
71 #define SCIP_EVENTTYPE_UBRELAXED UINT64_C(0x000000400) /**< the local upper bound of a variable has been increased */
72 #define SCIP_EVENTTYPE_GHOLEADDED UINT64_C(0x000000800) /**< a global hole has been added to the hole list of a variable's domain */
73 #define SCIP_EVENTTYPE_GHOLEREMOVED UINT64_C(0x000001000) /**< a global hole has been removed from the hole list of a variable's domain */
74 #define SCIP_EVENTTYPE_LHOLEADDED UINT64_C(0x000002000) /**< a local hole has been added to the hole list of a variable's domain */
75 #define SCIP_EVENTTYPE_LHOLEREMOVED UINT64_C(0x000004000) /**< a local hole has been removed from the hole list of a variable's domain */
76 #define SCIP_EVENTTYPE_IMPLADDED UINT64_C(0x000008000) /**< the variable's implication list, variable bound or clique information was extended */
77 #define SCIP_EVENTTYPE_TYPECHANGED UINT64_C(0x000010000) /**< the type of a variable has changed */
78 
79 /* presolving events */
80 #define SCIP_EVENTTYPE_PRESOLVEROUND UINT64_C(0x000020000) /**< a presolving round has been finished */
81 
82 /* node events */
83 #define SCIP_EVENTTYPE_NODEFOCUSED UINT64_C(0x000040000) /**< a node has been focused and is now the focus node */
84 #define SCIP_EVENTTYPE_NODEFEASIBLE UINT64_C(0x000080000) /**< the LP/pseudo solution of the node was feasible */
85 #define SCIP_EVENTTYPE_NODEINFEASIBLE UINT64_C(0x000100000) /**< the focus node has been proven to be infeasible or was bounded */
86 #define SCIP_EVENTTYPE_NODEBRANCHED UINT64_C(0x000200000) /**< the focus node has been solved by branching */
87 #define SCIP_EVENTTYPE_NODEDELETE UINT64_C(0x000400000) /**< a node is about to be deleted from the tree */
88 
89 
90 /* LP events */
91 #define SCIP_EVENTTYPE_FIRSTLPSOLVED UINT64_C(0x000800000) /**< the node's initial LP was solved */
92 #define SCIP_EVENTTYPE_LPSOLVED UINT64_C(0x001000000) /**< the node's LP was completely solved with cut & price */
93 
94 /* primal solution events */
95 #define SCIP_EVENTTYPE_POORSOLFOUND UINT64_C(0x002000000) /**< a good enough primal feasible (but not new best) solution was found */
96 #define SCIP_EVENTTYPE_BESTSOLFOUND UINT64_C(0x004000000) /**< a new best primal feasible solution was found */
97 
98 /* linear row events */
99 #define SCIP_EVENTTYPE_ROWADDEDSEPA UINT64_C(0x008000000) /**< a row has been added to SCIP's separation storage */
100 #define SCIP_EVENTTYPE_ROWDELETEDSEPA UINT64_C(0x010000000) /**< a row has been removed from SCIP's separation storage */
101 #define SCIP_EVENTTYPE_ROWADDEDLP UINT64_C(0x020000000) /**< a row has been added to the LP */
102 #define SCIP_EVENTTYPE_ROWDELETEDLP UINT64_C(0x040000000) /**< a row has been removed from the LP */
103 #define SCIP_EVENTTYPE_ROWCOEFCHANGED UINT64_C(0x080000000) /**< a coefficient of a row has been changed (row specific event) */
104 #define SCIP_EVENTTYPE_ROWCONSTCHANGED UINT64_C(0x100000000) /**< the constant of a row has been changed (row specific event) */
105 #define SCIP_EVENTTYPE_ROWSIDECHANGED UINT64_C(0x200000000) /**< a side of a row has been changed (row specific event) */
106 
107 /* sync event */
108 #define SCIP_EVENTTYPE_SYNC UINT64_C(0x400000000) /**< synchronization event */
109 
110 /* event masks for variable events */
111 #define SCIP_EVENTTYPE_GBDCHANGED (SCIP_EVENTTYPE_GLBCHANGED | SCIP_EVENTTYPE_GUBCHANGED)
112 #define SCIP_EVENTTYPE_LBCHANGED (SCIP_EVENTTYPE_LBTIGHTENED | SCIP_EVENTTYPE_LBRELAXED)
113 #define SCIP_EVENTTYPE_UBCHANGED (SCIP_EVENTTYPE_UBTIGHTENED | SCIP_EVENTTYPE_UBRELAXED)
114 #define SCIP_EVENTTYPE_BOUNDTIGHTENED (SCIP_EVENTTYPE_LBTIGHTENED | SCIP_EVENTTYPE_UBTIGHTENED)
115 #define SCIP_EVENTTYPE_BOUNDRELAXED (SCIP_EVENTTYPE_LBRELAXED | SCIP_EVENTTYPE_UBRELAXED)
116 #define SCIP_EVENTTYPE_BOUNDCHANGED (SCIP_EVENTTYPE_LBCHANGED | SCIP_EVENTTYPE_UBCHANGED)
117 #define SCIP_EVENTTYPE_GHOLECHANGED (SCIP_EVENTTYPE_GHOLEADDED | SCIP_EVENTTYPE_GHOLEREMOVED)
118 #define SCIP_EVENTTYPE_LHOLECHANGED (SCIP_EVENTTYPE_LHOLEADDED | SCIP_EVENTTYPE_LHOLEREMOVED)
119 #define SCIP_EVENTTYPE_HOLECHANGED (SCIP_EVENTTYPE_GHOLECHANGED | SCIP_EVENTTYPE_LHOLECHANGED)
120 #define SCIP_EVENTTYPE_DOMCHANGED (SCIP_EVENTTYPE_BOUNDCHANGED | SCIP_EVENTTYPE_HOLECHANGED)
121 #define SCIP_EVENTTYPE_VARCHANGED (SCIP_EVENTTYPE_VARFIXED | SCIP_EVENTTYPE_VARUNLOCKED | SCIP_EVENTTYPE_OBJCHANGED \
122  | SCIP_EVENTTYPE_GBDCHANGED | SCIP_EVENTTYPE_DOMCHANGED | SCIP_EVENTTYPE_IMPLADDED \
123  | SCIP_EVENTTYPE_VARDELETED | SCIP_EVENTTYPE_TYPECHANGED)
124 #define SCIP_EVENTTYPE_VAREVENT (SCIP_EVENTTYPE_VARADDED | SCIP_EVENTTYPE_VARCHANGED | SCIP_EVENTTYPE_TYPECHANGED)
125 
126 /* event masks for node events */
127 #define SCIP_EVENTTYPE_NODESOLVED (SCIP_EVENTTYPE_NODEFEASIBLE | SCIP_EVENTTYPE_NODEINFEASIBLE \
128  | SCIP_EVENTTYPE_NODEBRANCHED)
129 #define SCIP_EVENTTYPE_NODEEVENT (SCIP_EVENTTYPE_NODEFOCUSED | SCIP_EVENTTYPE_NODESOLVED)
130 
131 /* event masks for LP events */
132 #define SCIP_EVENTTYPE_LPEVENT (SCIP_EVENTTYPE_FIRSTLPSOLVED | SCIP_EVENTTYPE_LPSOLVED)
133 
134 /* event masks for primal solution events */
135 #define SCIP_EVENTTYPE_SOLFOUND (SCIP_EVENTTYPE_POORSOLFOUND | SCIP_EVENTTYPE_BESTSOLFOUND)
136 #define SCIP_EVENTTYPE_SOLEVENT (SCIP_EVENTTYPE_SOLFOUND)
137 
138 /* event masks for row events */
139 #define SCIP_EVENTTYPE_ROWCHANGED (SCIP_EVENTTYPE_ROWCOEFCHANGED | SCIP_EVENTTYPE_ROWCONSTCHANGED | SCIP_EVENTTYPE_ROWSIDECHANGED)
140 #define SCIP_EVENTTYPE_ROWEVENT (SCIP_EVENTTYPE_ROWADDEDSEPA | SCIP_EVENTTYPE_ROWDELETEDSEPA | SCIP_EVENTTYPE_ROWADDEDLP | SCIP_EVENTTYPE_ROWDELETEDLP | SCIP_EVENTTYPE_ROWCHANGED)
141 
142 typedef uint64_t SCIP_EVENTTYPE; /**< type of event (bit field) */
143 #define SCIP_EVENTTYPE_FORMAT PRIx64
144 
145 typedef struct SCIP_Eventhdlr SCIP_EVENTHDLR; /**< event handler for a specific events */
146 typedef struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA; /**< event handler data */
147 typedef struct SCIP_Event SCIP_EVENT; /**< event data structure */
148 typedef struct SCIP_EventVarAdded SCIP_EVENTVARADDED; /**< data for variable addition events */
149 typedef struct SCIP_EventVarDeleted SCIP_EVENTVARDELETED; /**< data for variable deletion events */
150 typedef struct SCIP_EventVarFixed SCIP_EVENTVARFIXED; /**< data for variable fixing events */
151 typedef struct SCIP_EventVarUnlocked SCIP_EVENTVARUNLOCKED; /**< data for variable unlocked events */
152 typedef struct SCIP_EventObjChg SCIP_EVENTOBJCHG; /**< data for objective value change events */
153 typedef struct SCIP_EventBdChg SCIP_EVENTBDCHG; /**< data for bound change events */
154 typedef struct SCIP_EventHole SCIP_EVENTHOLE; /**< data for domain hole events */
155 typedef struct SCIP_EventImplAdd SCIP_EVENTIMPLADD; /**< data for implication added events */
156 typedef struct SCIP_EventTypeChg SCIP_EVENTTYPECHG; /**< data for variable type change events */
157 typedef struct SCIP_EventRowAddedSepa SCIP_EVENTROWADDEDSEPA; /**< data for row addition to sepastorage events */
158 typedef struct SCIP_EventRowDeletedSepa SCIP_EVENTROWDELETEDSEPA; /**< data for row deletion from sepastorage events */
159 typedef struct SCIP_EventRowAddedLP SCIP_EVENTROWADDEDLP; /**< data for row addition to LP events */
160 typedef struct SCIP_EventRowDeletedLP SCIP_EVENTROWDELETEDLP; /**< data for row deletion from LP events */
161 typedef struct SCIP_EventRowCoefChanged SCIP_EVENTROWCOEFCHANGED; /**< data for row coefficient change events */
162 typedef struct SCIP_EventRowConstChanged SCIP_EVENTROWCONSTCHANGED; /**< data for row constant change events */
163 typedef struct SCIP_EventRowSideChanged SCIP_EVENTROWSIDECHANGED; /**< data for row side change events */
164 typedef struct SCIP_EventData SCIP_EVENTDATA; /**< locally defined event specific data */
165 typedef struct SCIP_EventFilter SCIP_EVENTFILTER; /**< event filter to select events to be processed by an event handler */
166 typedef struct SCIP_EventQueue SCIP_EVENTQUEUE; /**< event queue to cache events and process them later */
167 
168 /** copy method for event handler plugins (called when SCIP copies plugins)
169  *
170  * input:
171  * - scip : SCIP main data structure
172  * - eventhdlr : the event handler itself
173  */
174 #define SCIP_DECL_EVENTCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
175 
176 /** destructor of event handler to free user data (called when SCIP is exiting)
177  *
178  * input:
179  * - scip : SCIP main data structure
180  * - eventhdlr : the event handler itself
181  */
182 #define SCIP_DECL_EVENTFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
183 
184 /** initialization method of event handler (called after problem was transformed)
185  *
186  * input:
187  * - scip : SCIP main data structure
188  * - eventhdlr : the event handler itself
189  */
190 #define SCIP_DECL_EVENTINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
191 
192 /** deinitialization method of event handler (called before transformed problem is freed)
193  *
194  * input:
195  * - scip : SCIP main data structure
196  * - eventhdlr : the event handler itself
197  */
198 #define SCIP_DECL_EVENTEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
199 
200 /** solving process initialization method of event handler (called when branch and bound process is about to begin)
201  *
202  * This method is called when the presolving was finished and the branch and bound process is about to begin.
203  * The event handler may use this call to initialize its branch and bound specific data.
204  *
205  * input:
206  * - scip : SCIP main data structure
207  * - eventhdlr : the event handler itself
208  */
209 #define SCIP_DECL_EVENTINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
210 
211 /** solving process deinitialization method of event handler (called before branch and bound process data is freed)
212  *
213  * This method is called before the branch and bound process is freed.
214  * The event handler should use this call to clean up its branch and bound data.
215  *
216  * input:
217  * - scip : SCIP main data structure
218  * - eventhdlr : the event handler itself
219  */
220 #define SCIP_DECL_EVENTEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
221 
222 /** frees specific event data
223  *
224  * input:
225  * - scip : SCIP main data structure
226  * - eventhdlr : the event handler itself
227  * - eventdata : pointer to the event data to free
228  */
229 #define SCIP_DECL_EVENTDELETE(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr, SCIP_EVENTDATA** eventdata)
230 
231 /** execution method of event handler
232  *
233  * Processes the event. The method is called every time an event occurs, for which the event handler
234  * is responsible. Event handlers may declare themselves responsible for events by calling the
235  * corresponding SCIPcatch...() method. This method creates an event filter object to point to the
236  * given event handler and event data.
237  *
238  * input:
239  * - scip : SCIP main data structure
240  * - eventhdlr : the event handler itself
241  * - event : event to process
242  * - eventdata : user data for the event
243  */
244 #define SCIP_DECL_EVENTEXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr, SCIP_EVENT* event, SCIP_EVENTDATA* eventdata)
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:146
type definitions for return codes for SCIP methods
type definitions for SCIP&#39;s main datastructure
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:164
common defines and data types used in all packages of SCIP
uint64_t SCIP_EVENTTYPE
Definition: type_event.h:142