SCIP-SDP  4.0.0
scipsdpdefplugins.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 "scipsdp/scipsdpdef.h"
41 
42 
44 #include "scip/scipdefplugins.h"
45 #include "scip/scipshell.h"
46 
47 #include "cons_sdp.h"
49 #include "cons_savedsdpsettings.h"
50 #include "relax_sdp.h"
51 #include "reader_cbf.h"
52 #include "reader_sdpa.h"
53 #include "prop_sdpredcost.h"
54 #include "disp_sdpiterations.h"
55 #include "disp_sdpavgiterations.h"
56 #include "disp_sdpfastsettings.h"
57 #include "disp_sdppenalty.h"
58 #include "disp_sdpunsolved.h"
59 #include "branch_sdpmostfrac.h"
60 #include "branch_sdpmostinf.h"
61 #include "branch_sdpobjective.h"
62 #include "branch_sdpinfobjective.h"
63 #include "heur_sdpfracdiving.h"
64 #include "heur_sdpfracround.h"
65 #include "heur_sdpinnerlp.h"
66 #include "heur_sdprand.h"
67 #include "prop_sdpobbt.h"
68 #include "prop_companalcent.h"
69 #include "scipsdpgithash.c"
70 #include "table_relaxsdp.h"
71 #include "table_slater.h"
72 
73 /* hack to allow to change the name of the dialog without needing to copy everything */
74 #include "scip/struct_dialog.h"
75 
76 /* hack to change default parameter values*/
77 #include "scip/struct_paramset.h"
78 
79 /* The functions SCIPparamSetDefaultBool() and SCIPparamSetDefaultInt() are internal functions of SCIP. To nevertheless
80  * change the default parameters, we add our own locate methods below. */
81 
83 static
85  SCIP_PARAM* param,
86  SCIP_Bool defaultvalue
87  )
88 {
89  assert(param != NULL);
90  assert(param->paramtype == SCIP_PARAMTYPE_BOOL);
91 
92  param->data.boolparam.defaultvalue = defaultvalue;
93 }
94 
96 static
98  SCIP_PARAM* param,
99  int defaultvalue
100  )
101 {
102  assert(param != NULL);
103  assert(param->paramtype == SCIP_PARAMTYPE_INT);
104 
105  assert(param->data.intparam.minvalue <= defaultvalue && param->data.intparam.maxvalue >= defaultvalue);
106 
107  param->data.intparam.defaultvalue = defaultvalue;
108 }
109 
111 static
113  SCIP_PARAM* param,
114  SCIP_Real defaultvalue
115  )
116 {
117  assert(param != NULL);
118  assert(param->paramtype == SCIP_PARAMTYPE_REAL);
119 
120  assert(param->data.realparam.minvalue <= defaultvalue && param->data.realparam.maxvalue >= defaultvalue);
121 
122  param->data.realparam.defaultvalue = defaultvalue;
123 }
124 
125 
127 static
129  SCIP* scip
130  )
131 {
132  SCIP_PARAM* param;
133 
134  /* change default feastol and dualfeastol */
135  param = SCIPgetParam(scip, "numerics/feastol");
136  paramSetDefaultReal(param, 1e-5);
137 
138  param = SCIPgetParam(scip, "numerics/dualfeastol");
139  paramSetDefaultReal(param, 1e-5);
140 
141  /* turn off LP solving - note that the SDP relaxator is on by default */
142  param = SCIPgetParam(scip, "lp/solvefreq");
143  paramSetDefaultInt(param, -1);
144 
145  param = SCIPgetParam(scip, "lp/cleanuprows");
146  paramSetDefaultBool(param, FALSE);
147 
148  param = SCIPgetParam(scip, "lp/cleanuprowsroot");
149  paramSetDefaultBool(param, FALSE);
150 
151  /* Because in the SDP-world there are no warmstarts as for LPs, the main advantage for DFS (that the change in the
152  * problem is minimal and therefore the Simplex can continue with the current Basis) is lost and best first search, which
153  * provably needs the least number of nodes (see the Dissertation of Tobias Achterberg, the node selection rule with
154  * the least number of nodes, allways has to be a best first search), is the optimal choice
155  */
156  param = SCIPgetParam(scip, "nodeselection/hybridestim/stdpriority");
157  paramSetDefaultInt(param, 1000000);
158 
159  param = SCIPgetParam(scip, "nodeselection/hybridestim/maxplungedepth");
160  paramSetDefaultInt(param, 0);
161 
162  param = SCIPgetParam(scip, "nodeselection/hybridestim/estimweight");
163  paramSetDefaultReal(param, 0.0);
164 
165  /* change display */
166  param = SCIPgetParam(scip, "display/lpiterations/active");
167  paramSetDefaultInt(param, 0);
168 
169  param = SCIPgetParam(scip, "display/lpavgiterations/active");
170  paramSetDefaultInt(param, 0);
171 
172  param = SCIPgetParam(scip, "display/nfrac/active");
173  paramSetDefaultInt(param, 0);
174 
175  param = SCIPgetParam(scip, "display/curcols/active");
176  paramSetDefaultInt(param, 0);
177 
178  param = SCIPgetParam(scip, "display/strongbranchs/active");
179  paramSetDefaultInt(param, 0);
180 
181  /* oneopt might run into an infinite loop during SDP-solving */
182  param = SCIPgetParam(scip, "heuristics/oneopt/freq");
183  paramSetDefaultInt(param, -1);
184 
185  /* deactivate conflict analysis by default, since it has no effect for SDP solving and a negative influence on LP-solving */
186  param = SCIPgetParam(scip, "conflict/enable");
187  paramSetDefaultBool(param, FALSE);
188 
189  /* now set parameters to their default value */
190  SCIP_CALL( SCIPresetParams(scip) );
191 
192  return SCIP_OKAY;
193 }
194 
195 
198  SCIP* scip
199  )
200 {
201  char scipsdpname[SCIP_MAXSTRLEN];
202  char scipsdpdesc[SCIP_MAXSTRLEN];
203  SCIP_DIALOG* dialog;
204 
205  /* add description */
206  (void) SCIPsnprintf(scipsdpname, SCIP_MAXSTRLEN, "SCIP-SDP %d.%d.%d", SCIPSDPmajorVersion, SCIPSDPminorVersion, SCIPSDPtechVersion); /*lint !e169, !e778*/
207  (void) SCIPsnprintf(scipsdpdesc, SCIP_MAXSTRLEN, "Mixed Integer Semidefinite Programming Plugin for SCIP "
208  "[GitHash: %s] (www.opt.tu-darmstadt.de/scipsdp/)", SCIPSDP_GITHASH);
209  SCIP_CALL( SCIPincludeExternalCodeInformation(scip, scipsdpname, scipsdpdesc) );
210 
211  /* include default SCIP plugins */
212  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
213 
214  /* change default parameter settings */
215  SCIP_CALL( SCIPSDPsetDefaultParams(scip) );
216 
217  /* include new plugins */
218  SCIP_CALL( SCIPincludeReaderCbf(scip) );
219  SCIP_CALL( SCIPincludeReaderSdpa(scip) );
220  SCIP_CALL( SCIPincludeConshdlrSdp(scip) );
221  SCIP_CALL( SCIPincludeConshdlrSdpRank1(scip) );
222  SCIP_CALL( SCIPincludeConshdlrSavesdpsol(scip) );
223  SCIP_CALL( SCIPincludeConshdlrSavedsdpsettings(scip) );
224  SCIP_CALL( SCIPincludeRelaxSdp(scip) );
225  SCIP_CALL( SCIPincludePropSdpredcost(scip) );
226  SCIP_CALL( SCIPincludeBranchruleSdpmostfrac(scip) );
227  SCIP_CALL( SCIPincludeBranchruleSdpmostinf(scip) );
228  SCIP_CALL( SCIPincludeBranchruleSdpobjective(scip) );
229  SCIP_CALL( SCIPincludeBranchruleSdpinfobjective(scip) );
230  SCIP_CALL( SCIPincludeHeurSdpFracdiving(scip) );
231  SCIP_CALL( SCIPincludeHeurSdpFracround(scip) );
232  SCIP_CALL( SCIPincludeHeurSdpInnerlp(scip) );
233  SCIP_CALL( SCIPincludeHeurSdpRand(scip) );
234  SCIP_CALL( SCIPincludePropSdpObbt(scip) );
235  SCIP_CALL( SCIPincludePropCompAnalCent(scip) );
236 
237  /* change name of dialog */
238  dialog = SCIPgetRootDialog(scip);
239  BMSfreeMemoryArrayNull(&dialog->name);
240  SCIP_ALLOC( BMSallocMemoryArray(&dialog->name, 9) );
241  (void) SCIPstrncpy(dialog->name, "SCIP-SDP", 9);
242 
243  /* include displays */
244  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
245  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
246  SCIP_CALL( SCIPincludeDispSdpfastsettings(scip) );
247  SCIP_CALL( SCIPincludeDispSdppenalty(scip) );
248  SCIP_CALL( SCIPincludeDispSdpunsolved(scip) );
249 
250  /* include tables */
251  SCIP_CALL( SCIPincludeTableRelaxSdp(scip) );
252  SCIP_CALL( SCIPincludeTableSlater(scip) );
253 
254  return SCIP_OKAY;
255 }
SCIP_RETCODE SCIPincludeConshdlrSavedsdpsettings(SCIP *scip)
SCIP_RETCODE SCIPincludePropCompAnalCent(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpfastsettings(SCIP *scip)
main definitions for SCIP-SDP
Column to display the percentage of SDP-relaxations that were solved using fast settings.
static SCIP_RETCODE SCIPSDPsetDefaultParams(SCIP *scip)
SCIP_RETCODE SCIPincludeTableRelaxSdp(SCIP *scip)
SCIP_RETCODE SCIPincludePropSdpObbt(SCIP *scip)
Definition: prop_sdpobbt.c:522
SCIP_RETCODE SCIPincludeTableSlater(SCIP *scip)
Definition: table_slater.c:298
file reader for mixed-integer semidefinite programs in SDPA format
SCIP_RETCODE SCIPincludeConshdlrSdp(SCIP *scip)
Definition: cons_sdp.c:7664
SCIP_RETCODE SCIPincludeHeurSdpInnerlp(SCIP *scip)
#define SCIPSDPminorVersion
Definition: scipsdpdef.h:54
file reader for mixed-integer semidefinite programs in CBF format
SDP-relaxator.
most fractional branching rule for SCIP-SDP
Slater statistics table.
SCIP_RETCODE SCIPincludeDispSdppenalty(SCIP *scip)
SCIP_RETCODE SCIPSDPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPincludeBranchruleSdpmostinf(SCIP *scip)
optimization-based bound tightening propagator for semidefinite programs
Column to display the percentage of SDP-relaxations that could not be solved even using a penalty for...
highest absolute objective branching rule for SCIP-SDP
combined infeasibility and absolute objective branching rule for SCIP-SDP
fractional rounding heuristic for SDPs
set up inner approximation LP formulation and run heuristics
SCIP_RETCODE SCIPincludeBranchruleSdpmostfrac(SCIP *scip)
most infeasible branching rule for SCIP-SDP
Constraint handler for SDP-constraints.
SCIP_RETCODE SCIPincludeDispSdpavgiterations(SCIP *scip)
SCIP_RETCODE SCIPincludeReaderCbf(SCIP *scip)
Definition: reader_cbf.c:3088
SCIP_RETCODE SCIPincludeHeurSdpRand(SCIP *scip)
Definition: heur_sdprand.c:483
advanced SDP relaxator statistics table
compute analytic center propagator
SDP diving heuristic that chooses fixings w.r.t. the fractionalities.
Column to display the total number of SDP-iterations.
static void paramSetDefaultBool(SCIP_PARAM *param, SCIP_Bool defaultvalue)
SCIP_RETCODE SCIPincludeConshdlrSdpRank1(SCIP *scip)
Definition: cons_sdp.c:7853
SCIP_RETCODE SCIPincludeConshdlrSavesdpsol(SCIP *scip)
SCIP_RETCODE SCIPincludeHeurSdpFracdiving(SCIP *scip)
randomized rounding heuristic for SDPs
SCIP_RETCODE SCIPincludeBranchruleSdpinfobjective(SCIP *scip)
#define SCIPSDPtechVersion
Definition: scipsdpdef.h:55
#define SCIPSDPmajorVersion
Definition: scipsdpdef.h:53
reduced cost / dual fixing for SDPs
SCIP_RETCODE SCIPincludeReaderSdpa(SCIP *scip)
Definition: reader_sdpa.c:2272
default SCIP-SDP plugins
SCIP_RETCODE SCIPincludeBranchruleSdpobjective(SCIP *scip)
SCIP_RETCODE SCIPincludeHeurSdpFracround(SCIP *scip)
static void paramSetDefaultInt(SCIP_PARAM *param, int defaultvalue)
Column to display the average number of SDP-iterations.
Column to display the percentage of SDP-relaxations where a penalty formulation had to be used...
SCIP_RETCODE SCIPincludePropSdpredcost(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpiterations(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpunsolved(SCIP *scip)
static void paramSetDefaultReal(SCIP_PARAM *param, SCIP_Real defaultvalue)
constraint handler for saving SDP solutions in nodes
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
Definition: relax_sdp.c:4834
constraint handler for saving SDP settings