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-2025 Zuse Institute Berlin (ZIB) */
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_table.c
26 * @ingroup OTHER_CFILES
27 * @brief public methods for statistics table 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 * @author Mohammed Ghannam
40 *
41 * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
42 */
43
44/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
45
46#include "scip/scip_table.h"
47#include "scip/debug.h"
48#include "scip/pub_message.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#include "scip/table.h"
54
55
56/** creates a statistics table and includes it in SCIP
57 *
58 * @pre This method can be called if SCIP is in one of the following stages:
59 - \ref SCIP_STAGE_INIT
60 - \ref SCIP_STAGE_PROBLEM
61 */
63 SCIP* scip, /**< SCIP data structure */
64 const char* name, /**< name of statistics table */
65 const char* desc, /**< description of statistics table */
66 SCIP_Bool active, /**< should the table be activated by default? */
67 SCIP_DECL_TABLECOPY ((*tablecopy)), /**< copy method of statistics table or NULL if you don't want to copy your plugin into sub-SCIPs */
68 SCIP_DECL_TABLEFREE ((*tablefree)), /**< destructor of statistics table */
69 SCIP_DECL_TABLEINIT ((*tableinit)), /**< initialize statistics table */
70 SCIP_DECL_TABLEEXIT ((*tableexit)), /**< deinitialize statistics table */
71 SCIP_DECL_TABLEINITSOL ((*tableinitsol)), /**< solving process initialization method of statistics table */
72 SCIP_DECL_TABLEEXITSOL ((*tableexitsol)), /**< solving process deinitialization method of statistics table */
73 SCIP_DECL_TABLEOUTPUT ((*tableoutput)), /**< output method */
74 SCIP_DECL_TABLECOLLECT((*tablecollect)), /**< data collection method */
75 SCIP_TABLEDATA* tabledata, /**< statistics table data */
76 int position, /**< position of statistics table */
77 SCIP_STAGE earlieststage /**< output of the statistics table is only printed from this stage onwards */
78 )
79{
80 SCIP_TABLE* table;
81
83
84 /* check whether statistics table is already present */
85 if( SCIPfindTable(scip, name) != NULL )
86 {
87 SCIPerrorMessage("statistics table <%s> already included.\n", name);
88 return SCIP_INVALIDDATA;
89 }
90
91 SCIP_CALL( SCIPtableCreate(&table, scip->set, scip->messagehdlr, scip->mem->setmem,
92 name, desc, active, tablecopy,
93 tablefree, tableinit, tableexit, tableinitsol, tableexitsol, tableoutput, tablecollect, tabledata,
94 position, earlieststage) );
95 SCIP_CALL( SCIPsetIncludeTable(scip->set, table) );
96
97 return SCIP_OKAY;
98}
99
100/** returns the statistics table of the given name, or NULL if not existing */
102 SCIP* scip, /**< SCIP data structure */
103 const char* name /**< name of statistics table */
104 )
105{
106 assert(scip != NULL);
107 assert(scip->set != NULL);
108 assert(name != NULL);
109
110 return SCIPsetFindTable(scip->set, name);
111}
112
113/** returns the array of currently available statistics tables */
115 SCIP* scip /**< SCIP data structure */
116 )
117{
118 assert(scip != NULL);
119 assert(scip->set != NULL);
120
121 return scip->set->tables;
122}
123
124/** returns the number of currently available statistics tables */
126 SCIP* scip /**< SCIP data structure */
127 )
128{
129 assert(scip != NULL);
130 assert(scip->set != NULL);
131
132 return scip->set->ntables;
133}
static GRAPHNODE ** active
methods for debugging
#define SCIPcheckStage(scip, method, init, problem, transforming, transformed, initpresolve, presolving, exitpresolve, presolved, initsolve, solving, solved, exitsolve, freetrans, freescip)
Definition: debug.h:364
#define NULL
Definition: def.h:248
#define SCIP_Bool
Definition: def.h:91
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define SCIP_CALL(x)
Definition: def.h:355
SCIP_TABLE ** SCIPgetTables(SCIP *scip)
Definition: scip_table.c:114
int SCIPgetNTables(SCIP *scip)
Definition: scip_table.c:125
SCIP_TABLE * SCIPfindTable(SCIP *scip, const char *name)
Definition: scip_table.c:101
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_DECL_TABLECOLLECT((*tablecollect)), SCIP_TABLEDATA *tabledata, int position, SCIP_STAGE earlieststage)
Definition: scip_table.c:62
public methods for message output
#define SCIPerrorMessage
Definition: pub_message.h:64
public methods for statistics table plugins
SCIP_TABLE * SCIPsetFindTable(SCIP_SET *set, const char *name)
Definition: set.c:5328
SCIP_RETCODE SCIPsetIncludeTable(SCIP_SET *set, SCIP_TABLE *table)
Definition: set.c:5303
internal methods for global SCIP settings
datastructures for block memory pools and memory buffers
SCIP main data structure.
datastructures for global SCIP settings
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_DECL_TABLECOLLECT((*tablecollect)), SCIP_TABLEDATA *tabledata, int position, SCIP_STAGE earlieststage)
Definition: table.c:130
internal methods for displaying statistics tables
@ SCIP_INVALIDDATA
Definition: type_retcode.h:52
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:59
#define SCIP_DECL_TABLEFREE(x)
Definition: type_table.h:77
#define SCIP_DECL_TABLEINITSOL(x)
Definition: type_table.h:104
struct SCIP_TableData SCIP_TABLEDATA
Definition: type_table.h:60
#define SCIP_DECL_TABLEOUTPUT(x)
Definition: type_table.h:124
#define SCIP_DECL_TABLEINIT(x)
Definition: type_table.h:85
#define SCIP_DECL_TABLEEXITSOL(x)
Definition: type_table.h:115
#define SCIP_DECL_TABLECOPY(x)
Definition: type_table.h:69
#define SCIP_DECL_TABLECOLLECT(x)
Definition: type_table.h:133
#define SCIP_DECL_TABLEEXIT(x)
Definition: type_table.h:93