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-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 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 variable type change events */
95 {
96  SCIP_VARTYPE oldtype; /**< old variable type */
97  SCIP_VARTYPE newtype; /**< new variable type */
98  SCIP_VAR* var; /**< variable whose type changed */
99 };
100 
101 /** data for row addition to separation storage events */
103 {
104  SCIP_ROW* row; /**< row that was added to separation storage */
105 };
106 
107 /** data for row deletion from separation storage events */
109 {
110  SCIP_ROW* row; /**< row that was deleted from separation storage */
111 };
112 
113 /** data for row addition to LP events */
115 {
116  SCIP_ROW* row; /**< row that was added to the LP */
117 };
118 
119 /** data for row deletion from LP events */
121 {
122  SCIP_ROW* row; /**< row that was deleted from the LP */
123 };
124 
125 /** data for row coefficient change events */
127 {
128  SCIP_ROW* row; /**< row which coefficient has changed */
129  SCIP_COL* col; /**< column which coefficient has changed */
130  SCIP_Real oldval; /**< old value of coefficient */
131  SCIP_Real newval; /**< new value of coefficient */
132 };
133 
134 /** data for row constant change events */
136 {
137  SCIP_ROW* row; /**< row which constant has changed */
138  SCIP_Real oldval; /**< old value of constant */
139  SCIP_Real newval; /**< new value of constant */
140 };
141 
142 /** data for row side change events */
144 {
145  SCIP_ROW* row; /**< row which side has changed */
146  SCIP_SIDETYPE side; /**< which side has changed */
147  SCIP_Real oldval; /**< old value of side */
148  SCIP_Real newval; /**< new value of side */
149 };
150 
151 /** event data structure */
153 {
154  union
155  {
156  SCIP_EVENTVARADDED eventvaradded; /**< data for variable addition events */
157  SCIP_EVENTVARDELETED eventvardeleted; /**< data for variable deletion events */
158  SCIP_EVENTVARFIXED eventvarfixed; /**< data for variable fixing events */
159  SCIP_EVENTVARUNLOCKED eventvarunlocked; /**< data for locks change events */
160  SCIP_EVENTOBJCHG eventobjchg; /**< data for objective value change events */
161  SCIP_EVENTBDCHG eventbdchg; /**< data for bound change events */
162  SCIP_EVENTHOLE eventhole; /**< data for domain hole events */
163  SCIP_EVENTIMPLADD eventimpladd; /**< data for implication added events */
164  SCIP_EVENTTYPECHG eventtypechg; /**< data for variable type change events */
165  SCIP_EVENTROWADDEDSEPA eventrowaddedsepa; /**< data for row addition to separation storage events */
166  SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa; /**< data for row deletion from separation storage events */
167  SCIP_EVENTROWADDEDLP eventrowaddedlp; /**< data for row addition to LP events */
168  SCIP_EVENTROWDELETEDLP eventrowdeletedlp; /**< data for row deletion from LP events */
169  SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged; /**< data for row coefficient change events */
170  SCIP_EVENTROWCONSTCHANGED eventrowconstchanged; /**< data for row constant change events */
171  SCIP_EVENTROWSIDECHANGED eventrowsidechanged; /**< data for row side change events */
172  SCIP_NODE* node; /**< data for node and LP events */
173  SCIP_SOL* sol; /**< data for primal solution events */
174  } data;
175  SCIP_EVENTTYPE eventtype; /**< type of event */
176 };
177 
178 /** event filter to select events to be processed by an event handler */
180 {
181  SCIP_EVENTTYPE* eventtypes; /**< array with types of event to process; 0 marks a deleted event catch entry */
182  SCIP_EVENTHDLR** eventhdlrs; /**< array with event handlers to process the event */
183  SCIP_EVENTDATA** eventdata; /**< array with user data for the issued event */
184  int* nextpos; /**< linked lists for free, delayed added and delayed deleted slot positions */
185  int size; /**< size of filter arrays (available slots in arrays) */
186  int len; /**< number entries in filter arrays (used and deleted) */
187  int firstfreepos; /**< first deleted slot; remaining slots are in poslist */
188  int firstdeletedpos; /**< first delayed deleted slot; remaining slots are in poslist */
189  SCIP_EVENTTYPE eventmask; /**< mask for events that are handled by any event handler in the filter */
190  SCIP_EVENTTYPE delayedeventmask; /**< mask for delayed added events */
191  SCIP_Bool delayupdates; /**< should additions and deletions to the filter be delayed? */
192 };
193 
194 /** event handler */
196 {
197  char* name; /**< name of event handler */
198  char* desc; /**< description of event handler */
199  SCIP_DECL_EVENTCOPY ((*eventcopy)); /**< copy method of event handler or NULL if you don't want to copy your plugin into sub-SCIPs */
200  SCIP_DECL_EVENTFREE ((*eventfree)); /**< destructor of event handler */
201  SCIP_DECL_EVENTINIT ((*eventinit)); /**< initialize event handler */
202  SCIP_DECL_EVENTEXIT ((*eventexit)); /**< deinitialize event handler */
203  SCIP_DECL_EVENTINITSOL((*eventinitsol)); /**< solving process initialization method of event handler */
204  SCIP_DECL_EVENTEXITSOL((*eventexitsol)); /**< solving process deinitialization method of event handler */
205  SCIP_DECL_EVENTDELETE ((*eventdelete)); /**< free specific event data */
206  SCIP_DECL_EVENTEXEC ((*eventexec)); /**< execute event handler */
207  SCIP_EVENTHDLRDATA* eventhdlrdata; /**< event handler data */
208  SCIP_CLOCK* setuptime; /**< time spend for setting up this event handler for the next stages */
209  SCIP_CLOCK* eventtime; /**< time spend in this event handler execution method */
210  SCIP_Bool initialized; /**< is event handler initialized? */
211 };
212 
213 /** event queue to cache events and process them later */
215 {
216  SCIP_EVENT** events; /**< array with queued events */
217  int eventssize; /**< number of available slots in events array */
218  int nevents; /**< number of events in queue (used slots if events array) */
219  SCIP_Bool delayevents; /**< should the events be delayed and processed later? */
220 };
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif
SCIP_EVENTVARUNLOCKED eventvarunlocked
Definition: struct_event.h:159
SCIP_EVENTROWSIDECHANGED eventrowsidechanged
Definition: struct_event.h:171
SCIP_EVENTHDLR ** eventhdlrs
Definition: struct_event.h:182
SCIP_EVENTOBJCHG eventobjchg
Definition: struct_event.h:160
SCIP_VARTYPE newtype
Definition: struct_event.h:97
SCIP_DECL_EVENTEXIT(EventhdlrNewSol::scip_exit)
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:146
SCIP_EVENTROWDELETEDLP eventrowdeletedlp
Definition: struct_event.h:168
SCIP_VAR * var
Definition: struct_event.h:90
SCIP_EVENTROWADDEDSEPA eventrowaddedsepa
Definition: struct_event.h:165
SCIP_Bool delayupdates
Definition: struct_event.h:191
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_VAR * var
Definition: struct_event.h:98
SCIP_EVENTTYPECHG eventtypechg
Definition: struct_event.h:164
SCIP_EVENTTYPE eventmask
Definition: struct_event.h:189
SCIP_VARTYPE oldtype
Definition: struct_event.h:96
SCIP_Bool initialized
Definition: struct_event.h:210
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:164
SCIP_EVENTVARADDED eventvaradded
Definition: struct_event.h:156
SCIP_EVENTTYPE eventtype
Definition: struct_event.h:175
type definitions for problem variables
SCIP_EVENTROWADDEDLP eventrowaddedlp
Definition: struct_event.h:167
SCIP_Real left
Definition: struct_event.h:82
SCIP_EVENTIMPLADD eventimpladd
Definition: struct_event.h:163
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:70
SCIP_EVENTHDLRDATA * eventhdlrdata
Definition: struct_event.h:207
SCIP_Real oldobj
Definition: struct_event.h:66
SCIP_EVENT ** events
Definition: struct_event.h:216
type definitions for branch and bound tree
SCIP_Bool delayevents
Definition: struct_event.h:219
type definitions for clocks and timing issues
type definitions for storing primal CIP solutions
SCIP_EVENTDATA ** eventdata
Definition: struct_event.h:183
SCIP_EVENTBDCHG eventbdchg
Definition: struct_event.h:161
SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged
Definition: struct_event.h:169
SCIP_VAR * var
Definition: struct_event.h:68
SCIP_EVENTHOLE eventhole
Definition: struct_event.h:162
SCIP_NODE * node
Definition: struct_event.h:172
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:163
SCIP_DECL_EVENTEXITSOL(EventhdlrNewSol::scip_exitsol)
#define SCIP_DECL_EVENTCOPY(x)
Definition: type_event.h:174
SCIP_CLOCK * eventtime
Definition: struct_event.h:209
SCIP_CLOCK * setuptime
Definition: struct_event.h:208
SCIP_EVENTTYPE delayedeventmask
Definition: struct_event.h:190
SCIP_EVENTTYPE * eventtypes
Definition: struct_event.h:181
SCIP_EVENTVARDELETED eventvardeleted
Definition: struct_event.h:157
SCIP_EVENTVARFIXED eventvarfixed
Definition: struct_event.h:158
enum SCIP_Vartype SCIP_VARTYPE
Definition: type_var.h:60
SCIP_DECL_EVENTDELETE(EventhdlrNewSol::scip_delete)
common defines and data types used in all packages of SCIP
SCIP_SOL * sol
Definition: struct_event.h:173
SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa
Definition: struct_event.h:166
SCIP_EVENTROWCONSTCHANGED eventrowconstchanged
Definition: struct_event.h:170
uint64_t SCIP_EVENTTYPE
Definition: type_event.h:142
enum SCIP_SideType SCIP_SIDETYPE
Definition: type_lp.h:58