Scippy

SCIP

Solving Constraint Integer Programs

scip_event.c
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-2018 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 scip_event.c
17  * @brief public methods for event handler plugins and event handlers
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  * @author Gerald Gamrath
21  * @author Robert Lion Gottwald
22  * @author Stefan Heinz
23  * @author Gregor Hendel
24  * @author Thorsten Koch
25  * @author Alexander Martin
26  * @author Marc Pfetsch
27  * @author Michael Winkler
28  * @author Kati Wolter
29  *
30  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include <ctype.h>
36 #include <stdarg.h>
37 #include <assert.h>
38 #include <string.h>
39 #if defined(_WIN32) || defined(_WIN64)
40 #else
41 #include <strings.h> /*lint --e{766}*/
42 #endif
43 
44 
45 #include "lpi/lpi.h"
46 #include "nlpi/exprinterpret.h"
47 #include "nlpi/nlpi.h"
48 #include "scip/benders.h"
49 #include "scip/benderscut.h"
50 #include "scip/branch.h"
51 #include "scip/branch_nodereopt.h"
52 #include "scip/clock.h"
53 #include "scip/compr.h"
54 #include "scip/concsolver.h"
55 #include "scip/concurrent.h"
56 #include "scip/conflict.h"
57 #include "scip/conflictstore.h"
58 #include "scip/cons.h"
59 #include "scip/cons_linear.h"
60 #include "scip/cutpool.h"
61 #include "scip/cuts.h"
62 #include "scip/debug.h"
63 #include "scip/def.h"
64 #include "scip/dialog.h"
65 #include "scip/dialog_default.h"
66 #include "scip/disp.h"
67 #include "scip/event.h"
68 #include "scip/heur.h"
69 #include "scip/heur_ofins.h"
70 #include "scip/heur_reoptsols.h"
72 #include "scip/heuristics.h"
73 #include "scip/history.h"
74 #include "scip/implics.h"
75 #include "scip/interrupt.h"
76 #include "scip/lp.h"
77 #include "scip/mem.h"
78 #include "scip/message_default.h"
79 #include "scip/misc.h"
80 #include "scip/nlp.h"
81 #include "scip/nodesel.h"
82 #include "scip/paramset.h"
83 #include "scip/presol.h"
84 #include "scip/presolve.h"
85 #include "scip/pricer.h"
86 #include "scip/pricestore.h"
87 #include "scip/primal.h"
88 #include "scip/prob.h"
89 #include "scip/prop.h"
90 #include "scip/reader.h"
91 #include "scip/relax.h"
92 #include "scip/reopt.h"
93 #include "scip/retcode.h"
94 #include "scip/scipbuildflags.h"
95 #include "scip/scipcoreplugins.h"
96 #include "scip/scipgithash.h"
97 #include "scip/sepa.h"
98 #include "scip/sepastore.h"
99 #include "scip/set.h"
100 #include "scip/sol.h"
101 #include "scip/solve.h"
102 #include "scip/stat.h"
103 #include "scip/syncstore.h"
104 #include "scip/table.h"
105 #include "scip/tree.h"
106 #include "scip/var.h"
107 #include "scip/visual.h"
108 #include "xml/xml.h"
109 
110 #include "scip/scip_event.h"
111 
112 #include "scip/pub_message.h"
113 #include "scip/pub_var.h"
114 
115 
116 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
117  * this structure except the interface methods in scip.c.
118  * In optimized mode, the structure is included in scip.h, because some of the methods
119  * are implemented as defines for performance reasons (e.g. the numerical comparisons)
120  */
121 #ifndef NDEBUG
122 #include "scip/struct_scip.h"
123 #endif
124 
125 /** creates an event handler and includes it in SCIP
126  *
127  * @note method has all event handler callbacks as arguments and is thus changed every time a new
128  * callback is added in future releases; consider using SCIPincludeEventhdlrBasic() and setter functions
129  * if you seek for a method which is less likely to change in future releases
130  */
132  SCIP* scip, /**< SCIP data structure */
133  const char* name, /**< name of event handler */
134  const char* desc, /**< description of event handler */
135  SCIP_DECL_EVENTCOPY ((*eventcopy)), /**< copy method of event handler or NULL if you don't want to copy your plugin into sub-SCIPs */
136  SCIP_DECL_EVENTFREE ((*eventfree)), /**< destructor of event handler */
137  SCIP_DECL_EVENTINIT ((*eventinit)), /**< initialize event handler */
138  SCIP_DECL_EVENTEXIT ((*eventexit)), /**< deinitialize event handler */
139  SCIP_DECL_EVENTINITSOL((*eventinitsol)), /**< solving process initialization method of event handler */
140  SCIP_DECL_EVENTEXITSOL((*eventexitsol)), /**< solving process deinitialization method of event handler */
141  SCIP_DECL_EVENTDELETE ((*eventdelete)), /**< free specific event data */
142  SCIP_DECL_EVENTEXEC ((*eventexec)), /**< execute event handler */
143  SCIP_EVENTHDLRDATA* eventhdlrdata /**< event handler data */
144  )
145 {
146  SCIP_EVENTHDLR* eventhdlr;
147 
148  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeEventhdlr", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
149 
150  /* check whether event handler is already present */
151  if( SCIPfindEventhdlr(scip, name) != NULL )
152  {
153  SCIPerrorMessage("event handler <%s> already included.\n", name);
154  return SCIP_INVALIDDATA;
155  }
156 
157  SCIP_CALL( SCIPeventhdlrCreate(&eventhdlr, scip->set, name, desc,
158  eventcopy, eventfree, eventinit, eventexit, eventinitsol, eventexitsol, eventdelete, eventexec,
159  eventhdlrdata) );
160  SCIP_CALL( SCIPsetIncludeEventhdlr(scip->set, eventhdlr) );
161 
162  return SCIP_OKAY;
163 }
164 
165 /** creates an event handler and includes it in SCIP with all its non-fundamental callbacks set
166  * to NULL; if needed, non-fundamental callbacks can be set afterwards via setter functions
167  * SCIPsetEventhdlrCopy(), SCIPsetEventhdlrFree(), SCIPsetEventhdlrInit(), SCIPsetEventhdlrExit(),
168  * SCIPsetEventhdlrInitsol(), SCIPsetEventhdlrExitsol(), and SCIPsetEventhdlrDelete()
169  *
170  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeEventhdlr() instead
171  */
173  SCIP* scip, /**< SCIP data structure */
174  SCIP_EVENTHDLR** eventhdlrptr, /**< reference to an event handler, or NULL */
175  const char* name, /**< name of event handler */
176  const char* desc, /**< description of event handler */
177  SCIP_DECL_EVENTEXEC ((*eventexec)), /**< execute event handler */
178  SCIP_EVENTHDLRDATA* eventhdlrdata /**< event handler data */
179  )
180 {
181  SCIP_EVENTHDLR* eventhdlr;
182 
183  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeEventhdlrBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
184 
185  /* check whether event handler is already present */
186  if( SCIPfindEventhdlr(scip, name) != NULL )
187  {
188  SCIPerrorMessage("event handler <%s> already included.\n", name);
189  return SCIP_INVALIDDATA;
190  }
191 
192  SCIP_CALL( SCIPeventhdlrCreate(&eventhdlr, scip->set, name, desc,
193  NULL, NULL, NULL, NULL, NULL, NULL, NULL, eventexec,
194  eventhdlrdata) );
195  SCIP_CALL( SCIPsetIncludeEventhdlr(scip->set, eventhdlr) );
196 
197  if( eventhdlrptr != NULL )
198  *eventhdlrptr = eventhdlr;
199 
200  return SCIP_OKAY;
201 }
202 
203 /** sets copy callback of the event handler */
205  SCIP* scip, /**< scip instance */
206  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
207  SCIP_DECL_EVENTCOPY ((*eventcopy)) /**< copy callback of the event handler */
208  )
209 {
210  assert(scip != NULL);
211  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
212 
213  SCIPeventhdlrSetCopy(eventhdlr, eventcopy);
214  return SCIP_OKAY;
215 }
216 
217 /** sets deinitialization callback of the event handler */
219  SCIP* scip, /**< scip instance */
220  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
221  SCIP_DECL_EVENTFREE ((*eventfree)) /**< deinitialization callback of the event handler */
222  )
223 {
224  assert(scip != NULL);
225  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
226 
227  SCIPeventhdlrSetFree(eventhdlr, eventfree);
228  return SCIP_OKAY;
229 }
230 
231 /** sets initialization callback of the event handler */
233  SCIP* scip, /**< scip instance */
234  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
235  SCIP_DECL_EVENTINIT ((*eventinit)) /**< initialize event handler */
236  )
237 {
238  assert(scip != NULL);
239  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
240 
241  SCIPeventhdlrSetInit(eventhdlr, eventinit);
242  return SCIP_OKAY;
243 }
244 
245 /** sets deinitialization callback of the event handler */
247  SCIP* scip, /**< scip instance */
248  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
249  SCIP_DECL_EVENTEXIT ((*eventexit)) /**< deinitialize event handler */
250  )
251 {
252  assert(scip != NULL);
253  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
254 
255  SCIPeventhdlrSetExit(eventhdlr, eventexit);
256  return SCIP_OKAY;
257 }
258 
259 /** sets solving process initialization callback of the event handler */
261  SCIP* scip, /**< scip instance */
262  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
263  SCIP_DECL_EVENTINITSOL((*eventinitsol)) /**< solving process initialization callback of event handler */
264  )
265 {
266  assert(scip != NULL);
267  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
268 
269  SCIPeventhdlrSetInitsol(eventhdlr, eventinitsol);
270  return SCIP_OKAY;
271 }
272 
273 /** sets solving process deinitialization callback of the event handler */
275  SCIP* scip, /**< scip instance */
276  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
277  SCIP_DECL_EVENTEXITSOL((*eventexitsol)) /**< solving process deinitialization callback of event handler */
278  )
279 {
280  assert(scip != NULL);
281  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
282 
283  SCIPeventhdlrSetExitsol(eventhdlr, eventexitsol);
284  return SCIP_OKAY;
285 }
286 
287 /** sets callback of the event handler to free specific event data */
289  SCIP* scip, /**< scip instance */
290  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
291  SCIP_DECL_EVENTDELETE ((*eventdelete)) /**< free specific event data */
292  )
293 {
294  assert(scip != NULL);
295  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetEventhdlrDelete", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
296 
297  SCIPeventhdlrSetDelete(eventhdlr, eventdelete);
298  return SCIP_OKAY;
299 }
300 
301 /** returns the event handler of the given name, or NULL if not existing */
303  SCIP* scip, /**< SCIP data structure */
304  const char* name /**< name of event handler */
305  )
306 {
307  assert(scip != NULL);
308  assert(scip->set != NULL);
309  assert(name != NULL);
310 
311  return SCIPsetFindEventhdlr(scip->set, name);
312 }
313 
314 /** returns the array of currently available event handlers */
316  SCIP* scip /**< SCIP data structure */
317  )
318 {
319  assert(scip != NULL);
320  assert(scip->set != NULL);
321 
322  return scip->set->eventhdlrs;
323 }
324 
325 /** returns the number of currently available event handlers */
327  SCIP* scip /**< SCIP data structure */
328  )
329 {
330  assert(scip != NULL);
331  assert(scip->set != NULL);
332 
333  return scip->set->neventhdlrs;
334 }
335 
336 /** catches a global (not variable or row dependent) event
337  *
338  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
339  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
340  *
341  * @pre This method can be called if @p scip is in one of the following stages:
342  * - \ref SCIP_STAGE_TRANSFORMING
343  * - \ref SCIP_STAGE_TRANSFORMED
344  * - \ref SCIP_STAGE_INITPRESOLVE
345  * - \ref SCIP_STAGE_PRESOLVING
346  * - \ref SCIP_STAGE_EXITPRESOLVE
347  * - \ref SCIP_STAGE_PRESOLVED
348  * - \ref SCIP_STAGE_INITSOLVE
349  * - \ref SCIP_STAGE_SOLVING
350  * - \ref SCIP_STAGE_SOLVED
351  * - \ref SCIP_STAGE_EXITSOLVE
352  * - \ref SCIP_STAGE_FREETRANS
353  */
355  SCIP* scip, /**< SCIP data structure */
356  SCIP_EVENTTYPE eventtype, /**< event type mask to select events to catch */
357  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
358  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
359  int* filterpos /**< pointer to store position of event filter entry, or NULL */
360  )
361 {
362  SCIP_CALL( SCIPcheckStage(scip, "SCIPcatchEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
363 
364  SCIP_CALL( SCIPeventfilterAdd(scip->eventfilter, scip->mem->probmem, scip->set,
365  eventtype, eventhdlr, eventdata, filterpos) );
366 
367  return SCIP_OKAY;
368 }
369 
370 /** drops a global event (stops to track event)
371  *
372  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
373  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
374  *
375  * @pre This method can be called if @p scip is in one of the following stages:
376  * - \ref SCIP_STAGE_TRANSFORMING
377  * - \ref SCIP_STAGE_TRANSFORMED
378  * - \ref SCIP_STAGE_INITPRESOLVE
379  * - \ref SCIP_STAGE_PRESOLVING
380  * - \ref SCIP_STAGE_EXITPRESOLVE
381  * - \ref SCIP_STAGE_PRESOLVED
382  * - \ref SCIP_STAGE_INITSOLVE
383  * - \ref SCIP_STAGE_SOLVING
384  * - \ref SCIP_STAGE_SOLVED
385  * - \ref SCIP_STAGE_EXITSOLVE
386  * - \ref SCIP_STAGE_FREETRANS
387  */
389  SCIP* scip, /**< SCIP data structure */
390  SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */
391  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
392  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
393  int filterpos /**< position of event filter entry returned by SCIPcatchEvent(), or -1 */
394  )
395 {
396  SCIP_CALL( SCIPcheckStage(scip, "SCIPdropEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
397 
398  SCIP_CALL( SCIPeventfilterDel(scip->eventfilter, scip->mem->probmem, scip->set,
399  eventtype, eventhdlr, eventdata, filterpos) );
400 
401  return SCIP_OKAY;
402 }
403 
404 /** catches an objective value or domain change event on the given transformed variable
405  *
406  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
407  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
408  *
409  * @pre This method can be called if @p scip is in one of the following stages:
410  * - \ref SCIP_STAGE_TRANSFORMING
411  * - \ref SCIP_STAGE_TRANSFORMED
412  * - \ref SCIP_STAGE_INITPRESOLVE
413  * - \ref SCIP_STAGE_PRESOLVING
414  * - \ref SCIP_STAGE_EXITPRESOLVE
415  * - \ref SCIP_STAGE_PRESOLVED
416  * - \ref SCIP_STAGE_INITSOLVE
417  * - \ref SCIP_STAGE_SOLVING
418  * - \ref SCIP_STAGE_SOLVED
419  * - \ref SCIP_STAGE_EXITSOLVE
420  * - \ref SCIP_STAGE_FREETRANS
421  */
423  SCIP* scip, /**< SCIP data structure */
424  SCIP_VAR* var, /**< transformed variable to catch event for */
425  SCIP_EVENTTYPE eventtype, /**< event type mask to select events to catch */
426  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
427  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
428  int* filterpos /**< pointer to store position of event filter entry, or NULL */
429  )
430 {
431  SCIP_CALL( SCIPcheckStage(scip, "SCIPcatchVarEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
432 
433  if( (eventtype & SCIP_EVENTTYPE_VARCHANGED) == 0 )
434  {
435  SCIPerrorMessage("event does not operate on a single variable\n");
436  return SCIP_INVALIDDATA;
437  }
438 
439  if( SCIPvarIsOriginal(var) )
440  {
441  SCIPerrorMessage("cannot catch events on original variable <%s>\n", SCIPvarGetName(var));
442  return SCIP_INVALIDDATA;
443  }
444 
445  SCIP_CALL( SCIPvarCatchEvent(var, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
446 
447  return SCIP_OKAY;
448 }
449 
450 /** drops an objective value or domain change event (stops to track event) on the given transformed variable
451  *
452  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
453  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
454  *
455  * @pre This method can be called if @p scip is in one of the following stages:
456  * - \ref SCIP_STAGE_TRANSFORMING
457  * - \ref SCIP_STAGE_TRANSFORMED
458  * - \ref SCIP_STAGE_INITPRESOLVE
459  * - \ref SCIP_STAGE_PRESOLVING
460  * - \ref SCIP_STAGE_EXITPRESOLVE
461  * - \ref SCIP_STAGE_PRESOLVED
462  * - \ref SCIP_STAGE_INITSOLVE
463  * - \ref SCIP_STAGE_SOLVING
464  * - \ref SCIP_STAGE_SOLVED
465  * - \ref SCIP_STAGE_EXITSOLVE
466  * - \ref SCIP_STAGE_FREETRANS
467  */
469  SCIP* scip, /**< SCIP data structure */
470  SCIP_VAR* var, /**< transformed variable to drop event for */
471  SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */
472  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
473  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
474  int filterpos /**< position of event filter entry returned by SCIPcatchVarEvent(), or -1 */
475  )
476 {
477  SCIP_CALL( SCIPcheckStage(scip, "SCIPdropVarEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
478 
479  if( SCIPvarIsOriginal(var) )
480  {
481  SCIPerrorMessage("cannot drop events on original variable <%s>\n", SCIPvarGetName(var));
482  return SCIP_INVALIDDATA;
483  }
484 
485  SCIP_CALL( SCIPvarDropEvent(var, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
486 
487  return SCIP_OKAY;
488 }
489 
490 /** catches a row coefficient, constant, or side change event on the given row
491  *
492  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
493  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
494  *
495  * @pre This method can be called if @p scip is in one of the following stages:
496  * - \ref SCIP_STAGE_TRANSFORMING
497  * - \ref SCIP_STAGE_TRANSFORMED
498  * - \ref SCIP_STAGE_INITPRESOLVE
499  * - \ref SCIP_STAGE_PRESOLVING
500  * - \ref SCIP_STAGE_EXITPRESOLVE
501  * - \ref SCIP_STAGE_PRESOLVED
502  * - \ref SCIP_STAGE_INITSOLVE
503  * - \ref SCIP_STAGE_SOLVING
504  * - \ref SCIP_STAGE_SOLVED
505  * - \ref SCIP_STAGE_EXITSOLVE
506  * - \ref SCIP_STAGE_FREETRANS
507  */
509  SCIP* scip, /**< SCIP data structure */
510  SCIP_ROW* row, /**< linear row to catch event for */
511  SCIP_EVENTTYPE eventtype, /**< event type mask to select events to catch */
512  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
513  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
514  int* filterpos /**< pointer to store position of event filter entry, or NULL */
515  )
516 {
517  SCIP_CALL( SCIPcheckStage(scip, "SCIPcatchRowEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
518 
519  if( (eventtype & SCIP_EVENTTYPE_ROWCHANGED) == 0 )
520  {
521  SCIPerrorMessage("event does not operate on a single row\n");
522  return SCIP_INVALIDDATA;
523  }
524 
525  SCIP_CALL( SCIProwCatchEvent(row, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
526 
527  return SCIP_OKAY;
528 }
529 
530 /** drops a row coefficient, constant, or side change event (stops to track event) on the given row
531  *
532  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
533  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
534  *
535  * @pre This method can be called if @p scip is in one of the following stages:
536  * - \ref SCIP_STAGE_TRANSFORMING
537  * - \ref SCIP_STAGE_TRANSFORMED
538  * - \ref SCIP_STAGE_INITPRESOLVE
539  * - \ref SCIP_STAGE_PRESOLVING
540  * - \ref SCIP_STAGE_EXITPRESOLVE
541  * - \ref SCIP_STAGE_PRESOLVED
542  * - \ref SCIP_STAGE_INITSOLVE
543  * - \ref SCIP_STAGE_SOLVING
544  * - \ref SCIP_STAGE_SOLVED
545  * - \ref SCIP_STAGE_EXITSOLVE
546  * - \ref SCIP_STAGE_FREETRANS
547  */
549  SCIP* scip, /**< SCIP data structure */
550  SCIP_ROW* row, /**< linear row to drop event for */
551  SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */
552  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
553  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
554  int filterpos /**< position of event filter entry returned by SCIPcatchVarEvent(), or -1 */
555  )
556 {
557  SCIP_CALL( SCIPcheckStage(scip, "SCIPdropRowEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
558 
559  SCIP_CALL( SCIProwDropEvent(row, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
560 
561  return SCIP_OKAY;
562 }
internal methods for separators
void SCIPeventhdlrSetInit(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINIT((*eventinit)))
Definition: event.c:367
void SCIPeventhdlrSetCopy(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTCOPY((*eventcopy)))
Definition: event.c:345
SCIP_RETCODE SCIPsetIncludeEventhdlr(SCIP_SET *set, SCIP_EVENTHDLR *eventhdlr)
Definition: set.c:4566
#define NULL
Definition: def.h:239
internal methods for managing events
default message handler
trivialnegation primal heuristic
internal methods for storing primal CIP solutions
SCIP_RETCODE SCIPsetEventhdlrInitsol(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINITSOL((*eventinitsol)))
Definition: scip_event.c:260
methods to interpret (evaluate) an expression tree "fast"
internal methods for branch and bound tree
void SCIPeventhdlrSetExitsol(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXITSOL((*eventexitsol)))
Definition: event.c:400
SCIP_RETCODE SCIPcatchVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:422
methods for implications, variable bounds, and cliques
int SCIPgetNEventhdlrs(SCIP *scip)
Definition: scip_event.c:326
SCIP_RETCODE SCIPsetEventhdlrExitsol(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXITSOL((*eventexitsol)))
Definition: scip_event.c:274
internal methods for clocks and timing issues
SCIP_RETCODE SCIPsetEventhdlrExit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXIT((*eventexit)))
Definition: scip_event.c:246
SCIP_EVENTHDLR * SCIPsetFindEventhdlr(SCIP_SET *set, const char *name)
Definition: set.c:4589
SCIP_RETCODE SCIPeventfilterDel(SCIP_EVENTFILTER *eventfilter, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: event.c:1892
internal methods for NLPI solver interfaces
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: scip_event.c:172
SCIP_RETCODE SCIPcatchRowEvent(SCIP *scip, SCIP_ROW *row, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:508
SCIP_DECL_EVENTEXIT(EventhdlrNewSol::scip_exit)
interface methods for specific LP solvers
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:138
internal methods for displaying statistics tables
SCIP_RETCODE SCIPvarCatchEvent(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: var.c:17823
#define SCIP_EVENTTYPE_ROWCHANGED
Definition: type_event.h:131
#define FALSE
Definition: def.h:65
methods for the aggregation rows
internal methods for Benders&#39; decomposition
#define TRUE
Definition: def.h:64
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
methods commonly used by primal heuristics
internal methods for branching rules and branching candidate storage
datastructures for concurrent solvers
public methods for problem variables
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
Definition: scip_event.c:302
internal methods for handling parameter settings
methods for creating output for visualization tools (VBC, BAK)
nodereopt branching rule
SCIP_RETCODE SCIPdropRowEvent(SCIP *scip, SCIP_ROW *row, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:548
internal methods for LP management
SCIP_DECL_EVENTINITSOL(EventhdlrNewSol::scip_initsol)
internal methods for branching and inference history
internal methods for collecting primal CIP solutions and primal informations
int neventhdlrs
Definition: struct_set.h:118
internal methods for propagators
SCIP_DECL_EVENTINIT(EventhdlrNewSol::scip_init)
SCIP_DECL_EVENTFREE(EventhdlrNewSol::scip_free)
SCIP_MEM * mem
Definition: struct_scip.h:61
SCIP_RETCODE SCIProwCatchEvent(SCIP_ROW *row, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: lp.c:7740
void SCIPeventhdlrSetInitsol(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINITSOL((*eventinitsol)))
Definition: event.c:389
git hash methods
SCIP_RETCODE SCIPeventfilterAdd(SCIP_EVENTFILTER *eventfilter, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: event.c:1799
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_EVENTFILTER * eventfilter
Definition: struct_scip.h:77
SCIP_RETCODE SCIPsetEventhdlrFree(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTFREE((*eventfree)))
Definition: scip_event.c:218
SCIP_RETCODE SCIPsetEventhdlrCopy(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTCOPY((*eventcopy)))
Definition: scip_event.c:204
methods for block memory pools and memory buffers
public methods for event handler plugins and event handlers
register additional core functionality that is designed as plugins
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
Definition: debug.c:1933
SCIP_RETCODE SCIPsetEventhdlrInit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINIT((*eventinit)))
Definition: scip_event.c:232
internal methods for presolvers
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:155
void SCIPeventhdlrSetExit(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXIT((*eventexit)))
Definition: event.c:378
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16729
internal methods for NLP management
internal miscellaneous methods
internal methods for node selectors and node priority queues
internal methods for variable pricers
internal methods for global SCIP settings
internal methods for storing conflicts
#define SCIP_CALL(x)
Definition: def.h:351
SCIP main data structure.
internal methods for storing priced variables
internal methods for relaxators
internal methods for storing separated cuts
methods commonly used for presolving
methods for catching the user CTRL-C interrupt
internal methods for problem variables
data structures and methods for collecting reoptimization information
the function declarations for the synchronization store
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
Definition: var.c:16858
internal methods for user interface dialog
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:354
void SCIPeventhdlrSetFree(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTFREE((*eventfree)))
Definition: event.c:356
SCIP_RETCODE SCIPincludeEventhdlr(SCIP *scip, const char *name, const char *desc, SCIP_DECL_EVENTCOPY((*eventcopy)), SCIP_DECL_EVENTFREE((*eventfree)), SCIP_DECL_EVENTINIT((*eventinit)), SCIP_DECL_EVENTEXIT((*eventexit)), SCIP_DECL_EVENTINITSOL((*eventinitsol)), SCIP_DECL_EVENTEXITSOL((*eventexitsol)), SCIP_DECL_EVENTDELETE((*eventdelete)), SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: scip_event.c:131
internal methods for input file readers
methods for debugging
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:388
SCIP_RETCODE SCIPdropVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:468
reoptsols primal heuristic
internal methods for storing cuts in a cut pool
Constraint handler for linear constraints in their most general form, .
SCIP_EVENTHDLR ** SCIPgetEventhdlrs(SCIP *scip)
Definition: scip_event.c:315
SCIP_RETCODE SCIProwDropEvent(SCIP_ROW *row, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: lp.c:7764
helper functions for concurrent scip solvers
internal methods for return codes for SCIP methods
BMS_BLKMEM * probmem
Definition: struct_mem.h:40
internal methods for conflict analysis
internal methods for tree compressions
internal methods for main solving loop and node processing
SCIP_RETCODE SCIPsetEventhdlrDelete(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTDELETE((*eventdelete)))
Definition: scip_event.c:288
SCIP_SET * set
Definition: struct_scip.h:62
public methods for message output
SCIP_DECL_EVENTEXEC(EventhdlrNewSol::scip_exec)
default user interface dialog
internal methods for problem statistics
#define SCIP_EVENTTYPE_VARCHANGED
Definition: type_event.h:113
SCIP_DECL_EVENTEXITSOL(EventhdlrNewSol::scip_exitsol)
#define SCIP_DECL_EVENTCOPY(x)
Definition: type_event.h:165
internal methods for constraints and constraint handlers
declarations for XML parsing
build flags methods
SCIP_DECL_EVENTDELETE(EventhdlrNewSol::scip_delete)
void SCIPeventhdlrSetDelete(SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTDELETE((*eventdelete)))
Definition: event.c:411
SCIP_RETCODE SCIPvarDropEvent(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: var.c:17850
common defines and data types used in all packages of SCIP
internal methods for primal heuristics
SCIP_RETCODE SCIPeventhdlrCreate(SCIP_EVENTHDLR **eventhdlr, SCIP_SET *set, const char *name, const char *desc, SCIP_DECL_EVENTCOPY((*eventcopy)), SCIP_DECL_EVENTFREE((*eventfree)), SCIP_DECL_EVENTINIT((*eventinit)), SCIP_DECL_EVENTEXIT((*eventexit)), SCIP_DECL_EVENTINITSOL((*eventinitsol)), SCIP_DECL_EVENTEXITSOL((*eventexitsol)), SCIP_DECL_EVENTDELETE((*eventdelete)), SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: event.c:113
internal methods for Benders&#39; decomposition cuts
SCIP_EVENTHDLR ** eventhdlrs
Definition: struct_set.h:82
internal methods for displaying runtime statistics
uint64_t SCIP_EVENTTYPE
Definition: type_event.h:134
OFINS - Objective Function Induced Neighborhood Search - a primal heuristic for reoptimization.