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-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file struct_event.h
26 * @ingroup INTERNALAPI
27 * @brief datastructures for managing events
28 * @author Tobias Achterberg
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#ifndef __SCIP_STRUCT_EVENT_H__
34#define __SCIP_STRUCT_EVENT_H__
35
36
37#include "scip/def.h"
38#include "scip/type_clock.h"
39#include "scip/type_event.h"
40#include "scip/type_var.h"
41#include "scip/type_sol.h"
42#include "scip/type_tree.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/** data for variable addition events */
50{
51 SCIP_VAR* var; /**< variable that was added to the problem */
52};
53
54/** data for variable deletion events */
56{
57 SCIP_VAR* var; /**< variable that will be deleted from the problem */
58};
59
60/** data for variable fixing events */
62{
63 SCIP_VAR* var; /**< variable that was fixed */
64};
65
66/** data for locks change events */
68{
69 SCIP_VAR* var; /**< variable for which the lock numbers were changed */
70};
71
72/** data for objective value change events */
74{
75 SCIP_Real oldobj; /**< old objective value before value changed */
76 SCIP_Real newobj; /**< new objective value after value changed */
77 SCIP_VAR* var; /**< variable whose objective value changed */
78};
79
80/** data for bound change events */
82{
83 SCIP_Real oldbound; /**< old bound before bound changed */
84 SCIP_Real newbound; /**< new bound after bound changed */
85 SCIP_VAR* var; /**< variable whose bound changed */
86};
87
88/** data for domain hole events */
90{
91 SCIP_Real left; /**< left bound of open interval in hole */
92 SCIP_Real right; /**< right bound of open interval in hole */
93 SCIP_VAR* var; /**< variable for which a hole was removed */
94};
95
96/** data for implication added events */
98{
99 SCIP_VAR* var; /**< variable for which an implication, variable bound, or clique was added */
100};
101
102/** data for variable type change events */
104{
105 SCIP_VARTYPE oldtype; /**< old variable type */
106 SCIP_VARTYPE newtype; /**< new variable type */
107 SCIP_VAR* var; /**< variable whose type changed */
108};
109
110/** data for row addition to separation storage events */
112{
113 SCIP_ROW* row; /**< row that was added to separation storage */
114};
115
116/** data for row deletion from separation storage events */
118{
119 SCIP_ROW* row; /**< row that was deleted from separation storage */
120};
121
122/** data for row addition to LP events */
124{
125 SCIP_ROW* row; /**< row that was added to the LP */
126};
127
128/** data for row deletion from LP events */
130{
131 SCIP_ROW* row; /**< row that was deleted from the LP */
132};
133
134/** data for row coefficient change events */
136{
137 SCIP_ROW* row; /**< row which coefficient has changed */
138 SCIP_COL* col; /**< column which coefficient has changed */
139 SCIP_Real oldval; /**< old value of coefficient */
140 SCIP_Real newval; /**< new value of coefficient */
141};
142
143/** data for row constant change events */
145{
146 SCIP_ROW* row; /**< row which constant has changed */
147 SCIP_Real oldval; /**< old value of constant */
148 SCIP_Real newval; /**< new value of constant */
149};
150
151/** data for row side change events */
153{
154 SCIP_ROW* row; /**< row which side has changed */
155 SCIP_SIDETYPE side; /**< which side has changed */
156 SCIP_Real oldval; /**< old value of side */
157 SCIP_Real newval; /**< new value of side */
158};
159
160/** event data structure */
162{
163 union
164 {
165 SCIP_EVENTVARADDED eventvaradded; /**< data for variable addition events */
166 SCIP_EVENTVARDELETED eventvardeleted; /**< data for variable deletion events */
167 SCIP_EVENTVARFIXED eventvarfixed; /**< data for variable fixing events */
168 SCIP_EVENTVARUNLOCKED eventvarunlocked; /**< data for locks change events */
169 SCIP_EVENTOBJCHG eventobjchg; /**< data for objective value change events */
170 SCIP_EVENTBDCHG eventbdchg; /**< data for bound change events */
171 SCIP_EVENTHOLE eventhole; /**< data for domain hole events */
172 SCIP_EVENTIMPLADD eventimpladd; /**< data for implication added events */
173 SCIP_EVENTTYPECHG eventtypechg; /**< data for variable type change events */
174 SCIP_EVENTROWADDEDSEPA eventrowaddedsepa; /**< data for row addition to separation storage events */
175 SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa; /**< data for row deletion from separation storage events */
176 SCIP_EVENTROWADDEDLP eventrowaddedlp; /**< data for row addition to LP events */
177 SCIP_EVENTROWDELETEDLP eventrowdeletedlp; /**< data for row deletion from LP events */
178 SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged; /**< data for row coefficient change events */
179 SCIP_EVENTROWCONSTCHANGED eventrowconstchanged; /**< data for row constant change events */
180 SCIP_EVENTROWSIDECHANGED eventrowsidechanged; /**< data for row side change events */
181 SCIP_NODE* node; /**< data for node and LP events */
182 SCIP_SOL* sol; /**< data for primal solution events */
184 SCIP_EVENTTYPE eventtype; /**< type of event */
185};
186
187/** event filter to select events to be processed by an event handler */
189{
190 SCIP_EVENTTYPE* eventtypes; /**< array with types of event to process; 0 marks a deleted event catch entry */
191 SCIP_EVENTHDLR** eventhdlrs; /**< array with event handlers to process the event */
192 SCIP_EVENTDATA** eventdata; /**< array with user data for the issued event */
193 int* nextpos; /**< linked lists for free, delayed added and delayed deleted slot positions */
194 int size; /**< size of filter arrays (available slots in arrays) */
195 int len; /**< number entries in filter arrays (used and deleted) */
196 int firstfreepos; /**< first deleted slot; remaining slots are in poslist */
197 int firstdeletedpos; /**< first delayed deleted slot; remaining slots are in poslist */
198 SCIP_EVENTTYPE eventmask; /**< mask for events that are handled by any event handler in the filter */
199 SCIP_EVENTTYPE delayedeventmask; /**< mask for delayed added events */
200 SCIP_Bool delayupdates; /**< should additions and deletions to the filter be delayed? */
201};
202
203/** event handler */
205{
206 char* name; /**< name of event handler */
207 char* desc; /**< description of event handler */
208 SCIP_DECL_EVENTCOPY ((*eventcopy)); /**< copy method of event handler or NULL if you don't want to copy your plugin into sub-SCIPs */
209 SCIP_DECL_EVENTFREE ((*eventfree)); /**< destructor of event handler */
210 SCIP_DECL_EVENTINIT ((*eventinit)); /**< initialize event handler */
211 SCIP_DECL_EVENTEXIT ((*eventexit)); /**< deinitialize event handler */
212 SCIP_DECL_EVENTINITSOL((*eventinitsol)); /**< solving process initialization method of event handler */
213 SCIP_DECL_EVENTEXITSOL((*eventexitsol)); /**< solving process deinitialization method of event handler */
214 SCIP_DECL_EVENTDELETE ((*eventdelete)); /**< free specific event data */
215 SCIP_DECL_EVENTEXEC ((*eventexec)); /**< execute event handler */
216 SCIP_EVENTHDLRDATA* eventhdlrdata; /**< event handler data */
217 SCIP_CLOCK* setuptime; /**< time spend for setting up this event handler for the next stages */
218 SCIP_CLOCK* eventtime; /**< time spend in this event handler execution method */
219 SCIP_Bool initialized; /**< is event handler initialized? */
220};
221
222/** event queue to cache events and process them later */
224{
225 SCIP_EVENT** events; /**< array with queued events */
226 int eventssize; /**< number of available slots in events array */
227 int nevents; /**< number of events in queue (used slots if events array) */
228 SCIP_Bool delayevents; /**< should the events be delayed and processed later? */
229};
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:173
SCIP_Real oldbound
Definition: struct_event.h:83
SCIP_Real newbound
Definition: struct_event.h:84
SCIP_VAR * var
Definition: struct_event.h:85
SCIP_EVENTTYPE delayedeventmask
Definition: struct_event.h:199
SCIP_EVENTHDLR ** eventhdlrs
Definition: struct_event.h:191
SCIP_Bool delayupdates
Definition: struct_event.h:200
SCIP_EVENTTYPE eventmask
Definition: struct_event.h:198
SCIP_EVENTTYPE * eventtypes
Definition: struct_event.h:190
SCIP_EVENTDATA ** eventdata
Definition: struct_event.h:192
SCIP_VAR * var
Definition: struct_event.h:93
SCIP_Real left
Definition: struct_event.h:91
SCIP_Real right
Definition: struct_event.h:92
SCIP_VAR * var
Definition: struct_event.h:99
SCIP_Real newobj
Definition: struct_event.h:76
SCIP_Real oldobj
Definition: struct_event.h:75
SCIP_VAR * var
Definition: struct_event.h:77
SCIP_EVENT ** events
Definition: struct_event.h:225
SCIP_Bool delayevents
Definition: struct_event.h:228
SCIP_VARTYPE oldtype
Definition: struct_event.h:105
SCIP_VARTYPE newtype
Definition: struct_event.h:106
SCIP_EVENTROWCONSTCHANGED eventrowconstchanged
Definition: struct_event.h:179
SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged
Definition: struct_event.h:178
SCIP_EVENTROWDELETEDLP eventrowdeletedlp
Definition: struct_event.h:177
SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa
Definition: struct_event.h:175
SCIP_EVENTROWSIDECHANGED eventrowsidechanged
Definition: struct_event.h:180
SCIP_EVENTVARFIXED eventvarfixed
Definition: struct_event.h:167
SCIP_NODE * node
Definition: struct_event.h:181
SCIP_EVENTTYPECHG eventtypechg
Definition: struct_event.h:173
SCIP_EVENTTYPE eventtype
Definition: struct_event.h:184
union SCIP_Event::@16 data
SCIP_EVENTVARUNLOCKED eventvarunlocked
Definition: struct_event.h:168
SCIP_EVENTBDCHG eventbdchg
Definition: struct_event.h:170
SCIP_EVENTROWADDEDSEPA eventrowaddedsepa
Definition: struct_event.h:174
SCIP_EVENTHOLE eventhole
Definition: struct_event.h:171
SCIP_EVENTIMPLADD eventimpladd
Definition: struct_event.h:172
SCIP_EVENTOBJCHG eventobjchg
Definition: struct_event.h:169
SCIP_EVENTVARADDED eventvaradded
Definition: struct_event.h:165
SCIP_EVENTROWADDEDLP eventrowaddedlp
Definition: struct_event.h:176
SCIP_SOL * sol
Definition: struct_event.h:182
SCIP_EVENTVARDELETED eventvardeleted
Definition: struct_event.h:166
SCIP_DECL_EVENTINITSOL((*eventinitsol))
SCIP_DECL_EVENTEXIT((*eventexit))
SCIP_DECL_EVENTEXEC((*eventexec))
SCIP_DECL_EVENTDELETE((*eventdelete))
SCIP_DECL_EVENTFREE((*eventfree))
SCIP_Bool initialized
Definition: struct_event.h:219
SCIP_DECL_EVENTEXITSOL((*eventexitsol))
SCIP_DECL_EVENTCOPY((*eventcopy))
SCIP_CLOCK * setuptime
Definition: struct_event.h:217
SCIP_CLOCK * eventtime
Definition: struct_event.h:218
SCIP_DECL_EVENTINIT((*eventinit))
SCIP_EVENTHDLRDATA * eventhdlrdata
Definition: struct_event.h:216
type definitions for clocks and timing issues
type definitions for managing events
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:173
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:155
uint64_t SCIP_EVENTTYPE
Definition: type_event.h:151
enum SCIP_SideType SCIP_SIDETYPE
Definition: type_lp.h:67
type definitions for storing primal CIP solutions
type definitions for branch and bound tree
type definitions for problem variables
enum SCIP_Vartype SCIP_VARTYPE
Definition: type_var.h:73