Scippy

GCG

Branch-and-Price & Column Generation for Everyone

event_display.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2021 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
28 /**@file event_display.c
29  * @brief eventhdlr to disable the master display after the root node
30  * @author Martin Bergner
31  */
32 
33 /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include "event_display.h"
36 #include "gcg.h"
37 #include <string.h>
38 
39 #define EVENTHDLR_NAME "display"
40 #define EVENTHDLR_DESC "event handler to disable the master display after the root node"
41 
42 
43 /*
44  * Callback methods of event handler
45  */
46 
47 
48 /** execution method of event handler */
49 static
50 SCIP_DECL_EVENTEXEC(eventExecDisplay)
51 { /*lint --e{715}*/
52  assert(scip != NULL);
53  assert(eventhdlr != NULL);
54  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
55  assert(SCIPeventGetNode(event) == SCIPgetRootNode(scip));
56 
57  SCIP_CALL( SCIPsetIntParam(scip, "display/verblevel", 0) );
58  SCIP_CALL( SCIPdropEvent(scip, SCIP_EVENTTYPE_NODESOLVED, eventhdlr, NULL, -1) );
59 
60  return SCIP_OKAY;
61 }
62 
63 /** activates the eventhandler in SCIP */
65  SCIP* scip /**< SCIP data structure */
66  )
67 {
68  SCIP_EVENTHDLR* eventhdlr;
69 
70  assert(scip != NULL);
71  assert(GCGisMaster(scip));
72 
73  eventhdlr = SCIPfindEventhdlr(scip, EVENTHDLR_NAME);
74  assert(eventhdlr != NULL);
75 
76  SCIP_CALL( SCIPcatchEvent(scip, SCIP_EVENTTYPE_NODESOLVED, eventhdlr, NULL, NULL) );
77 
78  return SCIP_OKAY;
79 }
80 
81 /** creates event handler for display event */
83  SCIP* scip /**< SCIP data structure */
84  )
85 {
86  SCIP_EVENTHDLR* eventhdlr = NULL;
87 
88  assert(scip != NULL);
89  assert(GCGisMaster(scip));
90 
91  /* include event handler into SCIP */
92  SCIP_CALL( SCIPincludeEventhdlrBasic(scip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC,
93  eventExecDisplay, NULL) );
94  assert(eventhdlr != NULL);
95 
96  return SCIP_OKAY;
97 }
GCG interface methods.
#define EVENTHDLR_DESC
Definition: event_display.c:40
eventhdlr to disable the master display after the root node
static SCIP_DECL_EVENTEXEC(eventExecDisplay)
Definition: event_display.c:50
SCIP_Bool GCGisMaster(SCIP *scip)
Definition: misc.c:675
#define EVENTHDLR_NAME
Definition: event_display.c:39
SCIP_RETCODE SCIPincludeEventHdlrDisplay(SCIP *scip)
Definition: event_display.c:82
SCIP_RETCODE SCIPactivateEventHdlrDisplay(SCIP *scip)
Definition: event_display.c:64