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-2022 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 scip_disp.c
17  * @ingroup OTHER_CFILES
18  * @brief public methods for display handler plugins
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Gerald Gamrath
22  * @author Leona Gottwald
23  * @author Stefan Heinz
24  * @author Gregor Hendel
25  * @author Thorsten Koch
26  * @author Alexander Martin
27  * @author Marc Pfetsch
28  * @author Michael Winkler
29  * @author Kati Wolter
30  *
31  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #include "scip/debug.h"
37 #include "scip/disp.h"
38 #include "scip/pub_message.h"
39 #include "scip/scip_disp.h"
40 #include "scip/set.h"
41 #include "scip/struct_mem.h"
42 #include "scip/struct_scip.h"
43 #include "scip/struct_set.h"
44 
45 /** creates a display column and includes it in SCIP */
47  SCIP* scip, /**< SCIP data structure */
48  const char* name, /**< name of display column */
49  const char* desc, /**< description of display column */
50  const char* header, /**< head line of display column */
51  SCIP_DISPSTATUS dispstatus, /**< display activation status of display column */
52  SCIP_DECL_DISPCOPY ((*dispcopy)), /**< copy method of display column or NULL if you don't want to copy your plugin into sub-SCIPs */
53  SCIP_DECL_DISPFREE ((*dispfree)), /**< destructor of display column */
54  SCIP_DECL_DISPINIT ((*dispinit)), /**< initialize display column */
55  SCIP_DECL_DISPEXIT ((*dispexit)), /**< deinitialize display column */
56  SCIP_DECL_DISPINITSOL ((*dispinitsol)), /**< solving process initialization method of display column */
57  SCIP_DECL_DISPEXITSOL ((*dispexitsol)), /**< solving process deinitialization method of display column */
58  SCIP_DECL_DISPOUTPUT ((*dispoutput)), /**< output method */
59  SCIP_DISPDATA* dispdata, /**< display column data */
60  int width, /**< width of display column (no. of chars used) */
61  int priority, /**< priority of display column */
62  int position, /**< relative position of display column */
63  SCIP_Bool stripline /**< should the column be separated with a line from its right neighbor? */
64  )
65 {
66  SCIP_DISP* disp;
67 
68  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeDisp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
69 
70  /* check whether display column is already present */
71  if( SCIPfindDisp(scip, name) != NULL )
72  {
73  SCIPerrorMessage("display column <%s> already included.\n", name);
74  return SCIP_INVALIDDATA;
75  }
76 
77  SCIP_CALL( SCIPdispCreate(&disp, scip->set, scip->messagehdlr, scip->mem->setmem,
78  name, desc, header, dispstatus,
79  dispcopy,
80  dispfree, dispinit, dispexit, dispinitsol, dispexitsol, dispoutput, dispdata,
81  width, priority, position, stripline) );
82  SCIP_CALL( SCIPsetIncludeDisp(scip->set, disp) );
83 
84  return SCIP_OKAY;
85 }
86 
87 /** returns the display column of the given name, or NULL if not existing */
89  SCIP* scip, /**< SCIP data structure */
90  const char* name /**< name of display column */
91  )
92 {
93  assert(scip != NULL);
94  assert(scip->set != NULL);
95  assert(name != NULL);
96 
97  return SCIPsetFindDisp(scip->set, name);
98 }
99 
100 /** returns the array of currently available display columns */
102  SCIP* scip /**< SCIP data structure */
103  )
104 {
105  assert(scip != NULL);
106  assert(scip->set != NULL);
107 
108  return scip->set->disps;
109 }
110 
111 /** returns the number of currently available display columns */
113  SCIP* scip /**< SCIP data structure */
114  )
115 {
116  assert(scip != NULL);
117  assert(scip->set != NULL);
118 
119  return scip->set->ndisps;
120 }
121 
122 /** automatically selects display columns for being shown w.r.t. the display width parameter */
124  SCIP* scip /**< SCIP data structure */
125  )
126 {
127  assert(scip != NULL);
128  assert(scip->set != NULL);
129 
131 
132  return SCIP_OKAY;
133 }
134 
135 /** changes the display column mode */
137  SCIP_DISP* disp, /**< display column */
138  SCIP_DISPMODE mode /**< the display column mode */
139  )
140 {
141  assert(disp != NULL);
142 
143  SCIPdispChgMode(disp, mode);
144 }
void SCIPdispChgMode(SCIP_DISP *disp, SCIP_DISPMODE mode)
Definition: disp.c:559
int ndisps
Definition: struct_set.h:135
#define SCIP_DECL_DISPINITSOL(x)
Definition: type_disp.h:111
struct SCIP_DispData SCIP_DISPDATA
Definition: type_disp.h:67
SCIP_RETCODE SCIPdispAutoActivate(SCIP_SET *set)
Definition: disp.c:492
enum SCIP_DispMode SCIP_DISPMODE
Definition: type_disp.h:64
#define FALSE
Definition: def.h:87
#define TRUE
Definition: def.h:86
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
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:141
#define SCIP_DECL_DISPCOPY(x)
Definition: type_disp.h:76
SCIP_DISP * SCIPfindDisp(SCIP *scip, const char *name)
Definition: scip_disp.c:88
#define SCIP_DECL_DISPINIT(x)
Definition: type_disp.h:92
SCIP_MEM * mem
Definition: struct_scip.h:62
#define SCIPerrorMessage
Definition: pub_message.h:55
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:2177
int SCIPgetNDisps(SCIP *scip)
Definition: scip_disp.c:112
#define NULL
Definition: lpi_spx1.cpp:155
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:384
SCIP main data structure.
BMS_BLKMEM * setmem
Definition: struct_mem.h:39
#define SCIP_Bool
Definition: def.h:84
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:46
#define SCIP_DECL_DISPFREE(x)
Definition: type_disp.h:84
SCIP_RETCODE SCIPautoselectDisps(SCIP *scip)
Definition: scip_disp.c:123
methods for debugging
datastructures for block memory pools and memory buffers
SCIP_DISP * SCIPsetFindDisp(SCIP_SET *set, const char *name)
Definition: set.c:4988
void SCIPchgDispMode(SCIP_DISP *disp, SCIP_DISPMODE mode)
Definition: scip_disp.c:136
#define SCIP_DECL_DISPEXITSOL(x)
Definition: type_disp.h:122
#define SCIP_DECL_DISPEXIT(x)
Definition: type_disp.h:100
SCIP_SET * set
Definition: struct_scip.h:63
public methods for message output
enum SCIP_DispStatus SCIP_DISPSTATUS
Definition: type_disp.h:55
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:66
SCIP_DISP ** SCIPgetDisps(SCIP *scip)
Definition: scip_disp.c:101
#define SCIP_DECL_DISPOUTPUT(x)
Definition: type_disp.h:131
SCIP_DISP ** disps
Definition: struct_set.h:89
datastructures for global SCIP settings
SCIP_RETCODE SCIPsetIncludeDisp(SCIP_SET *set, SCIP_DISP *disp)
Definition: set.c:4956
public methods for display handler plugins
internal methods for displaying runtime statistics