Scippy

SCIP

Solving Constraint Integer Programs

scip_table.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_table.c
17  * @brief public methods for statistics table 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/pub_message.h"
37 #include "scip/scip_table.h"
38 #include "scip/set.h"
39 #include "scip/struct_mem.h"
40 #include "scip/struct_scip.h"
41 #include "scip/struct_set.h"
42 #include "scip/table.h"
43 
44 
45 /** creates a statistics table and includes it in SCIP */
47  SCIP* scip, /**< SCIP data structure */
48  const char* name, /**< name of statistics table */
49  const char* desc, /**< description of statistics table */
50  SCIP_Bool active, /**< should the table be activated by default? */
51  SCIP_DECL_TABLECOPY ((*tablecopy)), /**< copy method of statistics table or NULL if you don't want to copy your plugin into sub-SCIPs */
52  SCIP_DECL_TABLEFREE ((*tablefree)), /**< destructor of statistics table */
53  SCIP_DECL_TABLEINIT ((*tableinit)), /**< initialize statistics table */
54  SCIP_DECL_TABLEEXIT ((*tableexit)), /**< deinitialize statistics table */
55  SCIP_DECL_TABLEINITSOL ((*tableinitsol)), /**< solving process initialization method of statistics table */
56  SCIP_DECL_TABLEEXITSOL ((*tableexitsol)), /**< solving process deinitialization method of statistics table */
57  SCIP_DECL_TABLEOUTPUT ((*tableoutput)), /**< output method */
58  SCIP_TABLEDATA* tabledata, /**< statistics table data */
59  int position, /**< position of statistics table */
60  SCIP_STAGE earlieststage /**< output of the statistics table is only printed from this stage onwards */
61  )
62 {
63  SCIP_TABLE* table;
64 
65  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeTable", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
66 
67  /* check whether statistics table is already present */
68  if( SCIPfindTable(scip, name) != NULL )
69  {
70  SCIPerrorMessage("statistics table <%s> already included.\n", name);
71  return SCIP_INVALIDDATA;
72  }
73 
74  SCIP_CALL( SCIPtableCreate(&table, scip->set, scip->messagehdlr, scip->mem->setmem,
75  name, desc, active, tablecopy,
76  tablefree, tableinit, tableexit, tableinitsol, tableexitsol, tableoutput, tabledata,
77  position, earlieststage) );
78  SCIP_CALL( SCIPsetIncludeTable(scip->set, table) );
79 
80  return SCIP_OKAY;
81 }
82 
83 /** returns the statistics table of the given name, or NULL if not existing */
85  SCIP* scip, /**< SCIP data structure */
86  const char* name /**< name of statistics table */
87  )
88 {
89  assert(scip != NULL);
90  assert(scip->set != NULL);
91  assert(name != NULL);
92 
93  return SCIPsetFindTable(scip->set, name);
94 }
95 
96 /** returns the array of currently available statistics tables */
98  SCIP* scip /**< SCIP data structure */
99  )
100 {
101  assert(scip != NULL);
102  assert(scip->set != NULL);
103 
104  return scip->set->tables;
105 }
106 
107 /** returns the number of currently available statistics tables */
109  SCIP* scip /**< SCIP data structure */
110  )
111 {
112  assert(scip != NULL);
113  assert(scip->set != NULL);
114 
115  return scip->set->ntables;
116 }
SCIP_RETCODE SCIPincludeTable(SCIP *scip, const char *name, const char *desc, SCIP_Bool active, SCIP_DECL_TABLECOPY((*tablecopy)), SCIP_DECL_TABLEFREE((*tablefree)), SCIP_DECL_TABLEINIT((*tableinit)), SCIP_DECL_TABLEEXIT((*tableexit)), SCIP_DECL_TABLEINITSOL((*tableinitsol)), SCIP_DECL_TABLEEXITSOL((*tableexitsol)), SCIP_DECL_TABLEOUTPUT((*tableoutput)), SCIP_TABLEDATA *tabledata, int position, SCIP_STAGE earlieststage)
Definition: scip_table.c:46
#define NULL
Definition: def.h:253
#define SCIP_DECL_TABLEINITSOL(x)
Definition: type_table.h:88
SCIP_TABLE * SCIPsetFindTable(SCIP_SET *set, const char *name)
Definition: set.c:4849
internal methods for displaying statistics tables
#define FALSE
Definition: def.h:73
#define SCIP_DECL_TABLEFREE(x)
Definition: type_table.h:61
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
static GRAPHNODE ** active
SCIP_MEM * mem
Definition: struct_scip.h:61
SCIP_TABLE ** SCIPgetTables(SCIP *scip)
Definition: scip_table.c:97
#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
SCIP_TABLE * SCIPfindTable(SCIP *scip, const char *name)
Definition: scip_table.c:84
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
#define SCIP_Bool
Definition: def.h:70
SCIP_RETCODE SCIPsetIncludeTable(SCIP_SET *set, SCIP_TABLE *table)
Definition: set.c:4824
#define SCIP_DECL_TABLECOPY(x)
Definition: type_table.h:53
public methods for statistics table plugins
methods for debugging
datastructures for block memory pools and memory buffers
#define SCIP_DECL_TABLEEXIT(x)
Definition: type_table.h:77
int ntables
Definition: struct_set.h:126
SCIP_TABLE ** tables
Definition: struct_set.h:87
#define SCIP_DECL_TABLEINIT(x)
Definition: type_table.h:69
SCIP_SET * set
Definition: struct_scip.h:62
public methods for message output
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:65
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:50
SCIP_RETCODE SCIPtableCreate(SCIP_TABLE **table, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Bool active, SCIP_DECL_TABLECOPY((*tablecopy)), SCIP_DECL_TABLEFREE((*tablefree)), SCIP_DECL_TABLEINIT((*tableinit)), SCIP_DECL_TABLEEXIT((*tableexit)), SCIP_DECL_TABLEINITSOL((*tableinitsol)), SCIP_DECL_TABLEEXITSOL((*tableexitsol)), SCIP_DECL_TABLEOUTPUT((*tableoutput)), SCIP_TABLEDATA *tabledata, int position, SCIP_STAGE earlieststage)
Definition: table.c:120
int SCIPgetNTables(SCIP *scip)
Definition: scip_table.c:108
datastructures for global SCIP settings
#define SCIP_DECL_TABLEOUTPUT(x)
Definition: type_table.h:108
#define SCIP_DECL_TABLEEXITSOL(x)
Definition: type_table.h:99
struct SCIP_TableData SCIP_TABLEDATA
Definition: type_table.h:44