SCIP-SDP  3.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
main.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-2017 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-2017 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 
39 #define SCIPSDPVERSION "3.1.0"
40 
41 #include "objscip/objscipdefplugins.h"
42 
43 #include "cons_sdp.h"
45 #include "cons_savedsdpsettings.h"
46 #include "relax_sdp.h"
47 #include "objreader_sdpa.h"
48 #include "reader_cbf.h"
49 #include "prop_sdpredcost.h"
50 #include "disp_sdpiterations.h"
51 #include "disp_sdpavgiterations.h"
52 #include "disp_sdpfastsettings.h"
53 #include "disp_sdppenalty.h"
54 #include "disp_sdpunsolved.h"
55 #include "branch_sdpmostfrac.h"
56 #include "branch_sdpmostinf.h"
57 #include "branch_sdpobjective.h"
58 #include "branch_sdpinfobjective.h"
59 #include "heur_sdpfracdiving.h"
60 #include "heur_sdprand.h"
61 #include "prop_sdpobbt.h"
62 #include "prop_companalcent.h"
63 #include "scipsdpgithash.c"
64 #include "table_relaxsdp.h"
65 #include "table_sdpsolversuccess.h"
66 #include "table_slater.h"
67 
68 using namespace scip;
69 
71 static
72 SCIP_RETCODE runSCIP(
73  int argc,
74  char** argv
75  )
76 {
77  SCIP* scip = NULL;
78  char scipsdpname[SCIP_MAXSTRLEN];
79  char scipsdpdesc[SCIP_MAXSTRLEN];
80 
81  SCIP_CALL( SCIPcreate(&scip) );
82 
83  /* include new plugins */
84  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPA(scip), TRUE) );
85  SCIP_CALL( SCIPincludeReaderCbf(scip) );
86  SCIP_CALL( SCIPincludeConshdlrSdp(scip) );
87  SCIP_CALL( SCIPincludeConshdlrSavesdpsol(scip) );
88  SCIP_CALL( SCIPincludeConshdlrSavedsdpsettings(scip) );
89  SCIP_CALL( SCIPincludeRelaxSdp(scip) );
90  SCIP_CALL( SCIPincludePropSdpredcost(scip) );
91  SCIP_CALL( SCIPincludeBranchruleSdpmostfrac(scip) );
92  SCIP_CALL( SCIPincludeBranchruleSdpmostinf(scip) );
93  SCIP_CALL( SCIPincludeBranchruleSdpobjective(scip) );
94  SCIP_CALL( SCIPincludeBranchruleSdpinfobjective(scip) );
95  SCIP_CALL( SCIPincludeHeurSdpFracdiving(scip) );
96  SCIP_CALL( SCIPincludeHeurSdpRand(scip) );
97  SCIP_CALL( SCIPincludePropSdpObbt(scip) );
98  SCIP_CALL( SCIPincludePropCompAnalCent(scip) );
99 
100  /* add description */
101  (void) SCIPsnprintf(scipsdpname, SCIP_MAXSTRLEN, "SCIP-SDP %s", SCIPSDPVERSION);
102  (void) SCIPsnprintf(scipsdpdesc, SCIP_MAXSTRLEN, "Mixed Integer Semidefinite Programming Plugin for SCIP "
103  "[GitHash: %s] (www.opt.tu-darmstadt.de/scipsdp/)", SCIPSDP_GITHASH);
104  SCIP_CALL( SCIPincludeExternalCodeInformation(scip, scipsdpname, scipsdpdesc) );
105 
106  /* include default SCIP plugins */
107  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
108 
109  /* disable restarts - for the meantime */
110  SCIP_CALL( SCIPsetIntParam(scip, "limits/restarts", 0) );
111 
112  /* set clocktype to walltime to not add multiple threads together */
113  SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", 2) );
114 
115  /* change certain paramters: */
116  SCIP_CALL( SCIPsetIntParam(scip, "display/verblevel", 5) );
117 
118  /* Choose between LP and SDP relaxations */
119  SCIP_CALL( SCIPsetIntParam(scip, "lp/solvefreq", -1) );
120  SCIP_CALL( SCIPsetIntParam(scip, "relaxing/SDP/freq", 1) );
121  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
122  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
123  SCIP_CALL( SCIPsetIntParam(scip, "display/lpiterations/active", 0) );
124  SCIP_CALL( SCIPsetIntParam(scip, "display/lpavgiterations/active", 0) );
125 
126  /* display numerical problems in SDPs instead of current columns and strong branching */
127  SCIP_CALL( SCIPsetIntParam(scip, "display/nfrac/active", 0) );
128  SCIP_CALL( SCIPsetIntParam(scip, "display/curcols/active", 0) );
129  SCIP_CALL( SCIPsetIntParam(scip, "display/strongbranchs/active", 0) );
130  SCIP_CALL( SCIPincludeDispSdpfastsettings(scip) );
131  SCIP_CALL( SCIPincludeDispSdppenalty(scip) );
132  SCIP_CALL( SCIPincludeDispSdpunsolved(scip) );
133  SCIP_CALL( SCIPsetIntParam(scip, "display/sdpfastsettings/active", 0) );
134  SCIP_CALL( SCIPsetIntParam(scip, "display/sdppenalty/active", 0) );
135 
136  /* display SDP statistics instead of default relaxator statistics */
137  SCIP_CALL( SCIPincludeTableRelaxSdp(scip) );
138  SCIP_CALL( SCIPincludeTableSdpSolverSuccess(scip) );
139  SCIP_CALL( SCIPincludeTableSlater(scip) );
140  SCIP_CALL( SCIPsetBoolParam(scip, "table/relaxator/active", FALSE) );
141 
142  /* change epsilons for numerical stability */
143  SCIP_CALL( SCIPsetRealParam(scip, "numerics/epsilon", 1e-9) );
144  SCIP_CALL( SCIPsetRealParam(scip, "numerics/sumepsilon", 1e-6) );
145  SCIP_CALL( SCIPsetRealParam(scip, "numerics/feastol", 1e-6) );
146 
147  /* parameters for separation */
148  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprows", FALSE) );
149  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprowsroot", FALSE) );
150  SCIP_CALL( SCIPsetIntParam(scip, "lp/rowagelimit", 10) );
151 
152  /* maximum age a cut can reach before it is deleted from the global cut pool, or -1 to keep all cuts */
153  SCIP_CALL( SCIPsetIntParam(scip, "separating/cutagelimit", 10) );
154 
155  SCIP_CALL( SCIPsetIntParam(scip, "separating/maxrounds", 20) );
156 
157  /* Parameters for node selection */
158 
159  /* Because in the SDP-world there are no warmstarts as for LPs, the main advantage for DFS (that the change in the
160  * problem is minimal and therefore the Simplex can continue with the current Basis) is lost and best first search, which
161  * provably needs the least number of nodes (see the Dissertation of Tobias Achterberg, the node selection rule with
162  * the least number of nodes, allways has to be a best first search), is the optimal choice
163  */
164  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/stdpriority", 1000000) );
165  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/maxplungedepth", 0) );
166  SCIP_CALL( SCIPsetRealParam(scip, "nodeselection/hybridestim/estimweight", 0.0) );
167 
168  /* we explicitly enable the use of a debug solution for this main SCIP instance */
169  SCIPenableDebugSol(scip);
170 
171  /* run interactive shell */
172  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, "scip.set") );
173 
174  /* deinitialization */
175  SCIP_CALL( SCIPfree(&scip) );
176 
177  BMScheckEmptyMemory();
178 
179  return SCIP_OKAY;
180 }
181 
183 int main (
184  int argc,
185  char** argv
186  )
187 {
188  SCIP_RETCODE retcode;
189 
190  retcode = runSCIP(argc, argv);
191  if( retcode != SCIP_OKAY )
192  {
193  SCIPprintError(retcode);
194  return -1;
195  }
196 
197  return 0;
198 }
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:458
SCIP_RETCODE SCIPincludeTableSlater(SCIP *scip)
Definition: table_slater.c:308
int main(int argc, char **argv)
Definition: main.cpp:183
SCIP_RETCODE SCIPincludeConshdlrSdp(SCIP *scip)
Definition: cons_sdp.c:2443
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)
#define SCIPSDPVERSION
Definition: main.cpp:39
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:1912
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 SCIPincludeConshdlrSavesdpsol(SCIP *scip)
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
static SCIP_RETCODE runSCIP(int argc, char **argv)
Definition: main.cpp:72
SCIP_RETCODE SCIPincludeBranchruleSdpobjective(SCIP *scip)
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)
constraint handler for saving SDP solutions in nodes
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
Definition: relax_sdp.c:4255
constraint handler for saving SDP settings