SCIP-SDP  4.0.0
disp_sdpiterations.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-2021 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-2021 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_sdpiterations.h"
43 #include "relax_sdp.h"
44 
45 /* turn off lint warnings for whole file: */
46 /*lint --e{788,818}*/
47 
48 #define DISP_NAME "sdpiterations"
49 #define DISP_DESC "number of SDP iterations"
50 #define DISP_HEADER "SDP iter"
51 #define DISP_WIDTH 8
52 #define DISP_PRIORITY 30001
53 #define DISP_POSITION 1000
54 #define DISP_STRIPLINE TRUE
59 /*
60  * Data structures
61  */
62 
64 struct SCIP_DispData
65 {
66  SCIP_RELAX* relaxSDP;
67 };
68 
69 
70 
71 /*
72  * Callback methods of display column
73  */
74 
76 static
77 SCIP_DECL_DISPCOPY(dispCopySdpiterations)
78 { /*lint --e{715}*/
79  assert(scip != NULL);
80  assert(disp != NULL);
81 
82  /* call inclusion method of display column */
83  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
84 
85  return SCIP_OKAY;
86 }
87 
89 static
90 SCIP_DECL_DISPFREE(dispFreeSdpiterations)
91 {
92  SCIP_DISPDATA* dispdata;
93 
94  assert( scip != NULL );
95  assert( disp != NULL );
96  dispdata = SCIPdispGetData(disp);
97  assert( dispdata != NULL );
98 
99  SCIPfreeMemory(scip, &dispdata);
100  SCIPdispSetData(disp, NULL);
101 
102  return SCIP_OKAY;
103 }
104 
106 static
107 SCIP_DECL_DISPINITSOL(dispInitsolSdpiterations)
108 { /*lint --e{715}*/
109  SCIP_DISPDATA* dispdata;
110 
111  assert( disp != NULL );
112  dispdata = SCIPdispGetData(disp);
113  assert( dispdata != NULL );
114 
115  dispdata->relaxSDP = SCIPfindRelax(scip, "SDP");
116 
117  return SCIP_OKAY;
118 }
119 
121 static
122 SCIP_DECL_DISPOUTPUT(dispOutputSdpiterations)
123 { /*lint --e{715}*/
124  SCIP_DISPDATA* dispdata;
125 
126  assert( scip != NULL );
127  assert( disp != NULL );
128 
129  dispdata = SCIPdispGetData(disp);
130 
131  assert( dispdata != NULL );
132 
133  if ( dispdata->relaxSDP != NULL )
134  SCIPdispLongint(SCIPgetMessagehdlr(scip), file, (long long) SCIPrelaxSdpGetNIterations(dispdata->relaxSDP), DISP_WIDTH);
135 
136  return SCIP_OKAY;
137 }
138 
139 
140 /*
141  * display column specific interface methods
142  */
143 
146  SCIP* scip
147  )
148 {
149  SCIP_DISPDATA* dispdata = NULL;
150 
151  assert( scip != NULL );
152 
153  /* create display column data */
154  SCIP_CALL( SCIPallocMemory(scip, &dispdata) );
155 
156  /* include display column */
157  SCIP_CALL( SCIPincludeDisp(scip, DISP_NAME, DISP_DESC, DISP_HEADER, SCIP_DISPSTATUS_AUTO,
158  dispCopySdpiterations,
159  dispFreeSdpiterations, NULL, NULL,
160  dispInitsolSdpiterations, NULL, dispOutputSdpiterations,
162 
163  return SCIP_OKAY;
164 }
SDP-relaxator.
#define DISP_WIDTH
#define DISP_DESC
static SCIP_DECL_DISPINITSOL(dispInitsolSdpiterations)
Column to display the total number of SDP-iterations.
static SCIP_DECL_DISPOUTPUT(dispOutputSdpiterations)
#define DISP_POSITION
int SCIPrelaxSdpGetNIterations(SCIP_RELAX *relax)
Definition: relax_sdp.c:5635
static SCIP_DECL_DISPCOPY(dispCopySdpiterations)
#define DISP_HEADER
#define DISP_NAME
static SCIP_DECL_DISPFREE(dispFreeSdpiterations)
#define DISP_PRIORITY
SCIP_RETCODE SCIPincludeDispSdpiterations(SCIP *scip)
#define DISP_STRIPLINE