SCIP-SDP  3.2.0
scipsdpdefplugins.cpp
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 #define SCIPSDPVERSION "3.2.0"
41 
42 
44 #include "scip/scipdefplugins.h"
45 
46 #include "objscip/objscipdefplugins.h"
47 
48 #include "cons_sdp.h"
50 #include "cons_savedsdpsettings.h"
51 #include "relax_sdp.h"
52 #include "objreader_sdpa.h"
53 #include "objreader_sdpaind.h"
54 #include "reader_cbf.h"
55 #include "prop_sdpredcost.h"
56 #include "disp_sdpiterations.h"
57 #include "disp_sdpavgiterations.h"
58 #include "disp_sdpfastsettings.h"
59 #include "disp_sdppenalty.h"
60 #include "disp_sdpunsolved.h"
61 #include "branch_sdpmostfrac.h"
62 #include "branch_sdpmostinf.h"
63 #include "branch_sdpobjective.h"
64 #include "branch_sdpinfobjective.h"
65 #include "heur_sdpfracdiving.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_sdpsolversuccess.h"
72 #include "table_slater.h"
73 
74 /* hack to allow to change the name of the dialog without needing to copy everything */
75 #include "scip/struct_dialog.h"
76 
77 using namespace scip;
78 
81  SCIP* scip
82  )
83 {
84  char scipsdpname[SCIP_MAXSTRLEN];
85  char scipsdpdesc[SCIP_MAXSTRLEN];
86  SCIP_DIALOG* dialog;
87 
88  /* add description */
89  (void) SCIPsnprintf(scipsdpname, SCIP_MAXSTRLEN, "SCIP-SDP %s", SCIPSDPVERSION);
90  (void) SCIPsnprintf(scipsdpdesc, SCIP_MAXSTRLEN, "Mixed Integer Semidefinite Programming Plugin for SCIP "
91  "[GitHash: %s] (www.opt.tu-darmstadt.de/scipsdp/)", SCIPSDP_GITHASH);
92  SCIP_CALL( SCIPincludeExternalCodeInformation(scip, scipsdpname, scipsdpdesc) );
93 
94  /* include default SCIP plugins */
95  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
96 
97  /* include new plugins */
98  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPAind(scip), TRUE) );
99  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPA(scip), TRUE) );
100  SCIP_CALL( SCIPincludeReaderCbf(scip) );
101  SCIP_CALL( SCIPincludeConshdlrSdp(scip) );
102  SCIP_CALL( SCIPincludeConshdlrSdpRank1(scip) );
103  SCIP_CALL( SCIPincludeConshdlrSavesdpsol(scip) );
104  SCIP_CALL( SCIPincludeConshdlrSavedsdpsettings(scip) );
105  SCIP_CALL( SCIPincludeRelaxSdp(scip) );
106  SCIP_CALL( SCIPincludePropSdpredcost(scip) );
107  SCIP_CALL( SCIPincludeBranchruleSdpmostfrac(scip) );
108  SCIP_CALL( SCIPincludeBranchruleSdpmostinf(scip) );
109  SCIP_CALL( SCIPincludeBranchruleSdpobjective(scip) );
110  SCIP_CALL( SCIPincludeBranchruleSdpinfobjective(scip) );
111  SCIP_CALL( SCIPincludeHeurSdpFracdiving(scip) );
112  SCIP_CALL( SCIPincludeHeurSdpRand(scip) );
113  SCIP_CALL( SCIPincludePropSdpObbt(scip) );
114  SCIP_CALL( SCIPincludePropCompAnalCent(scip) );
115 
116  /* change name of dialog */
117  dialog = SCIPgetRootDialog(scip);
118  BMSfreeMemoryArrayNull(&dialog->name);
119  SCIP_ALLOC( BMSallocMemoryArray(&dialog->name, 9) );
120  (void) SCIPstrncpy(dialog->name, "SCIP-SDP", 9);
121 
122  /* include displays */
123  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
124  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
125  SCIP_CALL( SCIPincludeDispSdpfastsettings(scip) );
126  SCIP_CALL( SCIPincludeDispSdppenalty(scip) );
127  SCIP_CALL( SCIPincludeDispSdpunsolved(scip) );
128 
129  /* include tables */
130  SCIP_CALL( SCIPincludeTableRelaxSdp(scip) );
131  SCIP_CALL( SCIPincludeTableSdpSolverSuccess(scip) );
132  SCIP_CALL( SCIPincludeTableSlater(scip) );
133 
134  /* set clocktype to walltime to not add multiple threads together */
135  SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", 2) );
136 
137  /* Choose between LP and SDP relaxations */
138  SCIP_CALL( SCIPsetIntParam(scip, "lp/solvefreq", -1) );
139  SCIP_CALL( SCIPsetIntParam(scip, "relaxing/SDP/freq", 1) );
140  SCIP_CALL( SCIPsetIntParam(scip, "display/lpiterations/active", 0) );
141  SCIP_CALL( SCIPsetIntParam(scip, "display/lpavgiterations/active", 0) );
142 
143  /* display numerical problems in SDPs instead of current columns and strong branching */
144  SCIP_CALL( SCIPsetIntParam(scip, "display/nfrac/active", 0) );
145  SCIP_CALL( SCIPsetIntParam(scip, "display/curcols/active", 0) );
146  SCIP_CALL( SCIPsetIntParam(scip, "display/strongbranchs/active", 0) );
147  SCIP_CALL( SCIPsetIntParam(scip, "display/sdpfastsettings/active", 0) );
148  SCIP_CALL( SCIPsetIntParam(scip, "display/sdppenalty/active", 0) );
149 
150  /* display SDP statistics instead of default relaxator statistics */
151  SCIP_CALL( SCIPsetBoolParam(scip, "table/relaxator/active", FALSE) );
152 
153  /* change epsilons for numerical stability */
154  SCIP_CALL( SCIPsetRealParam(scip, "numerics/epsilon", 1e-9) );
155  SCIP_CALL( SCIPsetRealParam(scip, "numerics/sumepsilon", 1e-6) );
156  SCIP_CALL( SCIPsetRealParam(scip, "numerics/feastol", 1e-6) );
157 
158  /* parameters for separation */
159  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprows", FALSE) );
160  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprowsroot", FALSE) );
161 
162  /* Because in the SDP-world there are no warmstarts as for LPs, the main advantage for DFS (that the change in the
163  * problem is minimal and therefore the Simplex can continue with the current Basis) is lost and best first search, which
164  * provably needs the least number of nodes (see the Dissertation of Tobias Achterberg, the node selection rule with
165  * the least number of nodes, allways has to be a best first search), is the optimal choice
166  */
167  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/stdpriority", 1000000) );
168  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/maxplungedepth", 0) );
169  SCIP_CALL( SCIPsetRealParam(scip, "nodeselection/hybridestim/estimweight", 0.0) );
170 
171  return SCIP_OKAY;
172 }
SCIP_RETCODE SCIPincludeConshdlrSavedsdpsettings(SCIP *scip)
SCIP_RETCODE SCIPincludePropCompAnalCent(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpfastsettings(SCIP *scip)
Column to display the percentage of SDP-relaxations that were solved using fast settings.
SCIP_RETCODE SCIPincludeTableRelaxSdp(SCIP *scip)
SCIP_RETCODE SCIPincludePropSdpObbt(SCIP *scip)
Definition: prop_sdpobbt.c:537
SCIP_RETCODE SCIPincludeTableSlater(SCIP *scip)
Definition: table_slater.c:308
Reader for SDPA-Files with indicator constraints (-var in linear constraint => indicator constraint w...
SCIP_RETCODE SCIPincludeConshdlrSdp(SCIP *scip)
Definition: cons_sdp.c:4420
file reader for mixed-integer semidefinite programs in CBF format
SDP-relaxator.
most fractional branching rule for SCIP-SDP
Reader for SDPA-Files.
Slater statistics table.
SCIP_RETCODE SCIPincludeDispSdppenalty(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
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:2878
SCIP_RETCODE SCIPincludeTableSdpSolverSuccess(SCIP *scip)
SCIP_RETCODE SCIPincludeHeurSdpRand(SCIP *scip)
Definition: heur_sdprand.c:406
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.
SCIP_RETCODE SCIPincludeConshdlrSdpRank1(SCIP *scip)
Definition: cons_sdp.c:4513
SCIP_RETCODE SCIPincludeConshdlrSavesdpsol(SCIP *scip)
#define SCIPSDPVERSION
SDP solver success statistics table.
SCIP_RETCODE SCIPincludeHeurSdpFracdiving(SCIP *scip)
randomized rounding heuristic for SDPs
SCIP_RETCODE SCIPincludeBranchruleSdpinfobjective(SCIP *scip)
reduced cost / dual fixing for SDPs
default SCIP-SDP plugins
SCIP_RETCODE SCIPincludeBranchruleSdpobjective(SCIP *scip)
Column to display the average number of SDP-iterations.
SCIP_RETCODE SCIPSDPincludeDefaultPlugins(SCIP *scip)
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)
constraint handler for saving SDP solutions in nodes
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
Definition: relax_sdp.c:4387
constraint handler for saving SDP settings