Scippy

SCIP

Solving Constraint Integer Programs

struct_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 struct_event.h
17  * @ingroup INTERNALAPI
18  * @brief datastructures for managing events
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_STRUCT_EVENT_H__
25 #define __SCIP_STRUCT_EVENT_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_clock.h"
30 #include "scip/type_event.h"
31 #include "scip/type_var.h"
32 #include "scip/type_sol.h"
33 #include "scip/type_tree.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /** data for variable addition events */
41 {
42  SCIP_VAR* var; /**< variable that was added to the problem */
43 };
44 
45 /** data for variable deletion events */
47 {
48  SCIP_VAR* var; /**< variable that will be deleted from the problem */
49 };
50 
51 /** data for variable fixing events */
53 {
54  SCIP_VAR* var; /**< variable that was fixed */
55 };
56 
57 /** data for locks change events */
59 {
60  SCIP_VAR* var; /**< variable for which the lock numbers were changed */
61 };
62 
63 /** data for objective value change events */
65 {
66  SCIP_Real oldobj; /**< old objective value before value changed */
67  SCIP_Real newobj; /**< new objective value after value changed */
68  SCIP_VAR* var; /**< variable whose objective value changed */
69 };
70 
71 /** data for bound change events */
73 {
74  SCIP_Real oldbound; /**< old bound before bound changed */
75  SCIP_Real newbound; /**< new bound after bound changed */
76  SCIP_VAR* var; /**< variable whose bound changed */
77 };
78 
79 /** data for domain hole events */
81 {
82  SCIP_Real left; /**< left bound of open interval in hole */
83  SCIP_Real right; /**< right bound of open interval in hole */
84  SCIP_VAR* var; /**< variable for which a hole was removed */
85 };
86 
87 /** data for implication added events */
89 {
90  SCIP_VAR* var; /**< variable for which an implication, variable bound, or clique was added */
91 };
92 
93 /** data for row addition to separation storage events */
95 {
96  SCIP_ROW* row; /**< row that was added to separation storage */
97 };
98 
99 /** data for row deletion from separation storage events */
101 {
102  SCIP_ROW* row; /**< row that was deleted from separation storage */
103 };
104 
105 /** data for row addition to LP events */
107 {
108  SCIP_ROW* row; /**< row that was added to the LP */
109 };
110 
111 /** data for row deletion from LP events */
113 {
114  SCIP_ROW* row; /**< row that was deleted from the LP */
115 };
116 
117 /** data for row coefficient change events */
119 {
120  SCIP_ROW* row; /**< row which coefficient has changed */
121  SCIP_COL* col; /**< column which coefficient has changed */
122  SCIP_Real oldval; /**< old value of coefficient */
123  SCIP_Real newval; /**< new value of coefficient */
124 };
125 
126 /** data for row constant change events */
128 {
129  SCIP_ROW* row; /**< row which constant has changed */
130  SCIP_Real oldval; /**< old value of constant */
131  SCIP_Real newval; /**< new value of constant */
132 };
133 
134 /** data for row side change events */
136 {
137  SCIP_ROW* row; /**< row which side has changed */
138  SCIP_SIDETYPE side; /**< which side has changed */
139  SCIP_Real oldval; /**< old value of side */
140  SCIP_Real newval; /**< new value of side */
141 };
142 
143 /** event data structure */
145 {
146  union
147  {
148  SCIP_EVENTVARADDED eventvaradded; /**< data for variable addition events */
149  SCIP_EVENTVARDELETED eventvardeleted; /**< data for variable deletion events */
150  SCIP_EVENTVARFIXED eventvarfixed; /**< data for variable fixing events */
151  SCIP_EVENTVARUNLOCKED eventvarunlocked; /**< data for locks change events */
152  SCIP_EVENTOBJCHG eventobjchg; /**< data for objective value change events */
153  SCIP_EVENTBDCHG eventbdchg; /**< data for bound change events */
154  SCIP_EVENTHOLE eventhole; /**< data for domain hole events */
155  SCIP_EVENTIMPLADD eventimpladd; /**< data for implication added events */
156  SCIP_EVENTROWADDEDSEPA eventrowaddedsepa; /**< data for row addition to separation storage events */
157  SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa; /**< data for row deletion from separation storage events */
158  SCIP_EVENTROWADDEDLP eventrowaddedlp; /**< data for row addition to LP events */
159  SCIP_EVENTROWDELETEDLP eventrowdeletedlp; /**< data for row deletion from LP events */
160  SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged; /**< data for row coefficient change events */
161  SCIP_EVENTROWCONSTCHANGED eventrowconstchanged; /**< data for row constant change events */
162  SCIP_EVENTROWSIDECHANGED eventrowsidechanged; /**< data for row side change events */
163  SCIP_NODE* node; /**< data for node and LP events */
164  SCIP_SOL* sol; /**< data for primal solution events */
165  } data;
166  SCIP_EVENTTYPE eventtype; /**< type of event */
167 };
168 
169 /** event filter to select events to be processed by an event handler */
171 {
172  SCIP_EVENTTYPE* eventtypes; /**< array with types of event to process; 0 marks a deleted event catch entry */
173  SCIP_EVENTHDLR** eventhdlrs; /**< array with event handlers to process the event */
174  SCIP_EVENTDATA** eventdata; /**< array with user data for the issued event */
175  int* nextpos; /**< linked lists for free, delayed added and delayed deleted slot positions */
176  int size; /**< size of filter arrays (available slots in arrays) */
177  int len; /**< number entries in filter arrays (used and deleted) */
178  int firstfreepos; /**< first deleted slot; remaining slots are in poslist */
179  int firstdeletedpos; /**< first delayed deleted slot; remaining slots are in poslist */
180  SCIP_EVENTTYPE eventmask; /**< mask for events that are handled by any event handler in the filter */
181  SCIP_EVENTTYPE delayedeventmask; /**< mask for delayed added events */
182  SCIP_Bool delayupdates; /**< should additions and deletions to the filter be delayed? */
183 };
184 
185 /** event handler */
187 {
188  char* name; /**< name of event handler */
189  char* desc; /**< description of event handler */
190  SCIP_DECL_EVENTCOPY ((*eventcopy)); /**< copy method of event handler or NULL if you don't want to copy your plugin into sub-SCIPs */
191  SCIP_DECL_EVENTFREE ((*eventfree)); /**< destructor of event handler */
192  SCIP_DECL_EVENTINIT ((*eventinit)); /**< initialize event handler */
193  SCIP_DECL_EVENTEXIT ((*eventexit)); /**< deinitialize event handler */
194  SCIP_DECL_EVENTINITSOL((*eventinitsol)); /**< solving process initialization method of event handler */
195  SCIP_DECL_EVENTEXITSOL((*eventexitsol)); /**< solving process deinitialization method of event handler */
196  SCIP_DECL_EVENTDELETE ((*eventdelete)); /**< free specific event data */
197  SCIP_DECL_EVENTEXEC ((*eventexec)); /**< execute event handler */
198  SCIP_EVENTHDLRDATA* eventhdlrdata; /**< event handler data */
199  SCIP_CLOCK* setuptime; /**< time spend for setting up this event handler for the next stages */
200  SCIP_CLOCK* eventtime; /**< time spend in this event handler execution method */
201  SCIP_Bool initialized; /**< is event handler initialized? */
202 };
203 
204 /** event queue to cache events and process them later */
206 {
207  SCIP_EVENT** events; /**< array with queued events */
208  int eventssize; /**< number of available slots in events array */
209  int nevents; /**< number of events in queue (used slots if events array) */
210  SCIP_Bool delayevents; /**< should the events be delayed and processed later? */
211 };
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 #endif
SCIP_EVENTVARUNLOCKED eventvarunlocked
Definition: struct_event.h:151
SCIP_EVENTROWSIDECHANGED eventrowsidechanged
Definition: struct_event.h:162
SCIP_EVENTHDLR ** eventhdlrs
Definition: struct_event.h:173
SCIP_EVENTOBJCHG eventobjchg
Definition: struct_event.h:152
SCIP_DECL_EVENTEXIT(EventhdlrNewSol::scip_exit)
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:138
SCIP_EVENTROWDELETEDLP eventrowdeletedlp
Definition: struct_event.h:159
SCIP_VAR * var
Definition: struct_event.h:90
SCIP_EVENTROWADDEDSEPA eventrowaddedsepa
Definition: struct_event.h:156
SCIP_Bool delayupdates
Definition: struct_event.h:182
SCIP_DECL_EVENTINITSOL(EventhdlrNewSol::scip_initsol)
SCIP_Real newobj
Definition: struct_event.h:67
SCIP_DECL_EVENTINIT(EventhdlrNewSol::scip_init)
SCIP_Real right
Definition: struct_event.h:83
SCIP_DECL_EVENTFREE(EventhdlrNewSol::scip_free)
SCIP_EVENTTYPE eventmask
Definition: struct_event.h:180
SCIP_Bool initialized
Definition: struct_event.h:201
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:155
SCIP_EVENTVARADDED eventvaradded
Definition: struct_event.h:148
SCIP_EVENTTYPE eventtype
Definition: struct_event.h:166
type definitions for problem variables
SCIP_EVENTROWADDEDLP eventrowaddedlp
Definition: struct_event.h:158
SCIP_Real left
Definition: struct_event.h:82
SCIP_EVENTIMPLADD eventimpladd
Definition: struct_event.h:155
type definitions for managing events
SCIP_Real newbound
Definition: struct_event.h:75
SCIP_VAR * var
Definition: struct_event.h:76
#define SCIP_Bool
Definition: def.h:69
SCIP_EVENTHDLRDATA * eventhdlrdata
Definition: struct_event.h:198
SCIP_Real oldobj
Definition: struct_event.h:66
SCIP_EVENT ** events
Definition: struct_event.h:207
type definitions for branch and bound tree
SCIP_Bool delayevents
Definition: struct_event.h:210
type definitions for clocks and timing issues
type definitions for storing primal CIP solutions
SCIP_EVENTDATA ** eventdata
Definition: struct_event.h:174
SCIP_EVENTBDCHG eventbdchg
Definition: struct_event.h:153
SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged
Definition: struct_event.h:160
SCIP_VAR * var
Definition: struct_event.h:68
SCIP_EVENTHOLE eventhole
Definition: struct_event.h:154
SCIP_NODE * node
Definition: struct_event.h:163
SCIP_VAR * var
Definition: struct_event.h:84
SCIP_Real oldbound
Definition: struct_event.h:74
SCIP_DECL_EVENTEXEC(EventhdlrNewSol::scip_exec)
#define SCIP_Real
Definition: def.h:157
SCIP_DECL_EVENTEXITSOL(EventhdlrNewSol::scip_exitsol)
#define SCIP_DECL_EVENTCOPY(x)
Definition: type_event.h:165
SCIP_CLOCK * eventtime
Definition: struct_event.h:200
SCIP_CLOCK * setuptime
Definition: struct_event.h:199
SCIP_EVENTTYPE delayedeventmask
Definition: struct_event.h:181
SCIP_EVENTTYPE * eventtypes
Definition: struct_event.h:172
SCIP_EVENTVARDELETED eventvardeleted
Definition: struct_event.h:149
SCIP_EVENTVARFIXED eventvarfixed
Definition: struct_event.h:150
SCIP_DECL_EVENTDELETE(EventhdlrNewSol::scip_delete)
common defines and data types used in all packages of SCIP
SCIP_SOL * sol
Definition: struct_event.h:164
SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa
Definition: struct_event.h:157
SCIP_EVENTROWCONSTCHANGED eventrowconstchanged
Definition: struct_event.h:161
uint64_t SCIP_EVENTTYPE
Definition: type_event.h:134
enum SCIP_SideType SCIP_SIDETYPE
Definition: type_lp.h:58