SCIP-SDP  3.2.0
table_relaxsdp.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of SCIPSDP - a solving framework for mixed-integer */
4 /* semidefinite programs based on SCIP. */
5 /* */
6 /* Copyright (C) 2011-2013 Discrete Optimization, TU Darmstadt */
7 /* EDOM, FAU Erlangen-Nürnberg */
8 /* 2014-2020 Discrete Optimization, TU Darmstadt */
9 /* */
10 /* */
11 /* This program is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public License */
13 /* as published by the Free Software Foundation; either version 3 */
14 /* of the License, or (at your option) any later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with this program; if not, write to the Free Software */
23 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
24 /* */
25 /* */
26 /* Based on SCIP - Solving Constraint Integer Programs */
27 /* Copyright (C) 2002-2020 Zuse Institute Berlin */
28 /* SCIP is distributed under the terms of the SCIP Academic Licence, */
29 /* see file COPYING in the SCIP distribution. */
30 /* */
31 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
32 
38 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
39 
40 #include <assert.h>
41 
42 #include "table_relaxsdp.h"
43 #include "relax_sdp.h"
44 
45 
46 #define TABLE_NAME "relaxsdp"
47 #define TABLE_DESC "advanced SDP relaxator statistics table"
48 #define TABLE_POSITION 16000
49 #define TABLE_EARLIEST_STAGE SCIP_STAGE_SOLVING
52 /*
53  * Data structures
54  */
55 
57 struct SCIP_TableData
58 {
59  SCIP_RELAX* relaxSDP;
60 };
61 
62 
63 /*
64  * Callback methods of statistics table
65  */
66 
68 static
69 SCIP_DECL_TABLECOPY(tableCopyRelaxSdp)
70 { /*lint --e{715}*/
71  assert( scip != NULL );
72  assert( table != NULL );
73 
74  SCIP_CALL( SCIPincludeTableRelaxSdp(scip) );
75 
76  return SCIP_OKAY;
77 }
78 
79 
81 static
82 SCIP_DECL_TABLEFREE(tableFreeRelaxSdp)
83 { /*lint --e{715}*/
84  SCIP_TABLEDATA* tabledata;
85 
86  assert( scip != NULL );
87  assert( table != NULL );
88  tabledata = SCIPtableGetData(table);
89  assert( tabledata != NULL );
90 
91  SCIPfreeMemory(scip, &tabledata);
92  SCIPtableSetData(table, NULL);
93 
94  return SCIP_OKAY;
95 }
96 
97 
99 static
100 SCIP_DECL_TABLEINITSOL(tableInitsolRelaxSdp)
101 { /*lint --e{715}*/
102  SCIP_TABLEDATA* tabledata;
103 
104  assert( table != NULL );
105  tabledata = SCIPtableGetData(table);
106  assert( tabledata != NULL );
107 
108  tabledata->relaxSDP = SCIPfindRelax(scip, "SDP");
109  assert( tabledata->relaxSDP != NULL );
110 
111  return SCIP_OKAY;
112 }
113 
114 
116 static
117 SCIP_DECL_TABLEOUTPUT(tableOutputRelaxSdp)
118 { /*lint --e{715}*/
119  SCIP_TABLEDATA* tabledata;
120  SCIP_RELAX* relaxsdp;
121 
122  assert( scip != NULL );
123  assert( table != NULL );
124 
125  tabledata = SCIPtableGetData(table);
126  assert( tabledata != NULL );
127 
128  relaxsdp = tabledata->relaxSDP;
129  assert( relaxsdp != NULL );
130 
131  SCIPinfoMessage(scip, file, "Relaxators : Time Calls Iterations Iter/call\n");
132 
133  if ( SCIPrelaxSdpGetNSdpCalls(relaxsdp) > 0 )
134  {
135  SCIPinfoMessage(scip, file, " %-17.17s: %10.2f %10" SCIP_LONGINT_FORMAT " %10" SCIP_LONGINT_FORMAT " %10.2f \n",
136  "SDP", SCIPrelaxGetTime(relaxsdp), SCIPrelaxGetNCalls(relaxsdp), SCIPrelaxSdpGetNIterations(relaxsdp),
137  (SCIP_Real) SCIPrelaxSdpGetNIterations(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpCalls(relaxsdp));
138  }
139  else
140  {
141  SCIPinfoMessage(scip, file, " %-17.17s: %10.2f %10" SCIP_LONGINT_FORMAT " %10" SCIP_LONGINT_FORMAT " %10s \n",
142  "SDP", SCIPrelaxGetTime(relaxsdp), SCIPrelaxGetNCalls(relaxsdp), SCIPrelaxSdpGetNIterations(relaxsdp), "-");
143  }
144 
145  return SCIP_OKAY;
146 }
147 
148 
149 /*
150  * statistics table specific interface methods
151  */
152 
155  SCIP* scip
156  )
157 {
158  SCIP_TABLEDATA* tabledata;
159 
160  assert( scip != NULL );
161 
162  /* create statistics table data */
163  SCIP_CALL( SCIPallocMemory(scip, &tabledata) );
164 
165  /* include statistics table */
166  SCIP_CALL( SCIPincludeTable(scip, TABLE_NAME, TABLE_DESC, TRUE,
167  tableCopyRelaxSdp, tableFreeRelaxSdp, NULL, NULL,
168  tableInitsolRelaxSdp, NULL, tableOutputRelaxSdp,
169  tabledata, TABLE_POSITION, TABLE_EARLIEST_STAGE) );
170 
171  return SCIP_OKAY;
172 }
static SCIP_DECL_TABLEFREE(tableFreeRelaxSdp)
static SCIP_DECL_TABLEOUTPUT(tableOutputRelaxSdp)
SCIP_RETCODE SCIPincludeTableRelaxSdp(SCIP *scip)
#define TABLE_DESC
SDP-relaxator.
#define TABLE_EARLIEST_STAGE
int SCIPrelaxSdpGetNSdpCalls(SCIP_RELAX *relax)
Definition: relax_sdp.c:5136
advanced SDP relaxator statistics table
static SCIP_DECL_TABLEINITSOL(tableInitsolRelaxSdp)
int SCIPrelaxSdpGetNIterations(SCIP_RELAX *relax)
Definition: relax_sdp.c:5125
#define TABLE_POSITION
#define TABLE_NAME
static SCIP_DECL_TABLECOPY(tableCopyRelaxSdp)