SCIP-SDP  3.1.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
table_sdpsolversuccess.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-2018 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-2018 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 #include "string.h" /* for strcmp */
42 
43 #include "table_sdpsolversuccess.h"
44 #include "relax_sdp.h"
45 #include "sdpi/sdpi.h"
46 
47 
48 #define TABLE_NAME "sdpsolversuccess"
49 #define TABLE_DESC "SDP solver success statistics table"
50 #define TABLE_POSITION 16100
51 #define TABLE_EARLIEST_STAGE SCIP_STAGE_SOLVING
54 /*
55  * Data structures
56  */
57 
59 struct SCIP_TableData
60 {
61  SCIP_RELAX* relaxSDP;
62  SCIP_Bool absolute;
63 };
64 
65 
66 /*
67  * Callback methods of statistics table
68  */
69 
71 static
72 SCIP_DECL_TABLECOPY(tableCopySdpSolverSuccess)
73 { /*lint --e{715}*/
74  assert( scip != NULL );
75  assert( table != NULL );
76 
77  SCIP_CALL( SCIPincludeTableSdpSolverSuccess(scip) );
78 
79  return SCIP_OKAY;
80 }
81 
82 
84 static
85 SCIP_DECL_TABLEFREE(tableFreeSdpSolverSuccess)
86 { /*lint --e{715}*/
87  SCIP_TABLEDATA* tabledata;
88 
89  assert( scip != NULL );
90  assert( table != NULL );
91  tabledata = SCIPtableGetData(table);
92  assert( tabledata != NULL );
93 
94  SCIPfreeMemory(scip, &tabledata);
95  SCIPtableSetData(table, NULL);
96 
97  return SCIP_OKAY;
98 }
99 
100 
102 static
103 SCIP_DECL_TABLEINITSOL(tableInitsolSdpSolverSuccess)
104 { /*lint --e{715}*/
105  SCIP_TABLEDATA* tabledata;
106 
107  assert( table != NULL );
108  tabledata = SCIPtableGetData(table);
109  assert( tabledata != NULL );
110 
111  tabledata->relaxSDP = SCIPfindRelax(scip, "SDP");
112  assert( tabledata->relaxSDP != NULL );
113 
114  return SCIP_OKAY;
115 }
116 
117 
119 static
120 SCIP_DECL_TABLEOUTPUT(tableOutputSdpSolverSuccess)
121 { /*lint --e{715}*/
122  SCIP_TABLEDATA* tabledata;
123  SCIP_RELAX* relaxsdp;
124 
125  assert( scip != NULL );
126  assert( table != NULL );
127 
128  tabledata = SCIPtableGetData(table);
129  assert( tabledata != NULL );
130 
131  relaxsdp = tabledata->relaxSDP;
132  assert( relaxsdp != NULL );
133 
134  if ( strcmp(SCIPsdpiGetSolverName(), "SDPA") == 0 )
135  {
136  SCIPinfoMessage(scip, file, " SDP-Solvers : Fast Medium Stable Penalty Unsolved\n");
137  if ( tabledata->absolute )
138  {
139  SCIPinfoMessage(scip, file, " %-14.14s: %10" SCIP_LONGINT_FORMAT " %10" SCIP_LONGINT_FORMAT " "
140  "%10" SCIP_LONGINT_FORMAT " %10" SCIP_LONGINT_FORMAT " %10" SCIP_LONGINT_FORMAT "\n",
143  SCIPrelaxSdpGetNSdpUnsolved(relaxsdp));
144  }
145  else
146  {
147  SCIPinfoMessage(scip, file, " %-14.14s: %8.2f %% %8.2f %% %8.2f %% %8.2f %% %8.2f %%\n",
149  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpFast(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp),
150  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpMedium(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp),
151  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpStable(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp),
152  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpPenalty(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp),
153  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpUnsolved(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp));
154  }
155  }
156  else
157  {
158  SCIPinfoMessage(scip, file, " SDP-Solvers : Default Penalty Unsolved\n");
159  if ( tabledata->absolute )
160  {
161  SCIPinfoMessage(scip, file, " %-14.14s: %10" SCIP_LONGINT_FORMAT " %10" SCIP_LONGINT_FORMAT " "
162  "%10" SCIP_LONGINT_FORMAT "\n",
165  }
166  else
167  {
168  SCIPinfoMessage(scip, file, " %-14.14s: %8.2f %% %8.2f %% %8.2f %%\n",
170  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpFast(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp),
171  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpPenalty(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp),
172  100.0 * (SCIP_Real) SCIPrelaxSdpGetNSdpUnsolved(relaxsdp) / (SCIP_Real) SCIPrelaxSdpGetNSdpInterfaceCalls(relaxsdp));
173  }
174  }
175 
176  return SCIP_OKAY;
177 }
178 
179 
180 /*
181  * statistics table specific interface methods
182  */
183 
186  SCIP* scip
187  )
188 {
189  SCIP_TABLEDATA* tabledata;
190 
191  assert( scip != NULL );
192 
193  /* create statistics table data */
194  SCIP_CALL( SCIPallocMemory(scip, &tabledata) );
195 
196  /* include statistics table */
197  SCIP_CALL( SCIPincludeTable(scip, TABLE_NAME, TABLE_DESC, TRUE,
198  tableCopySdpSolverSuccess, tableFreeSdpSolverSuccess, NULL, NULL,
199  tableInitsolSdpSolverSuccess, NULL, tableOutputSdpSolverSuccess,
200  tabledata, TABLE_POSITION, TABLE_EARLIEST_STAGE) );
201 
202  /* add "absolute" parameter */
203  SCIP_CALL( SCIPaddBoolParam( scip, "table/sdpsolversuccess/absolute", "Should statistics be printed in absolute numbers (true) or percentages (false)?",
204  &(tabledata->absolute), FALSE, FALSE, NULL, NULL) );
205 
206  return SCIP_OKAY;
207 }
#define TABLE_EARLIEST_STAGE
static SCIP_DECL_TABLEOUTPUT(tableOutputSdpSolverSuccess)
int SCIPrelaxSdpGetNSdpPenalty(SCIP_RELAX *relax)
Definition: relax_sdp.c:5352
#define TABLE_POSITION
const char * SCIPsdpiGetSolverName(void)
Definition: sdpi.c:1375
SDP-relaxator.
int SCIPrelaxSdpGetNSdpUnsolved(SCIP_RELAX *relax)
Definition: relax_sdp.c:5363
int SCIPrelaxSdpGetNSdpStable(SCIP_RELAX *relax)
Definition: relax_sdp.c:5341
int SCIPrelaxSdpGetNSdpMedium(SCIP_RELAX *relax)
Definition: relax_sdp.c:5330
static SCIP_DECL_TABLECOPY(tableCopySdpSolverSuccess)
General interface methods for SDP-preprocessing (mainly fixing variables and removing empty rows/cols...
int SCIPrelaxSdpGetNSdpInterfaceCalls(SCIP_RELAX *relax)
Definition: relax_sdp.c:5308
SCIP_RETCODE SCIPincludeTableSdpSolverSuccess(SCIP *scip)
#define TABLE_NAME
int SCIPrelaxSdpGetNSdpFast(SCIP_RELAX *relax)
Definition: relax_sdp.c:5319
SDP solver success statistics table.
static SCIP_DECL_TABLEFREE(tableFreeSdpSolverSuccess)
static SCIP_DECL_TABLEINITSOL(tableInitsolSdpSolverSuccess)
#define TABLE_DESC