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