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