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