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