SCIP-SDP  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
disp_sdpavgiterations.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 programms based on SCIP. */
5 /* */
6 /* Copyright (C) 2011-2013 Discrete Optimization, TU Darmstadt */
7 /* EDOM, FAU Erlangen-Nürnberg */
8 /* 2014-2015 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-2015 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 "disp_sdpavgiterations.h"
43 #include "relax_sdp.h"
44 
45 
46 #define DISP_NAME "sdpavgiterations"
47 #define DISP_DESC "average number of SDP iterations"
48 #define DISP_HEADER "SDP it/n"
49 #define DISP_WIDTH 8
50 #define DISP_PRIORITY 25001
51 #define DISP_POSITION 1400
52 #define DISP_STRIPLINE TRUE
57 /*
58  * Data structures
59  */
60 
62 struct SCIP_DispData
63 {
64  SCIP_RELAX* relaxSDP;
65 };
66 
67 
68 /*
69  * Callback methods of display column
70  */
71 
73 static
74 SCIP_DECL_DISPCOPY(dispCopySdpavgiterations)
75 { /*lint --e{715}*/
76  assert(scip != NULL);
77  assert(disp != NULL);
78 
79  /* call inclusion method of dialog */
80  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
81 
82  return SCIP_OKAY;
83 }
84 
86 static
87 SCIP_DECL_DISPFREE(dispFreeSdpavgiterations)
88 {/*lint --e{715}*/
89  SCIP_DISPDATA* dispdata;
90 
91  assert( disp != NULL );
92 
93  dispdata = SCIPdispGetData(disp);
94  assert( dispdata != NULL );
95 
96  SCIPfreeMemory(scip, &dispdata);
97  SCIPdispSetData(disp, NULL);
98 
99  return SCIP_OKAY;
100 }
101 
103 static
104 SCIP_DECL_DISPINITSOL(dispInitsolSdpavgiterations)
105 { /*lint --e{715}*/
106  SCIP_DISPDATA* dispdata;
107 
108  assert ( disp != NULL );
109 
110  dispdata = SCIPdispGetData(disp);
111  assert( dispdata != NULL );
112 
113  dispdata->relaxSDP = SCIPfindRelax(scip, "SDP");
114  assert( dispdata->relaxSDP != NULL );
115 
116  return SCIP_OKAY;
117 }
118 
120 static
121 SCIP_DECL_DISPOUTPUT(dispOutputSdpavgiterations)
122 { /*lint --e{715}*/
123  SCIP_DISPDATA* dispdata;
124 
125  assert( scip != NULL );
126  assert( disp != NULL );
127 
128  dispdata = SCIPdispGetData(disp);
129  assert( dispdata != NULL );
130  assert( dispdata->relaxSDP != NULL );
131 
132  if ( SCIPrelaxSdpGetNSdpCalls(dispdata->relaxSDP) == 0 )
133  SCIPinfoMessage(scip, file, " - ");
134  else
135  SCIPinfoMessage(scip, file, "%7.1f ", (double) SCIPrelaxSdpGetNIterations(dispdata->relaxSDP) / (double) SCIPrelaxSdpGetNSdpCalls(dispdata->relaxSDP) );
136 
137  return SCIP_OKAY;
138 }
139 
140 
141 
142 /*
143  * display column specific interface methods
144  */
145 
148  SCIP* scip
149  )
150 {
151  SCIP_DISPDATA* dispdata = NULL;
152 
153  assert ( scip != NULL );
154 
155  /* create display column data */
156  SCIP_CALL( SCIPallocMemory(scip, &dispdata) );
157 
158  /* include display column */
159  SCIP_CALL( SCIPincludeDisp(scip, DISP_NAME, DISP_DESC, DISP_HEADER, SCIP_DISPSTATUS_AUTO,
160  dispCopySdpavgiterations,
161  dispFreeSdpavgiterations, NULL, NULL,
162  dispInitsolSdpavgiterations, NULL, dispOutputSdpavgiterations,
164 
165  return SCIP_OKAY;
166 }
#define DISP_POSITION
#define DISP_PRIORITY
#define DISP_WIDTH
static SCIP_DECL_DISPOUTPUT(dispOutputSdpavgiterations)
static SCIP_DECL_DISPCOPY(dispCopySdpavgiterations)
#define DISP_STRIPLINE
SDP relaxator.
static SCIP_DECL_DISPFREE(dispFreeSdpavgiterations)
int SCIPrelaxSdpGetNSdpCalls(SCIP_RELAX *relax)
Definition: relax_sdp.c:1142
#define DISP_HEADER
SCIP_RETCODE SCIPincludeDispSdpavgiterations(SCIP *scip)
int SCIPrelaxSdpGetNIterations(SCIP_RELAX *relax)
Definition: relax_sdp.c:1131
Column to display the average number of SDP iterations.
#define DISP_NAME
#define DISP_DESC
static SCIP_DECL_DISPINITSOL(dispInitsolSdpavgiterations)