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