Scippy

SCIP

Solving Constraint Integer Programs

scip_disp.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-2019 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_disp.c
17  * @brief public methods for display handler plugins
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 "scip/debug.h"
36 #include "scip/disp.h"
37 #include "scip/pub_message.h"
38 #include "scip/scip_disp.h"
39 #include "scip/set.h"
40 #include "scip/struct_mem.h"
41 #include "scip/struct_scip.h"
42 #include "scip/struct_set.h"
43 
44 /** creates a display column and includes it in SCIP */
46  SCIP* scip, /**< SCIP data structure */
47  const char* name, /**< name of display column */
48  const char* desc, /**< description of display column */
49  const char* header, /**< head line of display column */
50  SCIP_DISPSTATUS dispstatus, /**< display activation status of display column */
51  SCIP_DECL_DISPCOPY ((*dispcopy)), /**< copy method of display column or NULL if you don't want to copy your plugin into sub-SCIPs */
52  SCIP_DECL_DISPFREE ((*dispfree)), /**< destructor of display column */
53  SCIP_DECL_DISPINIT ((*dispinit)), /**< initialize display column */
54  SCIP_DECL_DISPEXIT ((*dispexit)), /**< deinitialize display column */
55  SCIP_DECL_DISPINITSOL ((*dispinitsol)), /**< solving process initialization method of display column */
56  SCIP_DECL_DISPEXITSOL ((*dispexitsol)), /**< solving process deinitialization method of display column */
57  SCIP_DECL_DISPOUTPUT ((*dispoutput)), /**< output method */
58  SCIP_DISPDATA* dispdata, /**< display column data */
59  int width, /**< width of display column (no. of chars used) */
60  int priority, /**< priority of display column */
61  int position, /**< relative position of display column */
62  SCIP_Bool stripline /**< should the column be separated with a line from its right neighbor? */
63  )
64 {
65  SCIP_DISP* disp;
66 
67  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeDisp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
68 
69  /* check whether display column is already present */
70  if( SCIPfindDisp(scip, name) != NULL )
71  {
72  SCIPerrorMessage("display column <%s> already included.\n", name);
73  return SCIP_INVALIDDATA;
74  }
75 
76  SCIP_CALL( SCIPdispCreate(&disp, scip->set, scip->messagehdlr, scip->mem->setmem,
77  name, desc, header, dispstatus,
78  dispcopy,
79  dispfree, dispinit, dispexit, dispinitsol, dispexitsol, dispoutput, dispdata,
80  width, priority, position, stripline) );
81  SCIP_CALL( SCIPsetIncludeDisp(scip->set, disp) );
82 
83  return SCIP_OKAY;
84 }
85 
86 /** returns the display column of the given name, or NULL if not existing */
88  SCIP* scip, /**< SCIP data structure */
89  const char* name /**< name of display column */
90  )
91 {
92  assert(scip != NULL);
93  assert(scip->set != NULL);
94  assert(name != NULL);
95 
96  return SCIPsetFindDisp(scip->set, name);
97 }
98 
99 /** returns the array of currently available display columns */
101  SCIP* scip /**< SCIP data structure */
102  )
103 {
104  assert(scip != NULL);
105  assert(scip->set != NULL);
106 
107  return scip->set->disps;
108 }
109 
110 /** returns the number of currently available display columns */
112  SCIP* scip /**< SCIP data structure */
113  )
114 {
115  assert(scip != NULL);
116  assert(scip->set != NULL);
117 
118  return scip->set->ndisps;
119 }
120 
121 /** automatically selects display columns for being shown w.r.t. the display width parameter */
123  SCIP* scip /**< SCIP data structure */
124  )
125 {
126  assert(scip != NULL);
127  assert(scip->set != NULL);
128 
130 
131  return SCIP_OKAY;
132 }
133 
134 /** changes the display column mode */
136  SCIP_DISP* disp, /**< display column */
137  SCIP_DISPMODE mode /**< the display column mode */
138  )
139 {
140  assert(disp != NULL);
141 
142  SCIPdispChgMode(disp, mode);
143 }
void SCIPdispChgMode(SCIP_DISP *disp, SCIP_DISPMODE mode)
Definition: disp.c:558
int ndisps
Definition: struct_set.h:124
#define NULL
Definition: def.h:253
#define SCIP_DECL_DISPINITSOL(x)
Definition: type_disp.h:106
struct SCIP_DispData SCIP_DISPDATA
Definition: type_disp.h:62
SCIP_RETCODE SCIPdispAutoActivate(SCIP_SET *set)
Definition: disp.c:491
enum SCIP_DispMode SCIP_DISPMODE
Definition: type_disp.h:59
#define FALSE
Definition: def.h:73
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPdispCreate(SCIP_DISP **disp, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, const char *header, SCIP_DISPSTATUS dispstatus, SCIP_DECL_DISPCOPY((*dispcopy)), SCIP_DECL_DISPFREE((*dispfree)), SCIP_DECL_DISPINIT((*dispinit)), SCIP_DECL_DISPEXIT((*dispexit)), SCIP_DECL_DISPINITSOL((*dispinitsol)), SCIP_DECL_DISPEXITSOL((*dispexitsol)), SCIP_DECL_DISPOUTPUT((*dispoutput)), SCIP_DISPDATA *dispdata, int width, int priority, int position, SCIP_Bool stripline)
Definition: disp.c:140
#define SCIP_DECL_DISPCOPY(x)
Definition: type_disp.h:71
#define SCIP_DECL_DISPINIT(x)
Definition: type_disp.h:87
SCIP_MEM * mem
Definition: struct_scip.h:61
#define SCIPerrorMessage
Definition: pub_message.h:45
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:2010
void SCIPchgDispMode(SCIP_DISP *disp, SCIP_DISPMODE mode)
Definition: scip_disp.c:135
int SCIPgetNDisps(SCIP *scip)
Definition: scip_disp.c:111
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:365
SCIP main data structure.
BMS_BLKMEM * setmem
Definition: struct_mem.h:39
SCIP_DISP * SCIPfindDisp(SCIP *scip, const char *name)
Definition: scip_disp.c:87
#define SCIP_Bool
Definition: def.h:70
#define SCIP_DECL_DISPFREE(x)
Definition: type_disp.h:79
methods for debugging
datastructures for block memory pools and memory buffers
SCIP_RETCODE SCIPincludeDisp(SCIP *scip, const char *name, const char *desc, const char *header, SCIP_DISPSTATUS dispstatus, SCIP_DECL_DISPCOPY((*dispcopy)), SCIP_DECL_DISPFREE((*dispfree)), SCIP_DECL_DISPINIT((*dispinit)), SCIP_DECL_DISPEXIT((*dispexit)), SCIP_DECL_DISPINITSOL((*dispinitsol)), SCIP_DECL_DISPEXITSOL((*dispexitsol)), SCIP_DECL_DISPOUTPUT((*dispoutput)), SCIP_DISPDATA *dispdata, int width, int priority, int position, SCIP_Bool stripline)
Definition: scip_disp.c:45
SCIP_RETCODE SCIPautoselectDisps(SCIP *scip)
Definition: scip_disp.c:122
SCIP_DISP * SCIPsetFindDisp(SCIP_SET *set, const char *name)
Definition: set.c:4804
SCIP_DISP ** SCIPgetDisps(SCIP *scip)
Definition: scip_disp.c:100
#define SCIP_DECL_DISPEXITSOL(x)
Definition: type_disp.h:117
#define SCIP_DECL_DISPEXIT(x)
Definition: type_disp.h:95
SCIP_SET * set
Definition: struct_scip.h:62
public methods for message output
enum SCIP_DispStatus SCIP_DISPSTATUS
Definition: type_disp.h:50
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:65
#define SCIP_DECL_DISPOUTPUT(x)
Definition: type_disp.h:126
SCIP_DISP ** disps
Definition: struct_set.h:86
datastructures for global SCIP settings
SCIP_RETCODE SCIPsetIncludeDisp(SCIP_SET *set, SCIP_DISP *disp)
Definition: set.c:4772
public methods for display handler plugins
internal methods for displaying runtime statistics